HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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  base_iterator
 
class  ListTypeData
 

Public Types

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_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)=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)=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
 
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...
 
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
 
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 this_type = GA_ListTypeRef< FromType, ToType, INT_TYPE >
 

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>
using GA_ListTypeRef< FromType, ToType, INT_TYPE >::const_iterator = base_iterator<const this_type>

Definition at line 881 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
using GA_ListTypeRef< FromType, ToType, INT_TYPE >::iterator = base_iterator<this_type>

Definition at line 880 of file GA_OffsetList.h.

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.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
using GA_ListTypeRef< FromType, ToType, INT_TYPE >::this_type = GA_ListTypeRef<FromType, ToType, INT_TYPE>
protected

Definition at line 60 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 466 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)
default

Copy constructor.

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)
default

Move constructor.

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 514 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 ( )
default

Destructor.

Member Function Documentation

template<typename FromType, typename ToType, typename INT_TYPE = exint>
iterator GA_ListTypeRef< FromType, ToType, INT_TYPE >::begin ( void  )
inline
Note
It's likely more efficient to use forEach() than iterators

Definition at line 885 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
const_iterator GA_ListTypeRef< FromType, ToType, INT_TYPE >::begin ( void  ) const
inline
Note
It's likely more efficient to use forEach() than iterators

Definition at line 887 of file GA_OffsetList.h.

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 606 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 572 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
iterator GA_ListTypeRef< FromType, ToType, INT_TYPE >::end ( void  )
inline
Note
It's likely more efficient to use forEach() than iterators

Definition at line 886 of file GA_OffsetList.h.

template<typename FromType, typename ToType, typename INT_TYPE = exint>
const_iterator GA_ListTypeRef< FromType, ToType, INT_TYPE >::end ( void  ) const
inline
Note
It's likely more efficient to use forEach() than iterators

Definition at line 888 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 612 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 699 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 711 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 740 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 726 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 759 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 661 of file GA_OffsetList.h.

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

Definition at line 899 of file GA_OffsetList.h.

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

Definition at line 904 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 630 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 893 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 637 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 628 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 682 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 692 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)
default

Copy assignment operator.

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)
default

Move assignment operator.

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

Definition at line 695 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 632 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 584 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 595 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 616 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 671 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 912 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 917 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 929 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 922 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 930 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 923 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 910 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 911 of file GA_OffsetList.h.


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