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) 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 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 925 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 924 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 476 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)
defaultnoexcept

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 524 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 929 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 931 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 616 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 582 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 930 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 932 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 622 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 722 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 734 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 763 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 749 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 782 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 >::forEachReverse ( FUNCTOR &&  functor) const
inline

Like forEach() except iterates in reverse order.

Definition at line 807 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 680 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 943 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 948 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

Synonym for isClosed()

Definition at line 642 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 937 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>
SYS_FORCE_INLINE bool GA_ListTypeRef< FromType, ToType, INT_TYPE >::isClosed ( ) const
inline

Synonym for getExtraFlag()

Definition at line 645 of file GA_OffsetList.h.

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

Returns true iff this and that are either both trivial and equal or if both are not trivial and share the same ListTypeData pointer. This does not fully check for equality!

Definition at line 656 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 638 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 705 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 715 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)
defaultnoexcept

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

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

Synonym for setExtraFlag(bool)

Definition at line 651 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

Synonym for setClosed(bool)

Definition at line 648 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 594 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 605 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 626 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 692 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 956 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 961 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 973 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 966 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 974 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 967 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 954 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 955 of file GA_OffsetList.h.


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