HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_PackedArrayOfArrays< T > Class Template Reference

#include <UT_PackedArrayOfArrays.h>

Public Types

typedef UT_Array< Tvalue_type
 

Public Member Functions

 UT_PackedArrayOfArrays ()
 
void clear ()
 
bool isEmpty () const
 
exint size () const
 Returns the number of arrays in this structure. More...
 
exint entries () const
 
int64 getMemoryUsage (bool inclusive=false) const
 
void append (const UT_Array< T > &arr)
 Adds a new array to the end of our list of arrays. More...
 
void append (const T *data, exint len)
 
void append (const UT_PackedArrayOfArrays< T > &arr, exint idx)
 
void concat (const UT_PackedArrayOfArrays< T > &arr)
 Appends an array of arrays to our list. More...
 
void concat (UT_PackedArrayOfArrays< T > &&arr)
 Moves an array of arrays to our list. More...
 
TappendArray (exint len)
 
template<typename TLD = void, typename FUNC >
TallocateArraysNoInit (exint n, FUNC &&countfunctor)
 
const Toperator() (exint idx, exint idx_in_array) const
 From the given idxth array, return the idx_in_array element. More...
 
void extract (UT_Array< T > &result, exint idx) const
 Extracts an array into a UT_Array. More...
 
TarrayData (exint idx)
 
const TarrayData (exint idx) const
 
exint arrayLen (exint idx) const
 
UT_Span< const Tspan (exint idx) const
 
void truncate (exint maxsize)
 Decreases, but never expands, to the given maxsize. More...
 
void setDataCapacity (exint capacity)
 
void setDataCapacityIfNeeded (exint capacity)
 
void setArrayCapacity (exint capacity)
 
void setArrayCapacityIfNeeded (exint capacity)
 
UT_Array< exint > & rawOffsets ()
 
const UT_Array< exint > & rawOffsets () const
 
UT_Array< T > & rawData ()
 All of the array data is in one contiguous block. More...
 
const UT_Array< T > & rawData () const
 
UT_IteratorRange< T * > arrayRange (exint idx)
 
UT_IteratorRange< const T * > arrayRange (exint idx) const
 

Detailed Description

template<typename T>
class UT_PackedArrayOfArrays< T >

Definition at line 26 of file UT_PackedArrayOfArrays.h.

Member Typedef Documentation

template<typename T>
typedef UT_Array<T> UT_PackedArrayOfArrays< T >::value_type

Definition at line 29 of file UT_PackedArrayOfArrays.h.

Constructor & Destructor Documentation

template<typename T>
UT_PackedArrayOfArrays< T >::UT_PackedArrayOfArrays ( )
inline

Definition at line 31 of file UT_PackedArrayOfArrays.h.

Member Function Documentation

template<typename T>
template<typename TLD = void, typename FUNC >
T* UT_PackedArrayOfArrays< T >::allocateArraysNoInit ( exint  n,
FUNC &&  countfunctor 
)
inline

Appends new arrays in parallel using a functor to compute element count per array.

The functor takes the form exint(exint) or optionally exint(exint, TLD&) where TLD is some thread-local data that can be reused by the functor.

Example:

data.allocateArraysNoInit( gdp->getNumPrimitives(), [&](exint i) { return gdp->getPrimitiveVertexCount(gdp->primitiveOffset(i)); });

Example with TLD:

data.allocateArraysNoInit<GA_OffsetArray>( gdp->getNumPoints(), [&](exint i, GA_OffsetArray &offsets) { gdp->getPrimitivesReferencingPoint(offsets, gdp->pointOffset(i)); return offsets.size(); });

Definition at line 135 of file UT_PackedArrayOfArrays.h.

template<typename T>
void UT_PackedArrayOfArrays< T >::append ( const UT_Array< T > &  arr)
inline

Adds a new array to the end of our list of arrays.

Definition at line 52 of file UT_PackedArrayOfArrays.h.

template<typename T>
void UT_PackedArrayOfArrays< T >::append ( const T data,
exint  len 
)
inline

Definition at line 54 of file UT_PackedArrayOfArrays.h.

template<typename T>
void UT_PackedArrayOfArrays< T >::append ( const UT_PackedArrayOfArrays< T > &  arr,
exint  idx 
)
inline

Definition at line 63 of file UT_PackedArrayOfArrays.h.

template<typename T>
T* UT_PackedArrayOfArrays< T >::appendArray ( exint  len)
inline

Appends a new array and returns a pointer to the resulting data so it can be filled in.

Definition at line 98 of file UT_PackedArrayOfArrays.h.

template<typename T>
T* UT_PackedArrayOfArrays< T >::arrayData ( exint  idx)
inline

Definition at line 188 of file UT_PackedArrayOfArrays.h.

template<typename T>
const T* UT_PackedArrayOfArrays< T >::arrayData ( exint  idx) const
inline

Definition at line 196 of file UT_PackedArrayOfArrays.h.

template<typename T>
exint UT_PackedArrayOfArrays< T >::arrayLen ( exint  idx) const
inline

Definition at line 201 of file UT_PackedArrayOfArrays.h.

template<typename T>
UT_IteratorRange<T *> UT_PackedArrayOfArrays< T >::arrayRange ( exint  idx)
inline

Returns an iterator range for the specified array.

Definition at line 212 of file UT_PackedArrayOfArrays.h.

template<typename T>
UT_IteratorRange<const T *> UT_PackedArrayOfArrays< T >::arrayRange ( exint  idx) const
inline

Returns an iterator range for the specified array.

Definition at line 214 of file UT_PackedArrayOfArrays.h.

template<typename T>
void UT_PackedArrayOfArrays< T >::clear ( )
inline

Definition at line 35 of file UT_PackedArrayOfArrays.h.

template<typename T>
void UT_PackedArrayOfArrays< T >::concat ( const UT_PackedArrayOfArrays< T > &  arr)
inline

Appends an array of arrays to our list.

Definition at line 67 of file UT_PackedArrayOfArrays.h.

template<typename T>
void UT_PackedArrayOfArrays< T >::concat ( UT_PackedArrayOfArrays< T > &&  arr)
inline

Moves an array of arrays to our list.

Definition at line 76 of file UT_PackedArrayOfArrays.h.

template<typename T>
exint UT_PackedArrayOfArrays< T >::entries ( ) const
inline

Definition at line 42 of file UT_PackedArrayOfArrays.h.

template<typename T>
void UT_PackedArrayOfArrays< T >::extract ( UT_Array< T > &  result,
exint  idx 
) const
inline

Extracts an array into a UT_Array.

Definition at line 178 of file UT_PackedArrayOfArrays.h.

template<typename T>
int64 UT_PackedArrayOfArrays< T >::getMemoryUsage ( bool  inclusive = false) const
inline

Definition at line 44 of file UT_PackedArrayOfArrays.h.

template<typename T>
bool UT_PackedArrayOfArrays< T >::isEmpty ( ) const
inline

Definition at line 37 of file UT_PackedArrayOfArrays.h.

template<typename T>
const T& UT_PackedArrayOfArrays< T >::operator() ( exint  idx,
exint  idx_in_array 
) const
inline

From the given idxth array, return the idx_in_array element.

Definition at line 169 of file UT_PackedArrayOfArrays.h.

template<typename T>
UT_Array<T>& UT_PackedArrayOfArrays< T >::rawData ( )
inline

All of the array data is in one contiguous block.

Definition at line 252 of file UT_PackedArrayOfArrays.h.

template<typename T>
const UT_Array<T>& UT_PackedArrayOfArrays< T >::rawData ( ) const
inline

Definition at line 253 of file UT_PackedArrayOfArrays.h.

template<typename T>
UT_Array<exint>& UT_PackedArrayOfArrays< T >::rawOffsets ( )
inline

The raw offset table stores the end of each array in the data array. Each array has [rawOffsets(idx) ... rawOffsets(idx+1))

Definition at line 248 of file UT_PackedArrayOfArrays.h.

template<typename T>
const UT_Array<exint>& UT_PackedArrayOfArrays< T >::rawOffsets ( ) const
inline

Definition at line 249 of file UT_PackedArrayOfArrays.h.

template<typename T>
void UT_PackedArrayOfArrays< T >::setArrayCapacity ( exint  capacity)
inline

Definition at line 240 of file UT_PackedArrayOfArrays.h.

template<typename T>
void UT_PackedArrayOfArrays< T >::setArrayCapacityIfNeeded ( exint  capacity)
inline

Definition at line 242 of file UT_PackedArrayOfArrays.h.

template<typename T>
void UT_PackedArrayOfArrays< T >::setDataCapacity ( exint  capacity)
inline

These adjust the capacity without adjusting the entries and are useful for pre-allocing the amount when known in advance.

Definition at line 236 of file UT_PackedArrayOfArrays.h.

template<typename T>
void UT_PackedArrayOfArrays< T >::setDataCapacityIfNeeded ( exint  capacity)
inline

Definition at line 238 of file UT_PackedArrayOfArrays.h.

template<typename T>
exint UT_PackedArrayOfArrays< T >::size ( void  ) const
inline

Returns the number of arrays in this structure.

Definition at line 41 of file UT_PackedArrayOfArrays.h.

template<typename T>
UT_Span<const T> UT_PackedArrayOfArrays< T >::span ( exint  idx) const
inline

Definition at line 205 of file UT_PackedArrayOfArrays.h.

template<typename T>
void UT_PackedArrayOfArrays< T >::truncate ( exint  maxsize)
inline

Decreases, but never expands, to the given maxsize.

Definition at line 219 of file UT_PackedArrayOfArrays.h.


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