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

#include <GA_OffsetList.h>

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

Public Types

typedef INT_TYPE theIntType
 
- Public Types inherited from GA_ListTypeRef< FromType, ToType, INT_TYPE >
typedef INT_TYPE theIntType
 

Public Member Functions

SYS_FORCE_INLINE GA_ListType ()
 Default constructor. More...
 
SYS_FORCE_INLINE GA_ListType (const GA_ListType &src)
 Copy constructor. More...
 
SYS_FORCE_INLINE GA_ListType (GA_ListType &&src)
 Move constructor. More...
 
SYS_FORCE_INLINE GA_ListType (const Base &src)
 
SYS_FORCE_INLINE GA_ListType (ToType startvalue, GA_Size size, bool flag_set=false)
 Trivial list constructor. More...
 
 GA_ListType (const UT_Array< ToType > &src, FromType start=FromType(0), FromType end=FromType(-1))
 
SYS_FORCE_INLINE ~GA_ListType ()
 Destructor. More...
 
SYS_FORCE_INLINE GA_ListTypeoperator= (const GA_ListType &src)
 Copy assignment operator. More...
 
SYS_FORCE_INLINE GA_ListTypeoperator= (GA_ListType &&src)
 Move assignment operator. More...
 
SYS_FORCE_INLINE GA_ListTypeoperator= (const Base &src)
 
void countMemory (UT_MemoryCounter &counter, bool inclusive) const
 
SYS_FORCE_INLINE void clear ()
 clear removes all of the entries More...
 
void computeTrivial ()
 
void setTrivial (ToType startvalue, GA_Size size)
 Makes the list a trivial list with the specified start value and size. More...
 
void setTrivial (ToType startvalue, GA_Size size, bool flag)
 
void setEntries (FromType sz, bool doresize=true)
 
void reserve (FromType mincapacity)
 
void changeSize (FromType new_capacity)
 
FromType append (ToType value)
 Add a single entry (may grow array) More...
 
void append (const GA_ListType &src)
 
FromType insert (FromType i, ToType value)
 Insert a single entry (may grow array) More...
 
FromType multipleInsert (FromType i, GA_Size count)
 
FromType remove (FromType i)
 Remove the entry at the given offset. More...
 
FromType findAndRemove (ToType i)
 Find an entry and remove it from the list. More...
 
FromType removeIndex (FromType i)
 Alias for remove to match UT array types. More...
 
GA_Size removeAll (ToType i)
 Remove all matching entries from the list. More...
 
void removeLast ()
 Remove the last entry. More...
 
void sortAscending ()
 Sort entries into ascending order. More...
 
void sortAndRemoveDuplicates ()
 Sort entries into ascending order and remove duplicates. More...
 
void set (FromType index, ToType value)
 Set the index to the value. More...
 
template<typename S >
void set (const S *data, exint size, ToType offset)
 
void copyAdd (FromType destindex, const int *values, GA_Size srcindex, GA_Size n, ToType offset)
 
void copyAdd (FromType destindex, const GA_ListTypeRef< FromType, ToType > &values, FromType srcindex, GA_Size n, ToType offset)
 
void setTrivialRange (FromType startindex, ToType startvalue, GA_Size nelements)
 
void constant (ToType value)
 Set all entries to a constant value. More...
 
void cycle (GA_Size howMany)
 Cyclically shift the entire array by howMany. More...
 
void reverse ()
 Reverse the entire array. More...
 
void harden ()
 
void harden (exint mincapacity)
 
void incDataRef ()
 
- Public Member Functions inherited from GA_ListTypeRef< FromType, ToType, INT_TYPE >
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 Types

using ListTypeData = typename Base::ListTypeData
 

Friends

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

Additional Inherited Members

- Protected Attributes inherited from GA_ListTypeRef< FromType, ToType, INT_TYPE >
union {
   ListTypeData *   myData
 
   struct {
      int64   myIsTrivial:1
 
      int64   myTrivialOffset:63
 
      uint64   myIsFlagSet:1
 
      uint64   mySize:63
 
   } 
 
}; 
 
- Static Protected Attributes inherited from GA_ListTypeRef< FromType, ToType, INT_TYPE >
static const intptr_t POINTER_MASK = ~0x1
 
static const intptr_t TRIVIAL_MASK = 0x1
 
static const intptr_t FLAG_MASK = 0x1
 

Detailed Description

template<typename FromType, typename ToType, typename INT_TYPE>
class GA_ListType< FromType, ToType, INT_TYPE >

Definition at line 40 of file GA_OffsetList.h.

Member Typedef Documentation

template<typename FromType, typename ToType, typename INT_TYPE>
using GA_ListType< FromType, ToType, INT_TYPE >::ListTypeData = typename Base::ListTypeData
protected

Definition at line 827 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
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>
SYS_FORCE_INLINE GA_ListType< FromType, ToType, INT_TYPE >::GA_ListType ( )
inlineexplicit

Default constructor.

Definition at line 837 of file GA_OffsetList.h.

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

Copy constructor.

Definition at line 848 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
SYS_FORCE_INLINE GA_ListType< FromType, ToType, INT_TYPE >::GA_ListType ( GA_ListType< FromType, ToType, INT_TYPE > &&  src)
inline

Move constructor.

Definition at line 865 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
SYS_FORCE_INLINE GA_ListType< FromType, ToType, INT_TYPE >::GA_ListType ( const Base src)
inlineexplicit

Copy constructor from GA_ListTypeRef. Although it may seem strange to have this at all, it should be safe, since the destination does take (shared) ownership of any non-trivial data. There should be a GA_ListType somewhere else that already owns this.

Definition at line 885 of file GA_OffsetList.h.

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

Trivial list constructor.

Definition at line 903 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
GA_ListType< FromType, ToType, INT_TYPE >::GA_ListType ( const UT_Array< ToType > &  src,
FromType  start = FromType(0),
FromType  end = FromType(-1) 
)
template<typename FromType, typename ToType, typename INT_TYPE>
SYS_FORCE_INLINE GA_ListType< FromType, ToType, INT_TYPE >::~GA_ListType ( )
inline

Destructor.

Definition at line 912 of file GA_OffsetList.h.

Member Function Documentation

template<typename FromType, typename ToType, typename INT_TYPE>
FromType GA_ListType< FromType, ToType, INT_TYPE >::append ( ToType  value)
inline

Add a single entry (may grow array)

Definition at line 1087 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::append ( const GA_ListType< FromType, ToType, INT_TYPE > &  src)

Append all the entries from the source list. The offset will be added to each value in the source list.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::changeSize ( FromType  new_capacity)

If trivial, this sets the size to the minimum of the current size and new_capacity. If not trivial, this sets the capacity to new_capacity, (also correctly decreasing the size if currently greater than new_capacity.)

template<typename FromType, typename ToType, typename INT_TYPE>
SYS_FORCE_INLINE void GA_ListType< FromType, ToType, INT_TYPE >::clear ( )
inline

clear removes all of the entries

Definition at line 1015 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::computeTrivial ( )

Identifies whether the data is a trivial mapping and if so, eliminates storage for the map.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::constant ( ToType  value)

Set all entries to a constant value.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::copyAdd ( FromType  destindex,
const int values,
GA_Size  srcindex,
GA_Size  n,
ToType  offset 
)
inline

Definition at line 1193 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::copyAdd ( FromType  destindex,
const GA_ListTypeRef< FromType, ToType > &  values,
FromType  srcindex,
GA_Size  n,
ToType  offset 
)
inline

Definition at line 1212 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::countMemory ( UT_MemoryCounter counter,
bool  inclusive 
) const

Count memory usage using a UT_MemoryCounter in order to count shared memory correctly. If inclusive is true, the size of this object is counted, else only memory owned by this object is counted. If this is pointed to by the calling object, inclusive should be true. If this is contained in the calling object, inclusive should be false. (Its memory was already counted in the size of the calling object.)

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::cycle ( GA_Size  howMany)

Cyclically shift the entire array by howMany.

template<typename FromType, typename ToType, typename INT_TYPE>
FromType GA_ListType< FromType, ToType, INT_TYPE >::findAndRemove ( ToType  i)

Find an entry and remove it from the list.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::harden ( )
inline

Definition at line 1275 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::harden ( exint  mincapacity)
inline

Definition at line 1313 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::incDataRef ( )
inline

WARNING: PLEASE DO NOT CALL THIS UNLESS YOU KNOW WHAT YOU'RE DOING! IF YOU'RE UNSURE, YOU DON'T NEED TO CALL THIS! Only call this if it's necessary to copy a GA_ListType and share its ownership in some way that doesn't correctly update the ref count for non-trivial lists. (This was added for GA_PrimitiveList to represent a GA_OffsetList with a UT_FixedVector<int64,2>.)

Definition at line 1374 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
FromType GA_ListType< FromType, ToType, INT_TYPE >::insert ( FromType  i,
ToType  value 
)

Insert a single entry (may grow array)

template<typename FromType, typename ToType, typename INT_TYPE>
FromType GA_ListType< FromType, ToType, INT_TYPE >::multipleInsert ( FromType  i,
GA_Size  count 
)

Insert count entries at the given index (may grow array). The new entries will be uninitialized.

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

Copy assignment operator.

Definition at line 926 of file GA_OffsetList.h.

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

Move assignment operator.

Definition at line 951 of file GA_OffsetList.h.

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

Copy assignment operator from GA_ListTypeRef. Although it may seem strange to have this at all, it should be safe, since the destination does take (shared) ownership of any non-trivial data. There should be a GA_ListType somewhere else that already owns this.

Definition at line 980 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
FromType GA_ListType< FromType, ToType, INT_TYPE >::remove ( FromType  i)

Remove the entry at the given offset.

template<typename FromType, typename ToType, typename INT_TYPE>
GA_Size GA_ListType< FromType, ToType, INT_TYPE >::removeAll ( ToType  i)

Remove all matching entries from the list.

template<typename FromType, typename ToType, typename INT_TYPE>
FromType GA_ListType< FromType, ToType, INT_TYPE >::removeIndex ( FromType  i)
inline

Alias for remove to match UT array types.

Definition at line 1125 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::removeLast ( )
inline

Remove the last entry.

Definition at line 1129 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::reserve ( FromType  mincapacity)

Reserve capacity for a number of entries (prevents reallocation as elements are appended). This does nothing if the list is currently trivial.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::reverse ( )

Reverse the entire array.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::set ( FromType  index,
ToType  value 
)
inline

Set the index to the value.

Definition at line 1142 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
template<typename S >
void GA_ListType< FromType, ToType, INT_TYPE >::set ( const S data,
exint  size,
ToType  offset 
)
inline

Definition at line 1161 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::setEntries ( FromType  sz,
bool  doresize = true 
)

Set the number of entries - if the number is smaller than the current entries, the capacity may be decreased. If doresize is false, only the number of entries is changed, not the size.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< 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 1037 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< 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 1055 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::setTrivialRange ( FromType  startindex,
ToType  startvalue,
GA_Size  nelements 
)
inline

Definition at line 1234 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::sortAndRemoveDuplicates ( )

Sort entries into ascending order and remove duplicates.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::sortAscending ( )

Sort entries into ascending order.

Friends And Related Function Documentation

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

Definition at line 812 of file GA_OffsetList.h.

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

Definition at line 810 of file GA_OffsetList.h.


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