7#ifndef PXR_EXEC_VDF_VECTOR_ACCESSOR_H
8#define PXR_EXEC_VDF_VECTOR_ACCESSOR_H
12#include "pxr/exec/vdf/boxedContainer.h"
13#include "pxr/exec/vdf/compressedIndexMapping.h"
14#include "pxr/exec/vdf/vectorData.h"
21PXR_NAMESPACE_OPEN_SCOPE
31 !Vdf_IsBoxedContainer<T>,
32 "Vdf_VectorAccessor does not provide access to boxed containers");
45 const Vdf_VectorData::Info &info)
48 const std::type_info &haveType = data->GetTypeInfo();
52 "Invalid type. Vector is holding %s, tried to use as %s",
58 _indexMapping =
nullptr;
59 if (ARCH_UNLIKELY(info.compressedIndexMapping)) {
60 _numValues = info.size;
61 _data = (T *)info.data;
62 _indexMapping = info.compressedIndexMapping;
63 _indexMappingHint = 0;
68 _numValues = info.size;
69 _data = (T *)info.data - info.first;
76 !info.compressedIndexMapping &&
77 info.size == 1 && info.first == 0 && info.last == 0);
80 BoxedVectorType *boxedVector = (BoxedVectorType *)info.
data;
81 _numValues = boxedVector->size();
82 _data = boxedVector->data();
88 bool IsEmpty()
const {
return _numValues == 0; }
102 if (ARCH_UNLIKELY(_indexMapping)) {
103 idx = _indexMapping->FindDataIndex(idx, &_indexMappingHint);
112 mutable size_t _indexMappingHint;
117PXR_NAMESPACE_CLOSE_SCOPE
Low-level utilities for informing users of various internal and external diagnostic conditions.
This simple container stores multiple values that flow through the network as a single data flow elem...
const T * data() const
Returns a pointer to the immutable data elements.
This collection of IndexBlockMappings is all the info required to take a logical index into a compres...
Vdf_VectorAccessor()
Default constructor.
bool IsBoxed() const
Returns true if this accessor is providing element-wise access into a boxed container.
T & operator[](size_t idx) const
Returns a reference to an element.
bool IsEmpty() const
Returns true if vector is empty.
Vdf_VectorAccessor(Vdf_VectorData *data, const Vdf_VectorData::Info &info)
Constructor.
size_t GetNumValues() const
Returns size of the vector, ie.
Abstract base class for storing data in a VdfVector.
Demangle C++ typenames generated by the typeid() facility.
std::string ArchGetDemangled()
Return demangled RTTI generated-type name.
#define TF_DEV_AXIOM(cond)
The same as TF_AXIOM, but compiled only in dev builds.
#define TF_FATAL_ERROR(fmt, args)
Issue a fatal error and end the program.
Safely compare C++ RTTI type structures.
bool TfSafeTypeCompare(const std::type_info &t1, const std::type_info &t2)
Safely compare std::type_info structures.