7 #ifndef PXR_EXEC_VDF_VECTOR_IMPL_COMPRESSED_H
8 #define PXR_EXEC_VDF_VECTOR_IMPL_COMPRESSED_H
21 #include "pxr/base/tf/mallocTag.h"
32 template<
typename TYPE>
37 !Vdf_IsBoxedContainer<TYPE>,
38 "Only Vdf_VectorImplBoxed may hold boxed values");
47 _Initialize(data, bits);
55 _Initialize(NULL, bits);
62 _data(sourceData._data),
63 _logicalSize(sourceData._logicalSize),
64 _compressedIndexMapping(sourceData._compressedIndexMapping)
66 sourceData._data = NULL;
67 sourceData._logicalSize = 0;
68 sourceData._compressedIndexMapping = NULL;
76 if (_compressedIndexMapping)
77 delete _compressedIndexMapping;
107 _Initialize(data, mask.
GetBits());
126 if (_compressedIndexMapping->_blockMappings.size() > 0) {
127 return _compressedIndexMapping->_blockMappings.back().dataEndIndex;
138 _compressedIndexMapping->GetFirstIndex(),
139 _compressedIndexMapping->GetLastIndex(),
140 _compressedIndexMapping);
171 template<
typename TYPE>
174 _logicalSize(rhs._logicalSize),
176 *rhs._compressedIndexMapping))
181 _data =
new TYPE[numUsed];
193 template<
typename TYPE>
211 size_t srcBlockHint = 0;
212 size_t destBlockHint = 0;
214 View platforms = bits.GetPlatformsView();
215 for (View::const_iterator it=platforms.begin(), e=platforms.end(); it != e;
218 const size_t index = *it;
219 const size_t srcDataIdx =
220 _compressedIndexMapping->FindDataIndex(index, &srcBlockHint);
221 const size_t destDataIdx = destImpl->
222 _compressedIndexMapping->FindDataIndex(index, &destBlockHint);
224 destImpl->_data + destDataIdx, _data + srcDataIdx,
225 it.GetPlatformSize());
230 template<
typename TYPE>
236 TF_VERIFY(bits.
GetFirstSet() >= _compressedIndexMapping->GetFirstIndex());
237 TF_VERIFY(bits.
GetLastSet() <= _compressedIndexMapping->GetLastIndex());
242 size_t blockHint = 0;
244 const size_t dataIdx =
245 _compressedIndexMapping->FindDataIndex(idx, &blockHint);
246 v[i++] = _data[dataIdx];
253 template<
typename TYPE>
265 info.
data,
"destData is not a Vdf_VectorImplDense.")) {
271 size_t srcBlockHint = 0;
272 TYPE *typedDest =
static_cast<TYPE*
>(info.
data);
277 for (View::const_iterator it=platforms.begin(), e=platforms.end(); it != e;
280 const size_t index = *it;
281 const size_t srcDataIdx =
282 _compressedIndexMapping->FindDataIndex(index, &srcBlockHint);
284 typedDest + index - info.
first, _data + srcDataIdx,
285 it.GetPlatformSize());
290 template<
typename TYPE>
298 const size_t newStorageSize = bits.
GetNumSet();
301 if (newStorageSize == 0) {
311 _compressedIndexMapping->Initialize(bits);
317 size_t destDataIdx = 0;
320 for (View::const_iterator it=platforms.begin(), e=platforms.end();
323 const size_t platformSize = it.GetPlatformSize();
325 _data + destDataIdx, srcData + *it, platformSize);
326 destDataIdx += platformSize;
336 #if !defined(ARCH_OS_WINDOWS)
337 #define VDF_DECLARE_EXTERN_VECTOR_IMPL_COMPRESSED(type) \
338 extern template class VDF_API_TYPE Vdf_VectorImplCompressed<type>;
340 #undef VDF_DECLARE_EXTERN_VECTOR_IMPL_COMPRESSED
341 #endif // !defined(ARCH_OS_WINDOWS)
void CloneSubset(const VdfMask &mask, Vdf_VectorData::DataHolder *destData) const override
#define VDF_DECLARE_EXTERN_VECTOR_IMPL_COMPRESSED(type)
virtual size_t GetNumStoredElements() const =0
#define PXR_NAMESPACE_OPEN_SCOPE
Vdf_CompressedIndexMapping * compressedIndexMapping
AllSetView GetAllSetView() const
#define VDF_FOR_EACH_COMMON_TYPE(macro)
VDF_FOR_EACH_COMMON_TYPE expands macro for each common type.
void Assign(const TYPE *data, const VdfMask &mask)
void Box(const VdfMask::Bits &bits, Vdf_VectorData::DataHolder *destData) const override
A VdfMask is placed on connections to specify the data flowing through them.
static void Copy(T *dest, const T *source, size_t size)
VdfMask::Bits const & GetBits() const
Fast, compressed bit array which is capable of performing logical operations without first decompress...
Vdf_VectorImplCompressed(Vdf_VectorImplCompressed &&sourceData)
#define TF_DEV_AXIOM(cond)
Vdf_VectorImplCompressed(const TYPE *data, const VdfMask::Bits &bits)
Construct storage for the elements of data indicated by bits.
void Clone(Vdf_VectorData::DataHolder *destData) const override
void MoveInto(Vdf_VectorData::DataHolder *destData) override
Vdf_VectorData::Info GetInfo() override
#define __ARCH_PRETTY_FUNCTION__
void Merge(const VdfMask::Bits &bits, Vdf_VectorData::DataHolder *destData) const override
Vdf_VectorImplCompressed(const VdfMask::Bits &bits)
Construct enough storage to hold as many elements as bits has set.
Implements a Vdf_VectorData storage that holds a boxed element.
virtual void CloneSubset(const VdfMask &mask, DataHolder *destData) const =0
PlatformsView GetPlatformsView() const
~Vdf_VectorImplCompressed() override
size_t GetLastSet() const
Base const * Get() const
Returns a Base pointer to the held instance.
size_t GetSize() const override
#define PXR_NAMESPACE_CLOSE_SCOPE
virtual void Box(const VdfMask::Bits &bits, DataHolder *destData) const =0
size_t GetNumStoredElements() const override
size_t GetFirstSet() const
View< Mode::Platforms > PlatformsView
virtual void Merge(const VdfMask::Bits &bits, DataHolder *destData) const =0
Implements a Vdf_VectorData storage that is holds a subset of a vector. The subset is determined by a...