HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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
 
using iterator = base_iterator< this_type >
 
using const_iterator = base_iterator< const this_type >
 

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) noexcept
 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) noexcept
 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_ListTypeRef< FromType, ToType, INT_TYPE > &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 how_many)
 Cyclically shift the entire array by how_many. 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)=default
 Copy constructor. More...
 
SYS_FORCE_INLINE GA_ListTypeRef (GA_ListTypeRef &&src) noexcept=default
 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 ()=default
 Destructor. More...
 
SYS_FORCE_INLINE GA_ListTypeRefoperator= (const GA_ListTypeRef &src)=default
 Copy assignment operator. More...
 
SYS_FORCE_INLINE GA_ListTypeRefoperator= (GA_ListTypeRef &&src) noexcept=default
 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
 Synonym for isClosed() More...
 
SYS_FORCE_INLINE bool isClosed () const
 Synonym for getExtraFlag() More...
 
SYS_FORCE_INLINE void setExtraFlag (bool v)
 Synonym for setClosed(bool) More...
 
SYS_FORCE_INLINE void setClosed (bool v)
 Synonym for setExtraFlag(bool) More...
 
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...
 
SYS_FORCE_INLINE ToType operator[] (FromType i) const
 
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
 
template<typename FUNCTOR >
SYS_FORCE_INLINE void forEachReverse (FUNCTOR &&functor) const
 Like forEach() except iterates in reverse order. More...
 
SYS_FORCE_INLINE int64 getMemoryUsage (bool inclusive) const
 Report memory usage (includes all shared memory) More...
 
SYS_FORCE_INLINE const INT_TYPE * getArray () const
 
SYS_FORCE_INLINE INT_TYPE * getArray ()
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 

Protected Types

using ListTypeData = typename Base::ListTypeData
 
- Protected Types inherited from GA_ListTypeRef< FromType, ToType, INT_TYPE >
using this_type = GA_ListTypeRef< FromType, ToType, INT_TYPE >
 

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 1002 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 1012 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 1023 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)
inlinenoexcept

Move constructor.

Definition at line 1040 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 1060 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 1078 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 1087 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 1262 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE>
void GA_ListType< FromType, ToType, INT_TYPE >::append ( const GA_ListTypeRef< 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 1190 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 1374 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 1393 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  how_many)

Cyclically shift the entire array by how_many.

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 1456 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 1498 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 1563 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 1101 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)
inlinenoexcept

Move assignment operator.

Definition at line 1126 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 1155 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 1300 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 1304 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 1319 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 1340 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 1212 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 1230 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 1415 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 987 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 985 of file GA_OffsetList.h.


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