HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GA_ListTypeRef< FromType, ToType, INT_TYPE > Class Template Reference

#include <GA_OffsetList.h>

+ Inheritance diagram for GA_ListTypeRef< FromType, ToType, INT_TYPE >:

Classes

class  ListTypeData
 

Public Types

typedef INT_TYPE theIntType
 

Public Member Functions

SYS_FORCE_INLINE GA_ListTypeRef ()
 Default constructor. More...
 
SYS_FORCE_INLINE GA_ListTypeRef (const GA_ListTypeRef &src)
 Copy constructor. More...
 
SYS_FORCE_INLINE GA_ListTypeRef (GA_ListTypeRef &&src)
 Move constructor. More...
 
SYS_FORCE_INLINE GA_ListTypeRef (ToType startvalue, GA_Size size, bool flag_set=false)
 Trivial list constructor. More...
 
SYS_FORCE_INLINE ~GA_ListTypeRef ()
 Destructor. More...
 
SYS_FORCE_INLINE GA_ListTypeRefoperator= (const GA_ListTypeRef &src)
 Copy assignment operator. More...
 
SYS_FORCE_INLINE GA_ListTypeRefoperator= (GA_ListTypeRef &&src)
 Move assignment operator. More...
 
SYS_FORCE_INLINE void clear ()
 clear removes all of the entries More...
 
SYS_FORCE_INLINE void setTrivial (ToType startvalue, GA_Size size)
 Makes the list a trivial list with the specified start value and size. More...
 
SYS_FORCE_INLINE void setTrivial (ToType startvalue, GA_Size size, bool flag)
 
SYS_FORCE_INLINE GA_Size capacity () const
 Returns the allocated capacity of the list. More...
 
SYS_FORCE_INLINE FromType entries () const
 Returns the number of used elements in the list (always <= capacity()) More...
 
SYS_FORCE_INLINE FromType size () const
 Returns the number of used elements in the list (always <= capacity()) More...
 
SYS_FORCE_INLINE bool isTrivial () const
 
SYS_FORCE_INLINE bool getExtraFlag () const
 
SYS_FORCE_INLINE void setExtraFlag (bool v)
 
bool isSame (const GA_ListTypeRef &that) const
 
bool isAscending () const
 Identifies whether the data is in ascending order. More...
 
FromType find (ToType value, FromType s=FromType(0)) const
 
FromType findSorted (ToType value, FromType s=FromType(0)) const
 Find the target in a sorted list. More...
 
SYS_FORCE_INLINE ToType get (FromType index) const
 Get the the value at the index. More...
 
SYS_FORCE_INLINE ToType trivialStart () const
 Returns the start, assuming this list is trivial. More...
 
bool isEqual (const GA_ListTypeRef &other, FromType start, FromType end) const
 Test a sub-block for equality with another list. More...
 
ToType last () const
 Return the value of the last element. More...
 
SYS_FORCE_INLINE ToType operator() (FromType i) const
 Convenience () operator to access the list entries. More...
 
FromType findInRange (FromType start, FromType end, ToType search) const
 
FromType findInRangeNotEqual (FromType start, FromType end, ToType search) const
 
FromType findValidInRange (FromType start, FromType end) const
 
FromType findInvalidInRange (FromType start, FromType end) const
 
template<typename FUNCTOR >
SYS_FORCE_INLINE void forEach (FUNCTOR &&functor) const
 
SYS_FORCE_INLINE int64 getMemoryUsage (bool inclusive) const
 Report memory usage (includes all shared memory) More...
 

Protected Attributes

union {
   ListTypeData *   myData
 
   struct {
      int64   myIsTrivial:1
 
      int64   myTrivialOffset:63
 
      uint64   myIsFlagSet:1
 
      uint64   mySize:63
 
   } 
 
}; 
 

Static Protected Attributes

static const intptr_t POINTER_MASK = ~0x1
 
static const intptr_t TRIVIAL_MASK = 0x1
 
static const intptr_t FLAG_MASK = 0x1
 

Friends

template<typename FromType2 , typename ToType2 , typename INT_TYPE2 >
class GA_ListTypeRef
 
template<typename FromType2 , typename ToType2 , typename INT_TYPE2 >
class GA_ListType
 

Detailed Description

template<typename FromType, typename ToType, typename INT_TYPE = exint>
class GA_ListTypeRef< FromType, ToType, INT_TYPE >

GA_OffsetList implements an array of GA_Offsets. Copy-on-write is used to reduce memory usage and make the copying of a GA_OffsetList an inexpensive operation.

See also: JSON Schema: GA_OffsetList

Definition at line 48 of file GA_OffsetList.h.

Member Typedef Documentation

template<typename FromType, typename ToType, typename INT_TYPE = exint>
typedef INT_TYPE GA_ListTypeRef< FromType, ToType, INT_TYPE >::theIntType

Definition at line 57 of file GA_OffsetList.h.

Constructor & Destructor Documentation

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE GA_ListTypeRef< FromType, ToType, INT_TYPE >::GA_ListTypeRef ( )
inlineexplicit

Default constructor.

Definition at line 463 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE GA_ListTypeRef< FromType, ToType, INT_TYPE >::GA_ListTypeRef ( const GA_ListTypeRef< FromType, ToType, INT_TYPE > &  src)
inline

Copy constructor.

Definition at line 471 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE GA_ListTypeRef< FromType, ToType, INT_TYPE >::GA_ListTypeRef ( GA_ListTypeRef< FromType, ToType, INT_TYPE > &&  src)
inline

Move constructor.

Definition at line 486 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE GA_ListTypeRef< FromType, ToType, INT_TYPE >::GA_ListTypeRef ( ToType  startvalue,
GA_Size  size,
bool  flag_set = false 
)
inline

Trivial list constructor.

Definition at line 507 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE GA_ListTypeRef< FromType, ToType, INT_TYPE >::~GA_ListTypeRef ( )
inline

Destructor.

Definition at line 517 of file GA_OffsetList.h.

Member Function Documentation

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE GA_Size GA_ListTypeRef< FromType, ToType, INT_TYPE >::capacity ( ) const
inline

Returns the allocated capacity of the list.

Definition at line 599 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE void GA_ListTypeRef< FromType, ToType, INT_TYPE >::clear ( )
inline

clear removes all of the entries

Definition at line 565 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE FromType GA_ListTypeRef< FromType, ToType, INT_TYPE >::entries ( ) const
inline

Returns the number of used elements in the list (always <= capacity())

Definition at line 605 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
FromType GA_ListTypeRef< FromType, ToType, INT_TYPE >::find ( ToType  value,
FromType  s = FromType(0) 
) const

Linearly search for the specified entry. Returns the index of first matching element found, -1 otherwise. An optional starting index can be specified in s.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
FromType GA_ListTypeRef< FromType, ToType, INT_TYPE >::findInRange ( FromType  start,
FromType  end,
ToType  search 
) const
inline

Finds the first instance of the search pattern in the given range. Returns end if not found.

Definition at line 689 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
FromType GA_ListTypeRef< FromType, ToType, INT_TYPE >::findInRangeNotEqual ( FromType  start,
FromType  end,
ToType  search 
) const
inline

Definition at line 701 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
FromType GA_ListTypeRef< FromType, ToType, INT_TYPE >::findInvalidInRange ( FromType  start,
FromType  end 
) const
inline

Definition at line 730 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
FromType GA_ListTypeRef< FromType, ToType, INT_TYPE >::findSorted ( ToType  value,
FromType  s = FromType(0) 
) const

Find the target in a sorted list.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
FromType GA_ListTypeRef< FromType, ToType, INT_TYPE >::findValidInRange ( FromType  start,
FromType  end 
) const
inline

Definition at line 716 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
template<typename FUNCTOR >
SYS_FORCE_INLINE void GA_ListTypeRef< FromType, ToType, INT_TYPE >::forEach ( FUNCTOR &&  functor) const
inline

Calls a functor (e.g. a lambda) for each entry, only checking for triviality once, to reduce overhead.

Definition at line 749 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE ToType GA_ListTypeRef< FromType, ToType, INT_TYPE >::get ( FromType  index) const
inline

Get the the value at the index.

Definition at line 654 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE bool GA_ListTypeRef< FromType, ToType, INT_TYPE >::getExtraFlag ( ) const
inline

Definition at line 623 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE int64 GA_ListTypeRef< FromType, ToType, INT_TYPE >::getMemoryUsage ( bool  inclusive) const
inline

Report memory usage (includes all shared memory)

Definition at line 773 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
bool GA_ListTypeRef< FromType, ToType, INT_TYPE >::isAscending ( ) const

Identifies whether the data is in ascending order.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
bool GA_ListTypeRef< FromType, ToType, INT_TYPE >::isEqual ( const GA_ListTypeRef< FromType, ToType, INT_TYPE > &  other,
FromType  start,
FromType  end 
) const

Test a sub-block for equality with another list.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
bool GA_ListTypeRef< FromType, ToType, INT_TYPE >::isSame ( const GA_ListTypeRef< FromType, ToType, INT_TYPE > &  that) const
inline

Definition at line 630 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE bool GA_ListTypeRef< FromType, ToType, INT_TYPE >::isTrivial ( ) const
inline

Check whether this offset list is stored in a compact (non-allocated) form. NOTE: It must be threadsafe to call this while hardening a non-trivial list and get false as a return value. GA_IndexMap::compactIndices() may be called at the same time as GA_IndexMap::isTrivial(), and this must return false, no matter what the race.

Definition at line 621 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
ToType GA_ListTypeRef< FromType, ToType, INT_TYPE >::last ( ) const
inline

Return the value of the last element.

Definition at line 675 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE ToType GA_ListTypeRef< FromType, ToType, INT_TYPE >::operator() ( FromType  i) const
inline

Convenience () operator to access the list entries.

Definition at line 685 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE GA_ListTypeRef& GA_ListTypeRef< FromType, ToType, INT_TYPE >::operator= ( const GA_ListTypeRef< FromType, ToType, INT_TYPE > &  src)
inline

Copy assignment operator.

Definition at line 525 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE GA_ListTypeRef& GA_ListTypeRef< FromType, ToType, INT_TYPE >::operator= ( GA_ListTypeRef< FromType, ToType, INT_TYPE > &&  src)
inline

Move assignment operator.

Definition at line 541 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE void GA_ListTypeRef< FromType, ToType, INT_TYPE >::setExtraFlag ( bool  v)
inline

Definition at line 625 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE void GA_ListTypeRef< FromType, ToType, INT_TYPE >::setTrivial ( ToType  startvalue,
GA_Size  size 
)
inline

Makes the list a trivial list with the specified start value and size.

Definition at line 577 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE void GA_ListTypeRef< FromType, ToType, INT_TYPE >::setTrivial ( ToType  startvalue,
GA_Size  size,
bool  flag 
)
inline

Makes the list a trivial list with the specified start value and size, and also sets the extra flag.

Definition at line 588 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE FromType GA_ListTypeRef< FromType, ToType, INT_TYPE >::size ( void  ) const
inline

Returns the number of used elements in the list (always <= capacity())

Definition at line 609 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
SYS_FORCE_INLINE ToType GA_ListTypeRef< FromType, ToType, INT_TYPE >::trivialStart ( ) const
inline

Returns the start, assuming this list is trivial.

Definition at line 664 of file GA_OffsetList.h.

Friends And Related Function Documentation

template<typename FromType, typename ToType, typename INT_TYPE = exint>
template<typename FromType2 , typename ToType2 , typename INT_TYPE2 >
friend class GA_ListType
friend

Definition at line 55 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
template<typename FromType2 , typename ToType2 , typename INT_TYPE2 >
friend class GA_ListTypeRef
friend

Definition at line 53 of file GA_OffsetList.h.

Member Data Documentation

union { ... }
template<typename FromType, typename ToType, typename INT_TYPE = exint>
const intptr_t GA_ListTypeRef< FromType, ToType, INT_TYPE >::FLAG_MASK = 0x1
staticprotected

Definition at line 781 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
ListTypeData* GA_ListTypeRef< FromType, ToType, INT_TYPE >::myData

Definition at line 786 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
uint64 GA_ListTypeRef< FromType, ToType, INT_TYPE >::myIsFlagSet

Definition at line 798 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
int64 GA_ListTypeRef< FromType, ToType, INT_TYPE >::myIsTrivial

Definition at line 791 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
uint64 GA_ListTypeRef< FromType, ToType, INT_TYPE >::mySize

Definition at line 799 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
int64 GA_ListTypeRef< FromType, ToType, INT_TYPE >::myTrivialOffset

Definition at line 792 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
const intptr_t GA_ListTypeRef< FromType, ToType, INT_TYPE >::POINTER_MASK = ~0x1
staticprotected

Definition at line 779 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
const intptr_t GA_ListTypeRef< FromType, ToType, INT_TYPE >::TRIVIAL_MASK = 0x1
staticprotected

Definition at line 780 of file GA_OffsetList.h.


The documentation for this class was generated from the following file: