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

#include <indexedData.h>

+ Inheritance diagram for VdfIndexedData< T >:

Public Types

using DataType = T
 
typedef VdfIndexedDataIterator
< int
IndexIterator
 
typedef VdfIndexedDataIterator< TDataIterator
 
typedef std::pair
< IndexIterator, IndexIterator
IndexIteratorRange
 
typedef std::pair
< DataIterator, DataIterator
DataIteratorRange
 

Public Member Functions

void Add (int index, VdfByValueOrConstRef< T > data)
 
size_t GetSize () const
 
void Reserve (size_t size)
 
bool IsEmpty () const
 
int GetIndex (size_t i) const
 
VdfByValueOrConstRef< TGetData (size_t i) const
 
Toperator[] (size_t i)
 
size_t GetFirstDataIndex (size_t currentIndex) const
 
size_t GetFirstDataIndex (size_t currentIndex, size_t startIndex) const
 
size_t GetMemoryUsage () const
 
bool operator== (const VdfIndexedData &rhs) const
 
bool operator!= (const VdfIndexedData &rhs) const
 
IndexIteratorRange GetIndexIterators () const
 
DataIteratorRange GetDataIterators () const
 

Static Public Member Functions

static void Compose (VdfIndexedData *result, const VdfIndexedData &weak, const VdfIndexedData &strong)
 

Protected Member Functions

std::vector< int > & _GetWriteIndices ()
 
const std::vector< int > & _GetReadIndices () const
 
std::vector< T > & _GetWriteData ()
 
const std::vector< T > & _GetReadData () const
 

Static Protected Member Functions

static std::vector< int > & _GetWriteIndices (VdfIndexedData< T > *o)
 
static const std::vector< int > & _GetReadIndices (const VdfIndexedData< T > *o)
 
static std::vector< T > & _GetWriteData (VdfIndexedData< T > *o)
 
static const std::vector< T > & _GetReadData (const VdfIndexedData< T > *o)
 

Friends

template<class HashState >
void TfHashAppend (HashState &h, const VdfIndexedData &d)
 
void swap (VdfIndexedData &lhs, VdfIndexedData &rhs)
 

Detailed Description

template<typename T>
class VdfIndexedData< T >

Definition at line 30 of file indexedData.h.

Member Typedef Documentation

template<typename T>
typedef VdfIndexedDataIterator<T> VdfIndexedData< T >::DataIterator

Definition at line 174 of file indexedData.h.

template<typename T>
typedef std::pair<DataIterator, DataIterator> VdfIndexedData< T >::DataIteratorRange

Definition at line 181 of file indexedData.h.

template<typename T>
using VdfIndexedData< T >::DataType = T

The type of data held in the indexed data object.

Definition at line 35 of file indexedData.h.

template<typename T>
typedef VdfIndexedDataIterator<int> VdfIndexedData< T >::IndexIterator

The following types are const forward iterators which provide limited read access to the "index" and "data" member containers of this class.

Definition at line 173 of file indexedData.h.

template<typename T>
typedef std::pair<IndexIterator, IndexIterator> VdfIndexedData< T >::IndexIteratorRange

Definition at line 180 of file indexedData.h.

Member Function Documentation

template<typename T>
const std::vector<T>& VdfIndexedData< T >::_GetReadData ( ) const
inlineprotected

Definition at line 223 of file indexedData.h.

template<typename T>
static const std::vector<T>& VdfIndexedData< T >::_GetReadData ( const VdfIndexedData< T > *  o)
inlinestaticprotected

Definition at line 244 of file indexedData.h.

template<typename T>
const std::vector<int>& VdfIndexedData< T >::_GetReadIndices ( ) const
inlineprotected

Definition at line 213 of file indexedData.h.

template<typename T>
static const std::vector<int>& VdfIndexedData< T >::_GetReadIndices ( const VdfIndexedData< T > *  o)
inlinestaticprotected

Definition at line 234 of file indexedData.h.

template<typename T>
std::vector<T>& VdfIndexedData< T >::_GetWriteData ( )
inlineprotected

Definition at line 218 of file indexedData.h.

template<typename T>
static std::vector<T>& VdfIndexedData< T >::_GetWriteData ( VdfIndexedData< T > *  o)
inlinestaticprotected

Definition at line 239 of file indexedData.h.

template<typename T>
std::vector<int>& VdfIndexedData< T >::_GetWriteIndices ( )
inlineprotected

Definition at line 208 of file indexedData.h.

template<typename T>
static std::vector<int>& VdfIndexedData< T >::_GetWriteIndices ( VdfIndexedData< T > *  o)
inlinestaticprotected

Definition at line 229 of file indexedData.h.

template<typename T>
void VdfIndexedData< T >::Add ( int  index,
VdfByValueOrConstRef< T data 
)
inline

Adds a corresponding (index, data) pair to this object. The index values must be added in strictly increasing order.

Definition at line 40 of file indexedData.h.

template<typename T >
void VdfIndexedData< T >::Compose ( VdfIndexedData< T > *  result,
const VdfIndexedData< T > &  weak,
const VdfIndexedData< T > &  strong 
)
static

Composes indexedData with an over composition, strong over weak.

Indices are the union of weak and strong, strong wins if they both have data for the same index.

Result needs to be different than weak and strong, we're modifying result indexedData in place.

XXX:optimization Try to re-use result indexedData many times, onced it's been expanded in size this composition doesn't do any mallocs. The first time through there are mallocs due to push_backs

Definition at line 288 of file indexedData.h.

template<typename T>
VdfByValueOrConstRef<T> VdfIndexedData< T >::GetData ( size_t  i) const
inline

Returns the i'th data.

Definition at line 79 of file indexedData.h.

template<typename T>
DataIteratorRange VdfIndexedData< T >::GetDataIterators ( ) const
inline

Return a pair of STL-compliant forward input iterators that bracket the full range of the unspecified container holding the "data" values in this object. For read-only use by STL algorithms.

Note that the "data" values held by this object have no defined order.

Definition at line 201 of file indexedData.h.

template<typename T >
size_t VdfIndexedData< T >::GetFirstDataIndex ( size_t  currentIndex) const

Returns the first index that is greater than or equal to currentIndex.

Returns size (c.f., GetSize()) if no such index has been found.

Definition at line 279 of file indexedData.h.

template<typename T>
size_t VdfIndexedData< T >::GetFirstDataIndex ( size_t  currentIndex,
size_t  startIndex 
) const
inline

Returns the first index that is greater than or equal to currentIndex.

Performs a linear search starting at startIndex. Returns size

Definition at line 104 of file indexedData.h.

template<typename T>
int VdfIndexedData< T >::GetIndex ( size_t  i) const
inline

Returns the i'th index.

Definition at line 73 of file indexedData.h.

template<typename T>
IndexIteratorRange VdfIndexedData< T >::GetIndexIterators ( ) const
inline

Return a pair of STL-compliant forward input iterators that bracket the full range of the unspecified container holding the "index" values in this object. For read-only use by STL algorithms.

Note that the "index" values held by this object are guaranteed to be in sorted incrementing-value order.

Definition at line 190 of file indexedData.h.

template<typename T>
size_t VdfIndexedData< T >::GetMemoryUsage ( ) const
inline

Returns the amount of memory used by this data structure.

Definition at line 135 of file indexedData.h.

template<typename T>
size_t VdfIndexedData< T >::GetSize ( ) const
inline

Returns the number of indexed data.

Definition at line 53 of file indexedData.h.

template<typename T>
bool VdfIndexedData< T >::IsEmpty ( ) const
inline

Returns true if this structure is empty, and false otherwise.

Definition at line 67 of file indexedData.h.

template<typename T>
bool VdfIndexedData< T >::operator!= ( const VdfIndexedData< T > &  rhs) const
inline

Returns false if two objects are equal.

Definition at line 159 of file indexedData.h.

template<typename T>
bool VdfIndexedData< T >::operator== ( const VdfIndexedData< T > &  rhs) const
inline

Returns true, if two objects are equal.

Definition at line 152 of file indexedData.h.

template<typename T>
T& VdfIndexedData< T >::operator[] ( size_t  i)
inline

Returns a non-const reference to the i'th data.

Definition at line 85 of file indexedData.h.

template<typename T>
void VdfIndexedData< T >::Reserve ( size_t  size)
inline

Reserve a size for the arrays.

Reserving a non-zero size avoids repeated resizing.

Definition at line 60 of file indexedData.h.

Friends And Related Function Documentation

template<typename T>
void swap ( VdfIndexedData< T > &  lhs,
VdfIndexedData< T > &  rhs 
)
friend

Support for swapping two VdfIndexedData instances.

Definition at line 165 of file indexedData.h.

template<typename T>
template<class HashState >
void TfHashAppend ( HashState &  h,
const VdfIndexedData< T > &  d 
)
friend

Overload for TfHashAppend. This makes VdfIndexedData hashable by TfHash.

Definition at line 146 of file indexedData.h.


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