HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VdfVector Class Reference

#include <vector.h>

+ Inheritance diagram for VdfVector:

Classes

class  DebugPrintable
 
class  ReadAccessor
 
class  ReadWriteAccessor
 

Public Types

enum  ConstructBoxedCopyTag { ConstructBoxedCopy }
 

Public Member Functions

 VdfVector (const VdfVector &rhs)
 
 VdfVector (const VdfVector &rhs, const VdfMask &mask)
 
 VdfVector (const VdfVector &rhs, const VdfMask &mask, ConstructBoxedCopyTag)
 
 VdfVector (const VdfVector &rhs, size_t size)
 
 VdfVector (VdfVector &&rhs)
 
 ~VdfVector ()
 
size_t GetSize () const
 
bool IsEmpty () const
 
size_t GetNumStoredElements () const
 
template<typename TYPE >
void Set (TYPE &&data)
 
template<typename TYPE >
void Set (const Vdf_BoxedContainer< TYPE > &data)
 
template<typename TYPE >
void Set (Vdf_BoxedContainer< TYPE > &data)
 
template<typename TYPE >
void Set (const Vdf_BoxedContainer< TYPE > &&data)
 
template<typename TYPE >
void Set (Vdf_BoxedContainer< TYPE > &&data)
 
template<typename TYPE >
void Resize (size_t size)
 
template<typename TYPE >
void Resize (const VdfMask::Bits &bits)
 
VDF_API void Clear ()
 
void Copy (const VdfVector &rhs, const VdfMask &mask)
 
VDF_API void Merge (const VdfVector &rhs, const VdfMask::Bits &bits)
 
void Merge (const VdfVector &rhs, const VdfMask &mask)
 
bool Share () const
 
bool IsShared () const
 
bool IsSharable () const
 
template<typename T >
VtArray< TExtractAsVtArray (const size_t size, const int offset) const
 
template<typename TYPE >
ReadWriteAccessor< TYPE > GetReadWriteAccessor () const
 
template<typename TYPE >
ReadAccessor< TYPE > GetReadAccessor () const
 
template<typename TYPE >
Vdf_VectorSubrangeAccessor< TYPE > GetSubrangeAccessor () const
 
template<typename TYPE >
bool Holds () const
 
VdfVectoroperator= (const VdfVector &rhs)
 
VdfVectoroperator= (VdfVector &&rhs)
 
size_t EstimateElementMemory () const
 
DebugPrintable GetDebugPrintable (const VdfMask &mask) const
 

Protected Member Functions

 VdfVector ()
 

Protected Attributes

Vdf_VectorData::DataHolder _data
 

Detailed Description

This class is used to abstract away knowledge of the cache data used for each node.

Note that data can be put into a VdfVector only atomically, no incremental adding of elements is possible.

Note that Vdf requires the availability of the default and copy constructor for the given template parameter TYPE. Additional Vdf provides default fallback values via the VdfExecutionTypeRegistry. That is to give types the ability to have empty default constructors (for speed) but at the same time have well definied values to use in case we need to provide a "default".

Definition at line 55 of file vector.h.

Member Enumeration Documentation

Copy constructor with boxing.

Enumerator
ConstructBoxedCopy 

Definition at line 90 of file vector.h.

Constructor & Destructor Documentation

VdfVector::VdfVector ( const VdfVector rhs)
inline

Copy constructor.

Definition at line 61 of file vector.h.

VdfVector::VdfVector ( const VdfVector rhs,
const VdfMask mask 
)
inline

Copy constructor with subset copying.

Definition at line 71 of file vector.h.

VdfVector::VdfVector ( const VdfVector rhs,
const VdfMask mask,
ConstructBoxedCopyTag   
)
inline

Definition at line 94 of file vector.h.

VdfVector::VdfVector ( const VdfVector rhs,
size_t  size 
)
inline

Construct a vector with the same element type as rhs and of size size. All elements in this new vector are default constructed.

Definition at line 116 of file vector.h.

VdfVector::VdfVector ( VdfVector &&  rhs)
inline

Move constructor.

Definition at line 131 of file vector.h.

VdfVector::~VdfVector ( )
inline

Destructor.

Definition at line 139 of file vector.h.

VdfVector::VdfVector ( )
inlineprotected

Definition at line 647 of file vector.h.

Member Function Documentation

VDF_API void VdfVector::Clear ( )

Destroys contents of this vector.

Resets the vector to have zero size but maintains the held type.

void VdfVector::Copy ( const VdfVector rhs,
const VdfMask mask 
)
inline

Copies the contents of rhs into this vector.

rhs and this vector must be type compatible.

Use this instead of operator= when you want to take advantage of only copying the elements set in mask from the rhs vector.

Definition at line 281 of file vector.h.

size_t VdfVector::EstimateElementMemory ( ) const
inline

Returns the number of bytes necessary to store a single element of this VdfVector.

Note that this method estimates the allocated memory, which may not be accurate if the held data is not a value type, or has fields that are not value types.

Definition at line 592 of file vector.h.

template<typename T >
VtArray<T> VdfVector::ExtractAsVtArray ( const size_t  size,
const int  offset 
) const
inline

Extracts this vector's values into a VtArray<T>.

If the data has been shared previously, no copying occurs. Otherwise, the data is copied into a new VtArray.

Definition at line 377 of file vector.h.

DebugPrintable VdfVector::GetDebugPrintable ( const VdfMask mask) const
inline

Returns an ostream-able object, which can be used to debug print the contents of this VdfVector, filtered by mask.

Definition at line 634 of file vector.h.

size_t VdfVector::GetNumStoredElements ( ) const
inline

Returns the number of elements for which this vector has storage.

Definition at line 154 of file vector.h.

template<typename TYPE >
ReadAccessor<TYPE> VdfVector::GetReadAccessor ( ) const
inline

GetReadAccessor() allows low level read-only access to the content of of the VdfVector via the Vdf_VectorData base class. In order to get the handle to that, this method will do the correct type checking for you.

Definition at line 521 of file vector.h.

template<typename TYPE >
ReadWriteAccessor<TYPE> VdfVector::GetReadWriteAccessor ( ) const
inline

GetReadWriteAccessor() allows low level access to the content of the VdfVector via the Vdf_VectorData base class. In order to get the handle to that this method will do the correct type checking for you.

Definition at line 456 of file vector.h.

size_t VdfVector::GetSize ( ) const
inline

Returns the number of elements held in this vector.

Definition at line 146 of file vector.h.

template<typename TYPE >
Vdf_VectorSubrangeAccessor<TYPE> VdfVector::GetSubrangeAccessor ( ) const
inline

Provide read-only access to the boxed subranges held by this vector.

While this is a public method, only VdfSubrangeView can make use of the returned Vdf_VectorSubrangeAccessor.

Definition at line 532 of file vector.h.

template<typename TYPE >
bool VdfVector::Holds ( ) const
inline

Checks if a vector holds a specific type.

Definition at line 541 of file vector.h.

bool VdfVector::IsEmpty ( ) const
inline

Returns whether or not this vector is empty.

Definition at line 150 of file vector.h.

bool VdfVector::IsSharable ( ) const
inline

Returns true if the vector can be shared.

Definition at line 365 of file vector.h.

bool VdfVector::IsShared ( ) const
inline

Returns true if the vector has been shared.

Note: Only used in tests currently.

Definition at line 357 of file vector.h.

VDF_API void VdfVector::Merge ( const VdfVector rhs,
const VdfMask::Bits bits 
)

Merges the contents of rhs into this vector. The elements copied from rhs are determined by the mask.

rhs and this vector must be type compatible. Also note, that this vector (the destination vector), must NOT be a compressed vector.

void VdfVector::Merge ( const VdfVector rhs,
const VdfMask mask 
)
inline

Same as Merge(), but takes a VdfMask instead of a bitset.

Definition at line 323 of file vector.h.

VdfVector& VdfVector::operator= ( const VdfVector rhs)
inline

Copies the content of rhs into this vector. This is an expensive operation if rhs has not been shared.

This method does runtime type checking to ensure that both vectors have compatible types.

Definition at line 556 of file vector.h.

VdfVector& VdfVector::operator= ( VdfVector &&  rhs)
inline

Moves the content of rhs into this vector.

This method does runtime type checking to ensure that both vectors have compatible types.

Definition at line 573 of file vector.h.

template<typename TYPE >
void VdfVector::Resize ( size_t  size)
inline

Allocates space for size number of elements.

The vector will be initialized with the default ctor. Note that if this doesn't do anything meaningful (cf. Gf types), memory will be left uninitialized.

Definition at line 218 of file vector.h.

template<typename TYPE >
void VdfVector::Resize ( const VdfMask::Bits bits)
inline

Allocates space for the elements denoted by bits.

The vector will be initialized with the default ctor. Note that if this doesn't do anything meaningful (cf. Gf types), memory will be left uninitialized.

Definition at line 244 of file vector.h.

template<typename TYPE >
void VdfVector::Set ( TYPE &&  data)
inline

Forwards data into the vector.

Definition at line 162 of file vector.h.

template<typename TYPE >
void VdfVector::Set ( const Vdf_BoxedContainer< TYPE > &  data)
inline

Copy boxed values into the vector.

Definition at line 177 of file vector.h.

template<typename TYPE >
void VdfVector::Set ( Vdf_BoxedContainer< TYPE > &  data)
inline

Definition at line 189 of file vector.h.

template<typename TYPE >
void VdfVector::Set ( const Vdf_BoxedContainer< TYPE > &&  data)
inline

Definition at line 195 of file vector.h.

template<typename TYPE >
void VdfVector::Set ( Vdf_BoxedContainer< TYPE > &&  data)
inline

Move boxed values into the vector.

Definition at line 204 of file vector.h.

bool VdfVector::Share ( ) const
inline

Embeds the current vector's existing implementaion into a reference counted implementaion so that the data can be shared without copying. Mutating the contents of the data holder once shared will cause detachment. Returns true if the sharing was successful.

Note: This method is not thread safe.

Definition at line 334 of file vector.h.

Member Data Documentation

Vdf_VectorData::DataHolder VdfVector::_data
mutableprotected

Definition at line 727 of file vector.h.


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