10#ifndef OPENVDB_POINTS_ATTRIBUTE_ARRAY_HAS_BEEN_INCLUDED
11#define OPENVDB_POINTS_ATTRIBUTE_ARRAY_HAS_BEEN_INCLUDED
23#include <tbb/spin_mutex.h>
32class TestAttributeArray;
48template <
typename IntegerT,
typename FloatT>
59template <
typename FloatT,
typename IntegerT>
67template <
typename IntegerVectorT,
typename FloatT>
71 return IntegerVectorT(
72 floatingPointToFixedPoint<typename IntegerVectorT::ValueType>(v.
x()),
73 floatingPointToFixedPoint<typename IntegerVectorT::ValueType>(v.
y()),
74 floatingPointToFixedPoint<typename IntegerVectorT::ValueType>(v.
z()));
77template <
typename FloatVectorT,
typename IntegerT>
82 fixedPointToFloatingPoint<typename FloatVectorT::ValueType>(v.
x()),
83 fixedPointToFloatingPoint<typename FloatVectorT::ValueType>(v.
y()),
84 fixedPointToFloatingPoint<typename FloatVectorT::ValueType>(v.
z()));
96 template <
typename T>
struct Accessor;
104 CONSTANTSTRIDE = 0x8,
112 WRITEMEMCOMPRESS = 0x4,
120 tbb::spin_mutex::scoped_lock lock;
125 using Ptr = std::shared_ptr<AttributeArray>;
126 using ConstPtr = std::shared_ptr<const AttributeArray>;
137 if (mFlags & PARTIALREAD) mCompressedBytes = 0;
197#if OPENVDB_ABI_VERSION_NUMBER >= 10
209 bool constantStride =
true,
221 template<
typename AttributeArrayType>
222 bool isType()
const {
return this->type() == AttributeArrayType::attributeType(); }
225 template<
typename ValueType>
226 bool hasValueType()
const {
return this->type().first == typeNameAsString<ValueType>(); }
258 template<
typename IterT>
259 void copyValuesUnsafe(
const AttributeArray& sourceArray,
const IterT& iter);
263 template<
typename IterT>
264 void copyValues(
const AttributeArray& sourceArray,
const IterT& iter,
bool compact =
true);
270 virtual void expand(
bool fill =
true) = 0;
293 bool isHidden()
const {
return bool(mFlags & HIDDEN); }
314 uint8_t
flags()
const {
return mFlags; }
317 virtual void read(std::istream&) = 0;
320 virtual void write(std::ostream&,
bool outputTransient)
const = 0;
322 virtual void write(std::ostream&)
const = 0;
329 virtual void writeMetadata(std::ostream&,
bool outputTransient,
bool paged)
const = 0;
335 virtual void writeBuffers(std::ostream&,
bool outputTransient)
const = 0;
355#if OPENVDB_ABI_VERSION_NUMBER >= 9
361 friend class ::TestAttributeArray;
368 virtual char* dataAsByteArray() = 0;
369 virtual const char* dataAsByteArray()
const = 0;
372 template <
typename IterT>
373 void doCopyValues(
const AttributeArray& sourceArray,
const IterT& iter,
374 bool rangeChecking =
true);
392 bool mIsUniform =
true;
395 uint8_t mUsePagedRead = 0;
421 mGetter(getter), mSetter(setter), mCollapser(collapser), mFiller(filler) { }
433namespace attribute_traits
465 template <
typename T>
468 template<
typename ValueType>
static void decode(
const ValueType&, ValueType&);
469 template<
typename ValueType>
static void encode(
const ValueType&, ValueType&);
470 static const char*
name() {
return "null"; }
476 template <
typename T>
479 template<
typename StorageType,
typename ValueType>
static void decode(
const StorageType&, ValueType&);
480 template<
typename StorageType,
typename ValueType>
static void encode(
const ValueType&, StorageType&);
481 static const char*
name() {
return "trnc"; }
488 static const char*
name() {
return "fxpt"; }
489 template <
typename ValueType>
static ValueType
encode(
const ValueType&
value) {
return value + ValueType(0.5); }
490 template <
typename ValueType>
static ValueType
decode(
const ValueType&
value) {
return value - ValueType(0.5); }
497 static const char*
name() {
return "ufxpt"; }
498 template <
typename ValueType>
static ValueType
encode(
const ValueType&
value) {
return value; }
499 template <
typename ValueType>
static ValueType
decode(
const ValueType&
value) {
return value; }
503template <
bool OneByte,
typename Range=PositionRange>
506 template <
typename T>
509 template<
typename StorageType,
typename ValueType>
static void decode(
const StorageType&, ValueType&);
510 template<
typename StorageType,
typename ValueType>
static void encode(
const ValueType&, StorageType&);
513 static const std::string
Name = std::string(Range::name()) + (OneByte ?
"8" :
"16");
523 template <
typename T>
528 static const char*
name() {
return "uvec"; }
537template<
typename ValueType_,
typename Codec_ = NullCodec>
541 using Ptr = std::shared_ptr<TypedAttributeArray>;
542 using ConstPtr = std::shared_ptr<const TypedAttributeArray>;
546 using StorageType =
typename Codec::template Storage<ValueType>::Type;
552 const ValueType& uniformValue = zeroVal<ValueType>());
585 static Ptr create(
Index n,
Index strideOrTotalSize = 1,
bool constantStride = true,
586 const
Metadata* metadata =
nullptr);
595 static const
NamePair& attributeType();
597 const
NamePair& type()
const override {
return attributeType(); }
600 static bool isRegistered();
602 static void registerType();
604 static void unregisterType();
611 Index stride()
const override {
return hasConstantStride() ? mStrideOrTotalSize : 0; }
615 return hasConstantStride() ? mSize * mStrideOrTotalSize : mStrideOrTotalSize;
632 bool valueTypeIsFloatingPoint()
const override;
635 bool valueTypeIsClass()
const override;
638 bool valueTypeIsVector()
const override;
641 bool valueTypeIsQuaternion()
const override;
644 bool valueTypeIsMatrix()
const override;
649#if OPENVDB_ABI_VERSION_NUMBER >= 10
658 ValueType getUnsafe(
Index n)
const;
660 ValueType get(
Index n)
const;
662 template<
typename T>
void getUnsafe(
Index n, T&
value)
const;
664 template<
typename T>
void get(
Index n, T&
value)
const;
671 void setUnsafe(
Index n,
const ValueType&
value);
675 template<
typename T>
void setUnsafe(
Index n,
const T&
value);
677 template<
typename T>
void set(
Index n,
const T&
value);
688 bool isUniform()
const override {
return mIsUniform; }
692 void expand(
bool fill =
true)
override;
694 void collapse()
override;
696 bool compact()
override;
699 void collapse(
const ValueType& uniformValue);
702 void fill(
const ValueType&
value);
711 bool compress() override;
714 bool decompress() override;
717 void read(
std::istream&) override;
721 void write(
std::ostream& os,
bool outputTransient) const override;
723 void write(
std::ostream&) const override;
726 void readMetadata(
std::istream&) override;
731 void writeMetadata(
std::ostream& os,
bool outputTransient,
bool paged) const override;
734 void readBuffers(
std::istream&) override;
738 void writeBuffers(
std::ostream& os,
bool outputTransient) const override;
741 void readPagedBuffers(compression::PagedInputStream&) override;
745 void writePagedBuffers(compression::PagedOutputStream& os,
bool outputTransient) const override;
748 inline
bool isOutOfCore() const;
751 void loadData() const override;
754 bool isDataLoaded() const override;
756#if OPENVDB_ABI_VERSION_NUMBER >= 9
762 AccessorBasePtr getAccessor()
const override;
769 inline bool validData()
const {
return !(isOutOfCore() || (flags() & PARTIALREAD)); }
772 friend class ::TestAttributeArray;
777 inline void doLoad()
const;
780 inline void doLoadUnsafe(
const bool compression =
true)
const;
782 inline bool compressUnsafe();
785 inline void setOutOfCore(
const bool);
791 char* dataAsByteArray()
override;
792 const char* dataAsByteArray()
const override;
794 size_t arrayMemUsage()
const;
801 return TypedAttributeArray::create(n, strideOrTotalSize, constantStride, metadata);
804 static std::unique_ptr<const NamePair> sTypeName;
805 std::unique_ptr<StorageType[]> mData;
807 Index mStrideOrTotalSize;
816template <
typename ValueType,
typename CodecType = UnknownCodec>
821 using Ptr = std::shared_ptr<Handle>;
860 friend class ::TestAttributeArray;
862 template <
bool IsUnknownCodec>
863 typename std::enable_if<IsUnknownCodec, bool>::type compatibleType()
const;
865 template <
bool IsUnknownCodec>
866 typename std::enable_if<!IsUnknownCodec, bool>::type compatibleType()
const;
868 template <
bool IsUnknownCodec>
869 typename std::enable_if<IsUnknownCodec, ValueType>::type get(
Index index)
const;
871 template <
bool IsUnknownCodec>
872 typename std::enable_if<!IsUnknownCodec, ValueType>::type get(
Index index)
const;
877 Index mStrideOrTotalSize;
879 bool mCollapseOnDestruction;
887template <
typename ValueType,
typename CodecType = UnknownCodec>
892 using Ptr = std::shared_ptr<Handle>;
922 friend class ::TestAttributeArray;
924 template <
bool IsUnknownCodec>
925 typename std::enable_if<IsUnknownCodec, void>::type set(
Index index,
const ValueType&
value)
const;
927 template <
bool IsUnknownCodec>
928 typename std::enable_if<!IsUnknownCodec, void>::type set(
Index index,
const ValueType&
value)
const;
938template<
typename ValueType>
940NullCodec::decode(
const ValueType& data, ValueType& val)
946template<
typename ValueType>
948NullCodec::encode(
const ValueType& val, ValueType& data)
954template<
typename StorageType,
typename ValueType>
956TruncateCodec::decode(
const StorageType& data, ValueType& val)
958 val =
static_cast<ValueType
>(data);
962template<
typename StorageType,
typename ValueType>
964TruncateCodec::encode(
const ValueType& val, StorageType& data)
966 data =
static_cast<StorageType
>(val);
970template <
bool OneByte,
typename Range>
971template<
typename StorageType,
typename ValueType>
975 val = fixedPointToFloatingPoint<ValueType>(data);
979 val = Range::template decode<ValueType>(val);
983template <
bool OneByte,
typename Range>
984template<
typename StorageType,
typename ValueType>
990 const ValueType newVal = Range::template encode<ValueType>(val);
992 data = floatingPointToFixedPoint<StorageType>(newVal);
1000 val = math::QuantizedUnitVec::unpack(data);
1008 data = math::QuantizedUnitVec::pack(val);
1016template <
typename IterT>
1017void AttributeArray::doCopyValues(
const AttributeArray& sourceArray,
const IterT& iter,
1023 assert(sourceArray.
isDataLoaded() && this->isDataLoaded());
1025 assert(this->storageTypeSize()*this->stride() ==
1029 const char*
const sourceBuffer = sourceArray.dataAsByteArray();
1030 char*
const targetBuffer = this->dataAsByteArray();
1031 assert(sourceBuffer && targetBuffer);
1033 if (rangeChecking && this->isUniform()) {
1037 const bool sourceIsUniform = sourceArray.
isUniform();
1039 const Index sourceDataSize = rangeChecking ? sourceArray.
dataSize() : 0;
1040 const Index targetDataSize = rangeChecking ? this->dataSize() : 0;
1042 for (IterT it(iter); it; ++it) {
1043 const Index sourceIndex = sourceIsUniform ? 0 : it.sourceIndex();
1044 const Index targetIndex = it.targetIndex();
1046 if (rangeChecking) {
1047 if (sourceIndex >= sourceDataSize) {
1049 "Cannot copy array data as source index exceeds size of source array.");
1051 if (targetIndex >= targetDataSize) {
1053 "Cannot copy array data as target index exceeds size of target array.");
1057 assert(sourceIndex < sourceArray.
dataSize());
1058 assert(targetIndex < this->dataSize());
1059 if (this->isUniform()) assert(targetIndex ==
Index(0));
1062 const size_t targetOffset(targetIndex * bytes);
1063 const size_t sourceOffset(sourceIndex * bytes);
1065 std::memcpy(targetBuffer + targetOffset, sourceBuffer + sourceOffset, bytes);
1069template <
typename IterT>
1070void AttributeArray::copyValuesUnsafe(
const AttributeArray& sourceArray,
const IterT& iter)
1072 this->doCopyValues(sourceArray, iter,
false);
1075template <
typename IterT>
1080 if (bytes != this->storageTypeSize()) {
1097 this->doCopyValues(sourceArray, iter,
true);
1110template<
typename ValueType_,
typename Codec_>
1114template<
typename ValueType_,
typename Codec_>
1120 , mStrideOrTotalSize(strideOrTotalSize)
1122 if (constantStride) {
1124 if (strideOrTotalSize == 0) {
1126 "stride to be at least one.")
1131 if (mStrideOrTotalSize < n) {
1133 "a total size of at least the number of elements in the array.")
1137 mStrideOrTotalSize =
std::max(
Index(1), mStrideOrTotalSize);
1138 Codec::encode(uniformValue, this->
data()[0]);
1142template<
typename ValueType_,
typename Codec_>
1149template<
typename ValueType_,
typename Codec_>
1151 const tbb::spin_mutex::scoped_lock& lock)
1154 , mStrideOrTotalSize(rhs.mStrideOrTotalSize)
1158 std::memcpy(
static_cast<void*
>(this->
data()), rhs.
data(), this->arrayMemUsage());
1163template<
typename ValueType_,
typename Codec_>
1164TypedAttributeArray<ValueType_, Codec_>&
1169 tbb::spin_mutex::scoped_lock lock(mMutex);
1170 tbb::spin_mutex::scoped_lock rhsLock(rhs.
mMutex);
1177 mStrideOrTotalSize = rhs.mStrideOrTotalSize;
1180 if (this->validData()) {
1182 std::memcpy(
static_cast<void*
>(this->data()), rhs.
data(), this->arrayMemUsage());
1190template<
typename ValueType_,
typename Codec_>
1194 static std::once_flag once;
1195 std::call_once(once, []()
1197 sTypeName.reset(
new NamePair(typeNameAsString<ValueType>(), Codec::name()));
1203template<
typename ValueType_,
typename Codec_>
1211template<
typename ValueType_,
typename Codec_>
1219template<
typename ValueType_,
typename Codec_>
1227template<
typename ValueType_,
typename Codec_>
1236 typedMetadata ? typedMetadata->
value() : zeroVal<ValueType>()));
1239template<
typename ValueType_,
typename Codec_>
1249template<
typename ValueType_,
typename Codec_>
1259template<
typename ValueType_,
typename Codec_>
1267template<
typename ValueType_,
typename Codec_>
1271 return this->copy();
1275template<
typename ValueType_,
typename Codec_>
1279 if (this->isOutOfCore())
return 0;
1281 return (mIsUniform ? 1 : this->dataSize()) *
sizeof(StorageType);
1285template<
typename ValueType_,
typename Codec_>
1287TypedAttributeArray<ValueType_, Codec_>::allocate()
1291 mData.reset(
new StorageType[1]);
1294 const size_t size(this->dataSize());
1296 mData.reset(
new StorageType[size]);
1301template<
typename ValueType_,
typename Codec_>
1303TypedAttributeArray<ValueType_, Codec_>::deallocate()
1306 if (this->isOutOfCore()) {
1307 this->setOutOfCore(
false);
1308 this->mPageHandle.reset();
1310 if (mData) mData.reset();
1314template<
typename ValueType_,
typename Codec_>
1334template<
typename ValueType_,
typename Codec_>
1343template<
typename ValueType_,
typename Codec_>
1351template<
typename ValueType_,
typename Codec_>
1356 return !this->valueType().compare(0, 4,
"quat");
1360template<
typename ValueType_,
typename Codec_>
1365 return !this->valueType().compare(0, 3,
"mat");
1369template<
typename ValueType_,
typename Codec_>
1373 return sizeof(*this) + (bool(mData) ? this->arrayMemUsage() : 0);
1376#if OPENVDB_ABI_VERSION_NUMBER >= 10
1377template<
typename ValueType_,
typename Codec_>
1381 return sizeof(*this) + (mIsUniform ? 1 : this->dataSize()) *
sizeof(StorageType);
1386template<
typename ValueType_,
typename Codec_>
1390 assert(n < this->dataSize());
1393 Codec::decode(this->data()[mIsUniform ? 0 : n], val);
1398template<
typename ValueType_,
typename Codec_>
1403 if (this->isOutOfCore()) this->doLoad();
1405 return this->getUnsafe(n);
1409template<
typename ValueType_,
typename Codec_>
1414 val =
static_cast<T
>(this->getUnsafe(n));
1418template<
typename ValueType_,
typename Codec_>
1423 val =
static_cast<T
>(this->get(n));
1427template<
typename ValueType_,
typename Codec_>
1435template<
typename ValueType_,
typename Codec_>
1439 assert(n < this->dataSize());
1440 assert(!this->isOutOfCore());
1441 assert(!this->isUniform());
1446 Codec::encode(val, this->data()[mIsUniform ? 0 : n]);
1450template<
typename ValueType_,
typename Codec_>
1455 if (this->isOutOfCore()) this->doLoad();
1456 if (this->isUniform()) this->expand();
1458 this->setUnsafe(n, val);
1462template<
typename ValueType_,
typename Codec_>
1467 this->setUnsafe(n,
static_cast<ValueType>(val));
1471template<
typename ValueType_,
typename Codec_>
1476 this->set(n,
static_cast<ValueType>(val));
1480template<
typename ValueType_,
typename Codec_>
1488template<
typename ValueType_,
typename Codec_>
1495 sourceTypedArray.
get(sourceIndex, sourceValue);
1497 this->set(n, sourceValue);
1501template<
typename ValueType_,
typename Codec_>
1505 if (!mIsUniform)
return;
1510 tbb::spin_mutex::scoped_lock lock(mMutex);
1517 for (
Index i = 0; i < this->dataSize(); ++i) this->data()[i] = val;
1522template<
typename ValueType_,
typename Codec_>
1526 if (mIsUniform)
return true;
1529 const ValueType_ val = this->get(0);
1530 for (
Index i = 1; i < this->dataSize(); i++) {
1534 this->collapse(this->get(0));
1539template<
typename ValueType_,
typename Codec_>
1543 this->collapse(zeroVal<ValueType>());
1547template<
typename ValueType_,
typename Codec_>
1552 tbb::spin_mutex::scoped_lock lock(mMutex);
1557 Codec::encode(uniformValue, this->data()[0]);
1561template<
typename ValueType_,
typename Codec_>
1569template<
typename ValueType_,
typename Codec_>
1573 if (this->isOutOfCore()) {
1574 tbb::spin_mutex::scoped_lock lock(mMutex);
1579 const Index size = mIsUniform ? 1 : this->dataSize();
1580 for (
Index i = 0; i < size; ++i) {
1581 Codec::encode(
value, this->data()[i]);
1586template<
typename ValueType_,
typename Codec_>
1594template<
typename ValueType_,
typename Codec_>
1602template<
typename ValueType_,
typename Codec_>
1610template<
typename ValueType_,
typename Codec_>
1618template<
typename ValueType_,
typename Codec_>
1626template<
typename ValueType_,
typename Codec_>
1634template<
typename ValueType_,
typename Codec_>
1636TypedAttributeArray<ValueType_, Codec_>::doLoad()
const
1638 if (!(this->isOutOfCore()))
return;
1640 TypedAttributeArray<ValueType_, Codec_>* self =
1641 const_cast<TypedAttributeArray<ValueType_, Codec_>*
>(
this);
1645 tbb::spin_mutex::scoped_lock lock(self->mMutex);
1646 this->doLoadUnsafe();
1650template<
typename ValueType_,
typename Codec_>
1658template<
typename ValueType_,
typename Codec_>
1662 return !this->isOutOfCore();
1666template<
typename ValueType_,
typename Codec_>
1670 this->readMetadata(is);
1671 this->readBuffers(is);
1675template<
typename ValueType_,
typename Codec_>
1682 is.read(
reinterpret_cast<char*
>(&bytes),
sizeof(
Index64));
1683 bytes = bytes -
sizeof(
Int16) -
sizeof(
Index);
1685 uint8_t flags = uint8_t(0);
1686 is.read(
reinterpret_cast<char*
>(&flags),
sizeof(uint8_t));
1689 uint8_t serializationFlags = uint8_t(0);
1690 is.read(
reinterpret_cast<char*
>(&serializationFlags),
sizeof(uint8_t));
1693 is.read(
reinterpret_cast<char*
>(&size),
sizeof(
Index));
1697 if (mFlags >= 0x20) {
1702 if (serializationFlags >= 0x10) {
1708 mIsUniform = serializationFlags & WRITEUNIFORM;
1709 mUsePagedRead = serializationFlags & WRITEPAGED;
1710 mCompressedBytes = bytes;
1711 mFlags |= PARTIALREAD;
1715 if (serializationFlags & WRITESTRIDED) {
1717 is.read(
reinterpret_cast<char*
>(&stride),
sizeof(
Index));
1718 mStrideOrTotalSize = stride;
1721 mStrideOrTotalSize = 1;
1726template<
typename ValueType_,
typename Codec_>
1730 if (mUsePagedRead) {
1735 tbb::spin_mutex::scoped_lock lock(mMutex);
1739 uint8_t bloscCompressed(0);
1740 if (!mIsUniform) is.read(
reinterpret_cast<char*
>(&bloscCompressed),
sizeof(uint8_t));
1742 assert(mFlags & PARTIALREAD);
1743 std::unique_ptr<char[]> buffer(
new char[mCompressedBytes]);
1744 is.read(buffer.get(), mCompressedBytes);
1745 mCompressedBytes = 0;
1746 mFlags =
static_cast<uint8_t
>(mFlags & ~PARTIALREAD);
1750 if (bloscCompressed == uint8_t(1)) {
1754 const size_t inBytes = this->dataSize() *
sizeof(
StorageType);
1756 if (newBuffer) buffer.reset(newBuffer.release());
1761 mData.reset(
reinterpret_cast<StorageType*
>(buffer.release()));
1765template<
typename ValueType_,
typename Codec_>
1769 if (!mUsePagedRead) {
1777 const bool delayLoad = (mappedFile.get() !=
nullptr);
1781 size_t compressedBytes(mCompressedBytes);
1782 mCompressedBytes = 0;
1783 mFlags =
static_cast<uint8_t
>(mFlags & ~PARTIALREAD);
1784 assert(!mPageHandle);
1789 assert(mPageHandle);
1791 tbb::spin_mutex::scoped_lock lock(mMutex);
1795 this->setOutOfCore(delayLoad);
1796 is.
read(mPageHandle, std::streamsize(mPageHandle->size()), delayLoad);
1799 std::unique_ptr<char[]> buffer = mPageHandle->read();
1800 mData.reset(
reinterpret_cast<StorageType*
>(buffer.release()));
1801 mPageHandle.reset();
1810template<
typename ValueType_,
typename Codec_>
1814 this->
write(os,
false);
1818template<
typename ValueType_,
typename Codec_>
1822 this->writeMetadata(os, outputTransient,
false);
1823 this->writeBuffers(os, outputTransient);
1827template<
typename ValueType_,
typename Codec_>
1831 if (!outputTransient && this->isTransient())
return;
1833 if (mFlags & PARTIALREAD) {
1837 uint8_t flags(mFlags);
1838 uint8_t serializationFlags(0);
1840 Index stride(mStrideOrTotalSize);
1841 bool strideOfOne(this->stride() == 1);
1846 if (bloscCompression) this->doLoad();
1848 size_t compressedBytes = 0;
1852 serializationFlags |= WRITESTRIDED;
1857 serializationFlags |= WRITEUNIFORM;
1858 if (bloscCompression && paged) serializationFlags |= WRITEPAGED;
1860 else if (bloscCompression)
1862 if (paged) serializationFlags |= WRITEPAGED;
1864 const char* charBuffer =
reinterpret_cast<const char*
>(this->data());
1865 const size_t inBytes = this->arrayMemUsage();
1872 bytes += (compressedBytes > 0) ? compressedBytes : this->arrayMemUsage();
1876 os.write(
reinterpret_cast<const char*
>(&bytes),
sizeof(
Index64));
1877 os.write(
reinterpret_cast<const char*
>(&flags),
sizeof(uint8_t));
1878 os.write(
reinterpret_cast<const char*
>(&serializationFlags),
sizeof(uint8_t));
1879 os.write(
reinterpret_cast<const char*
>(&size),
sizeof(
Index));
1882 if (!strideOfOne) os.write(
reinterpret_cast<const char*
>(&stride),
sizeof(
Index));
1886template<
typename ValueType_,
typename Codec_>
1890 if (!outputTransient && this->isTransient())
return;
1892 if (mFlags & PARTIALREAD) {
1898 if (this->isUniform()) {
1899 os.write(
reinterpret_cast<const char*
>(this->data()),
sizeof(
StorageType));
1903 std::unique_ptr<char[]> compressedBuffer;
1904 size_t compressedBytes = 0;
1905 const char* charBuffer =
reinterpret_cast<const char*
>(this->data());
1906 const size_t inBytes = this->arrayMemUsage();
1908 if (compressedBuffer) {
1909 uint8_t bloscCompressed(1);
1910 os.write(
reinterpret_cast<const char*
>(&bloscCompressed),
sizeof(uint8_t));
1911 os.write(
reinterpret_cast<const char*
>(compressedBuffer.get()), compressedBytes);
1914 uint8_t bloscCompressed(0);
1915 os.write(
reinterpret_cast<const char*
>(&bloscCompressed),
sizeof(uint8_t));
1916 os.write(
reinterpret_cast<const char*
>(this->data()), inBytes);
1921 uint8_t bloscCompressed(0);
1922 os.write(
reinterpret_cast<const char*
>(&bloscCompressed),
sizeof(uint8_t));
1923 os.write(
reinterpret_cast<const char*
>(this->data()), this->arrayMemUsage());
1928template<
typename ValueType_,
typename Codec_>
1932 if (!outputTransient && this->isTransient())
return;
1936 if (!bloscCompression) {
1941 if (mFlags & PARTIALREAD) {
1947 os.
write(
reinterpret_cast<const char*
>(this->data()), this->arrayMemUsage());
1951template<
typename ValueType_,
typename Codec_>
1955 if (!(this->isOutOfCore()))
return;
1961 assert(self->mPageHandle);
1962 assert(!(self->mFlags & PARTIALREAD));
1964 std::unique_ptr<char[]> buffer = self->mPageHandle->read();
1966 self->mData.reset(
reinterpret_cast<StorageType*
>(buffer.release()));
1968 self->mPageHandle.reset();
1972 self->mOutOfCore =
false;
1976template<
typename ValueType_,
typename Codec_>
1991template<
typename ValueType_,
typename Codec_>
1996 if(!otherT)
return false;
1997 if(this->mSize != otherT->mSize ||
1998 this->mStrideOrTotalSize != otherT->mStrideOrTotalSize ||
2000 this->attributeType() != this->attributeType())
return false;
2005 const StorageType *target = this->data(), *source = otherT->
data();
2006 if (!target && !source)
return true;
2007 if (!target || !source)
return false;
2008 Index n = this->mIsUniform ? 1 : mSize;
2014template<
typename ValueType_,
typename Codec_>
2016TypedAttributeArray<ValueType_, Codec_>::dataAsByteArray()
2018 return reinterpret_cast<char*
>(this->data());
2022template<
typename ValueType_,
typename Codec_>
2024TypedAttributeArray<ValueType_, Codec_>::dataAsByteArray()
const
2026 return reinterpret_cast<const char*
>(this->data());
2034template <
typename CodecType,
typename ValueType>
2055template <
typename ValueType>
2063 return (*functor)(array, n);
2068 (*functor)(array, n,
value);
2077template <
typename ValueType,
typename CodecType>
2085template <
typename ValueType,
typename CodecType>
2088 , mStrideOrTotalSize(array.hasConstantStride() ? array.stride() : 1)
2089 , mSize(array.hasConstantStride() ? array.size() : array.dataSize())
2090 , mCollapseOnDestruction(collapseOnDestruction && array.isStreaming())
2113template <
typename ValueType,
typename CodecType>
2117 if (mCollapseOnDestruction)
const_cast<AttributeArray*
>(this->mArray)->collapse();
2120template <
typename ValueType,
typename CodecType>
2121template <
bool IsUnknownCodec>
2122typename std::enable_if<IsUnknownCodec, bool>::type
2127 return mArray->hasValueType<ValueType>();
2130template <
typename ValueType,
typename CodecType>
2131template <
bool IsUnknownCodec>
2132typename std::enable_if<!IsUnknownCodec, bool>::type
2133AttributeHandle<ValueType, CodecType>::compatibleType()
const
2137 return mArray->isType<TypedAttributeArray<ValueType, CodecType>>();
2140template <
typename ValueType,
typename CodecType>
2147template <
typename ValueType,
typename CodecType>
2150 Index index = n * mStrideOrTotalSize + m;
2151 assert(index < (mSize * mStrideOrTotalSize));
2155template <
typename ValueType,
typename CodecType>
2161template <
typename ValueType,
typename CodecType>
2162template <
bool IsUnknownCodec>
2163typename std::enable_if<IsUnknownCodec, ValueType>::type
2168 return (*mGetter)(mArray, index);
2171template <
typename ValueType,
typename CodecType>
2172template <
bool IsUnknownCodec>
2173typename std::enable_if<!IsUnknownCodec, ValueType>::type
2181template <
typename ValueType,
typename CodecType>
2184 return mArray->isUniform();
2187template <
typename ValueType,
typename CodecType>
2190 return mArray->hasConstantStride();
2197template <
typename ValueType,
typename CodecType>
2205template <
typename ValueType,
typename CodecType>
2212template <
typename ValueType,
typename CodecType>
2218template <
typename ValueType,
typename CodecType>
2224template <
typename ValueType,
typename CodecType>
2230template <
typename ValueType,
typename CodecType>
2236template <
typename ValueType,
typename CodecType>
2242template <
typename ValueType,
typename CodecType>
2245 this->mCollapser(
const_cast<AttributeArray*
>(this->mArray), uniformValue);
2248template <
typename ValueType,
typename CodecType>
2254template <
typename ValueType,
typename CodecType>
2255template <
bool IsUnknownCodec>
2256typename std::enable_if<IsUnknownCodec, void>::type
2264template <
typename ValueType,
typename CodecType>
2265template <
bool IsUnknownCodec>
2266typename std::enable_if<!IsUnknownCodec, void>::type
2274template <
typename ValueType,
typename CodecType>
2277 assert(this->mArray);
ValueT value
Definition: GridBuilder.h:1287
Convenience wrappers to using Blosc and reading and writing of Paged data.
Definition: Exceptions.h:57
Definition: Exceptions.h:58
Definition: Exceptions.h:64
Definition: Exceptions.h:65
std::unique_ptr< PageHandle > Ptr
Definition: StreamCompression.h:170
A Paging wrapper to std::istream that is responsible for reading from a given input stream and creati...
Definition: StreamCompression.h:205
PageHandle::Ptr createHandle(std::streamsize n)
Creates a PageHandle to access the next.
bool sizeOnly() const
Definition: StreamCompression.h:215
void read(PageHandle::Ptr &pageHandle, std::streamsize n, bool delayed=true)
Takes a pageHandle and updates the referenced page with the current stream pointer position and if de...
std::istream & getInputStream()
Definition: StreamCompression.h:218
A Paging wrapper to std::ostream that is responsible for writing from a given output stream at interv...
Definition: StreamCompression.h:242
std::ostream & getOutputStream()
Set and get the output stream.
Definition: StreamCompression.h:255
bool sizeOnly() const
Definition: StreamCompression.h:252
PagedOutputStream & write(const char *str, std::streamsize n)
Writes the given.
SharedPtr< MappedFile > Ptr
Definition: io.h:136
T & x()
Reference to the component, e.g. v.x() = 4.5f;.
Definition: Vec3.h:89
T & y()
Definition: Vec3.h:90
T & z()
Definition: Vec3.h:91
Definition: AttributeArray.h:119
Base class for storing attribute data.
Definition: AttributeArray.h:93
virtual Name valueType() const =0
Return the name of the value type of a single element in this array (e.g., "float" or "vec3d").
const char * constDataAsByteArray() const
Indirect virtual function to retrieve the data buffer cast to a char byte array.
Definition: AttributeArray.h:357
AttributeArray(const AttributeArray &rhs, const tbb::spin_mutex::scoped_lock &)
void setConstantStride(bool state)
Specify whether this attribute has a constant stride or not.
static Ptr create(const NamePair &type, Index length, Index stride=1, bool constantStride=true, const Metadata *metadata=nullptr, const ScopedRegistryLock *lock=nullptr)
bool isTransient() const
Return true if this attribute is not serialized during stream output.
Definition: AttributeArray.h:300
SerializationFlag
Definition: AttributeArray.h:109
AttributeArray & operator=(const AttributeArray &rhs)
virtual Index dataSize() const =0
virtual bool isUniform() const =0
Return true if this array is stored as a single uniform value.
virtual void readBuffers(std::istream &)=0
Read attribute buffers from a stream.
std::shared_ptr< AttributeArray > Ptr
Definition: AttributeArray.h:125
virtual void set(const Index n, const AttributeArray &sourceArray, const Index sourceIndex)=0
Set value at given index n from sourceIndex of another sourceArray.
virtual ~AttributeArray()
Definition: AttributeArray.h:133
compression::PageHandle::Ptr mPageHandle
Definition: AttributeArray.h:399
Flag
Definition: AttributeArray.h:101
AttributeArray()
Definition: AttributeArray.h:132
virtual Index stride() const =0
bool isHidden() const
Return true if this attribute is hidden (e.g., from UI or iterators).
Definition: AttributeArray.h:293
bool isType() const
Return true if this attribute is of the same type as the template parameter.
Definition: AttributeArray.h:222
virtual bool valueTypeIsQuaternion() const =0
Return true if the value type is a quaternion.
virtual bool valueTypeIsVector() const =0
Return true if the value type is a vector.
virtual bool compress()=0
uint8_t mFlags
Definition: AttributeArray.h:394
virtual AccessorBasePtr getAccessor() const =0
Obtain an Accessor that stores getter and setter functors.
void setStreaming(bool state)
Specify whether this attribute is to be streamed off disk, in which case, the attributes are collapse...
AttributeArray(const AttributeArray &rhs)
virtual bool isDataLoaded() const =0
Return true if all data has been loaded.
uint8_t flags() const
Retrieve the attribute array flags.
Definition: AttributeArray.h:314
bool hasValueType() const
Return true if this attribute has a value type the same as the template parameter.
Definition: AttributeArray.h:226
std::atomic< Index32 > mOutOfCore
Definition: AttributeArray.h:396
virtual void writeBuffers(std::ostream &, bool outputTransient) const =0
static void clearRegistry(const ScopedRegistryLock *lock=nullptr)
Clear the attribute type registry.
std::shared_ptr< AccessorBase > AccessorBasePtr
Definition: AttributeArray.h:98
virtual Index size() const =0
void setTransient(bool state)
Specify whether this attribute should only exist in memory and not be serialized during stream output...
virtual bool decompress()=0
virtual void read(std::istream &)=0
Read attribute metadata and buffers from a stream.
void setHidden(bool state)
Specify whether this attribute should be hidden (e.g., from UI or iterators).
virtual void write(std::ostream &, bool outputTransient) const =0
virtual bool compact()=0
Compact the existing array to become uniform if all values are identical.
virtual AttributeArray::Ptr copyUncompressed() const =0
Return a copy of this attribute.
virtual void readPagedBuffers(compression::PagedInputStream &)=0
Read attribute buffers from a paged stream.
virtual bool valueTypeIsClass() const =0
Return true if the value type is a class (ie vector, matrix or quaternion return true)
virtual void loadData() const =0
Ensures all data is in-core.
uint8_t mUsePagedRead
Definition: AttributeArray.h:395
virtual bool valueTypeIsMatrix() const =0
Return true if the value type is a matrix.
bool operator==(const AttributeArray &other) const
tbb::spin_mutex mMutex
Definition: AttributeArray.h:393
bool operator!=(const AttributeArray &other) const
Definition: AttributeArray.h:353
bool isStreaming() const
Return true if this attribute is in streaming mode.
Definition: AttributeArray.h:308
virtual void writeMetadata(std::ostream &, bool outputTransient, bool paged) const =0
AttributeArray & operator=(AttributeArray &&)=delete
static bool isRegistered(const NamePair &type, const ScopedRegistryLock *lock=nullptr)
Return true if the given attribute type name is registered.
Ptr(*)(Index, Index, bool, const Metadata *) FactoryMethod
Definition: AttributeArray.h:128
virtual Name codecType() const =0
Return the name of the codec used by this array (e.g., "trnc" or "fxpt").
virtual void readMetadata(std::istream &)=0
Read attribute metadata from a stream.
std::shared_ptr< const AttributeArray > ConstPtr
Definition: AttributeArray.h:126
virtual void collapse()=0
Replace the existing array with a uniform zero value.
virtual void writePagedBuffers(compression::PagedOutputStream &, bool outputTransient) const =0
virtual Index storageTypeSize() const =0
virtual void write(std::ostream &) const =0
Write attribute metadata and buffers to a stream, don't write transient attributes.
static void registerType(const NamePair &type, FactoryMethod, const ScopedRegistryLock *lock=nullptr)
Register a attribute type along with a factory function.
virtual AttributeArray::Ptr copy() const =0
Return a copy of this attribute.
virtual Index valueTypeSize() const =0
virtual bool valueTypeIsFloatingPoint() const =0
Return true if the value type is floating point.
static void unregisterType(const NamePair &type, const ScopedRegistryLock *lock=nullptr)
Remove a attribute type from the registry.
bool hasConstantStride() const
Return true if this attribute has a constant stride.
Definition: AttributeArray.h:311
virtual const NamePair & type() const =0
Return the name of this attribute's type.
size_t mCompressedBytes
Definition: AttributeArray.h:400
bool mIsUniform
Definition: AttributeArray.h:392
virtual void expand(bool fill=true)=0
If this array is uniform, replace it with an array of length size().
virtual size_t memUsage() const =0
Return the number of bytes of memory used by this attribute.
AttributeArray(AttributeArray &&)=delete
Definition: AttributeArray.h:818
virtual ~AttributeHandle()
Definition: AttributeArray.h:2114
Index size() const
Definition: AttributeArray.h:840
void(*)(AttributeArray *array, const ValueType &value) ValuePtr
Definition: AttributeArray.h:827
SetterPtr mSetter
Definition: AttributeArray.h:855
Index stride() const
Definition: AttributeArray.h:839
std::shared_ptr< Handle > Ptr
Definition: AttributeArray.h:821
GetterPtr mGetter
Definition: AttributeArray.h:854
void(*)(AttributeArray *array, const Index n, const ValueType &value) SetterPtr
Definition: AttributeArray.h:826
static Ptr create(const AttributeArray &array, const bool collapseOnDestruction=true)
Definition: AttributeArray.h:2079
AttributeHandle(const AttributeArray &array, const bool collapseOnDestruction=true)
Definition: AttributeArray.h:2086
ValuePtr mFiller
Definition: AttributeArray.h:857
ValueType get(Index n, Index m=0) const
Definition: AttributeArray.h:2156
ValueType(*)(const AttributeArray *array, const Index n) GetterPtr
Definition: AttributeArray.h:825
AttributeHandle(const AttributeHandle &)=default
ValuePtr mCollapser
Definition: AttributeArray.h:856
const AttributeArray & array() const
Definition: AttributeArray.h:2141
const AttributeArray * mArray
Definition: AttributeArray.h:852
bool isUniform() const
Definition: AttributeArray.h:2182
std::unique_ptr< Handle > UniquePtr
Definition: AttributeArray.h:822
bool hasConstantStride() const
Definition: AttributeArray.h:2188
AttributeHandle & operator=(const AttributeHandle &)=default
Index index(Index n, Index m) const
Definition: AttributeArray.h:2148
Write-able version of AttributeHandle.
Definition: AttributeArray.h:889
virtual ~AttributeWriteHandle()=default
AttributeWriteHandle(AttributeArray &array, const bool expand=true)
Definition: AttributeArray.h:2206
std::shared_ptr< Handle > Ptr
Definition: AttributeArray.h:892
bool compact()
Compact the existing array to become uniform if all values are identical.
Definition: AttributeArray.h:2237
void collapse()
Replace the existing array with a uniform value (zero if none provided).
Definition: AttributeArray.h:2231
void set(Index n, const ValueType &value)
Definition: AttributeArray.h:2213
void expand(bool fill=true)
If this array is uniform, replace it with an array of length size().
Definition: AttributeArray.h:2225
AttributeArray & array()
Definition: AttributeArray.h:2275
std::unique_ptr< Handle > ScopedPtr
Definition: AttributeArray.h:893
static Ptr create(AttributeArray &array, const bool expand=true)
Definition: AttributeArray.h:2199
void set(Index n, Index m, const ValueType &value)
Definition: AttributeArray.h:2219
void fill(const ValueType &value)
Fill the existing array with the given value.
Definition: AttributeArray.h:2249
void collapse(const ValueType &uniformValue)
Definition: AttributeArray.h:2243
Typed class for storing attribute data.
Definition: AttributeArray.h:539
Index valueTypeSize() const override
Return the size in bytes of the value type of a single element in this array.
Definition: AttributeArray.h:625
ValueType getUnsafe(Index n) const
Return the value at index n (assumes in-core)
Definition: AttributeArray.h:1388
void readBuffers(std::istream &) override
Read attribute buffers from a stream.
Definition: AttributeArray.h:1728
std::shared_ptr< TypedAttributeArray > Ptr
Definition: AttributeArray.h:541
AccessorBasePtr getAccessor() const override
Obtain an Accessor that stores getter and setter functors.
Definition: AttributeArray.h:1978
void write(std::ostream &os, bool outputTransient) const override
Definition: AttributeArray.h:1820
typename Codec::template Storage< ValueType >::Type StorageType
Definition: AttributeArray.h:546
size_t memUsage() const override
Return the number of bytes of memory used by this attribute.
Definition: AttributeArray.h:1371
ValueType_ ValueType
Definition: AttributeArray.h:544
TypedAttributeArray(Index n=1, Index strideOrTotalSize=1, bool constantStride=true, const ValueType &uniformValue=zeroVal< ValueType >())
Default constructor, always constructs a uniform attribute.
Definition: AttributeArray.h:1115
bool isDataLoaded() const override
Return true if all data has been loaded.
Definition: AttributeArray.h:1660
bool isOutOfCore() const
Return true if this buffer's values have not yet been read from disk.
Definition: AttributeArray.h:1620
bool valueTypeIsVector() const override
Return true if the value type is a vector.
Definition: AttributeArray.h:1345
bool validData() const
Verify that data is not out-of-core or in a partially-read state.
Definition: AttributeArray.h:769
bool compact() override
Compact the existing array to become uniform if all values are identical.
Definition: AttributeArray.h:1524
static TypedAttributeArray & cast(AttributeArray &attributeArray)
Cast an AttributeArray to TypedAttributeArray<T>
Definition: AttributeArray.h:1241
void writeBuffers(std::ostream &os, bool outputTransient) const override
Definition: AttributeArray.h:1888
AttributeArray::Ptr copy() const override
Definition: AttributeArray.h:1261
Index storageTypeSize() const override
Definition: AttributeArray.h:629
bool valueTypeIsQuaternion() const override
Return true if the value type is a quaternion.
Definition: AttributeArray.h:1353
void readPagedBuffers(compression::PagedInputStream &) override
Read attribute buffers from a paged stream.
Definition: AttributeArray.h:1767
void set(Index n, const ValueType &value)
Set value at the given index n.
Definition: AttributeArray.h:1452
TypedAttributeArray & operator=(const TypedAttributeArray &)
Definition: AttributeArray.h:1165
static void registerType()
Register this attribute type along with a factory function.
Definition: AttributeArray.h:1213
bool valueTypeIsFloatingPoint() const override
Return true if the value type is floating point.
Definition: AttributeArray.h:1316
void writeMetadata(std::ostream &os, bool outputTransient, bool paged) const override
Definition: AttributeArray.h:1829
static void unregisterType()
Remove this attribute type from the registry.
Definition: AttributeArray.h:1221
const StorageType * data() const
Definition: AttributeArray.h:766
void loadData() const override
Ensures all data is in-core.
Definition: AttributeArray.h:1652
void read(std::istream &) override
Read attribute data from a stream.
Definition: AttributeArray.h:1668
ValueType get(Index n) const
Return the value at index n.
Definition: AttributeArray.h:1400
static const NamePair & attributeType()
Return the name of this attribute's type (includes codec)
Definition: AttributeArray.h:1192
bool valueTypeIsClass() const override
Return true if the value type is a class (ie vector, matrix or quaternion return true)
Definition: AttributeArray.h:1336
Index size() const override
Return the number of elements in this array.
Definition: AttributeArray.h:607
void collapse() override
Replace the existing array with a uniform zero value.
Definition: AttributeArray.h:1541
Index dataSize() const override
Return the size of the data in this array.
Definition: AttributeArray.h:614
Codec_ Codec
Definition: AttributeArray.h:545
void expand(bool fill=true) override
Replace the single value storage with an array of length size().
Definition: AttributeArray.h:1503
AttributeArray::Ptr copyUncompressed() const override
Definition: AttributeArray.h:1269
static bool isRegistered()
Return true if this attribute type is registered.
Definition: AttributeArray.h:1205
bool valueTypeIsMatrix() const override
Return true if the value type is a matrix.
Definition: AttributeArray.h:1362
StorageType * data()
Return the raw data buffer.
Definition: AttributeArray.h:765
const StorageType * constData() const
Return the raw data buffer.
Definition: AttributeArray.h:758
void fill(const ValueType &value)
Fill the existing array with the given value.
Definition: AttributeArray.h:1571
Index stride() const override
Definition: AttributeArray.h:611
static Ptr create(Index n, Index strideOrTotalSize=1, bool constantStride=true, const Metadata *metadata=nullptr)
Return a new attribute array of the given length n and stride with uniform value zero.
Definition: AttributeArray.h:1229
Name codecType() const override
Return the name of the codec used by this array (e.g., "trnc" or "fxpt").
Definition: AttributeArray.h:622
bool decompress() override
Uncompress the attribute array.
Definition: AttributeArray.h:1612
bool compress() override
Compress the attribute array.
Definition: AttributeArray.h:1596
void writePagedBuffers(compression::PagedOutputStream &os, bool outputTransient) const override
Definition: AttributeArray.h:1930
Name valueType() const override
Return the name of the value type of a single element in this array (e.g., "float" or "vec3d").
Definition: AttributeArray.h:619
void setUnsafe(Index n, const ValueType &value)
Set value at the given index n (assumes in-core)
Definition: AttributeArray.h:1437
void readMetadata(std::istream &) override
Read attribute metadata from a stream.
Definition: AttributeArray.h:1677
#define OPENVDB_LOG_WARN(message)
Log a warning message of the form 'someVar << "some text" << ...'.
Definition: logging.h:256
static fileSize_t write(std::ostream &os, const GridHandle< BufferT > &handle, Codec codec)
static void read(std::istream &is, GridHandle< BufferT > &handle, Codec codec)
OPENVDB_API void bloscDecompress(char *uncompressedBuffer, const size_t expectedBytes, const size_t bufferBytes, const char *compressedBuffer)
Decompress into the supplied buffer. Will throw if decompression fails or uncompressed buffer has ins...
OPENVDB_API size_t bloscCompressedSize(const char *buffer, const size_t uncompressedBytes)
Convenience wrapper to retrieve the compressed size of buffer when compressed.
OPENVDB_API void bloscCompress(char *compressedBuffer, size_t &compressedBytes, const size_t bufferBytes, const char *uncompressedBuffer, const size_t uncompressedBytes)
Compress into the supplied buffer.
OPENVDB_API uint32_t getDataCompression(std::ios_base &)
Return a bitwise OR of compression option flags (COMPRESS_ZIP, COMPRESS_ACTIVE_MASK,...
OPENVDB_API SharedPtr< MappedFile > getMappedFilePtr(std::ios_base &)
Return a shared pointer to the memory-mapped file with which the given stream is associated,...
@ COMPRESS_BLOSC
Definition: Compression.h:56
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:477
bool isExactlyEqual(const T0 &a, const T1 &b)
Return true if a is exactly equal to b.
Definition: Math.h:444
internal::half half
Definition: Types.h:29
IntegerVectorT floatingPointToFixedPoint(const math::Vec3< FloatT > &v)
Definition: AttributeArray.h:69
FloatVectorT fixedPointToFloatingPoint(const math::Vec3< IntegerT > &v)
Definition: AttributeArray.h:79
std::string Name
Definition: Name.h:17
Index32 Index
Definition: Types.h:54
int16_t Int16
Definition: Types.h:55
std::pair< Name, Name > NamePair
Definition: AttributeArray.h:39
uint64_t Index64
Definition: Types.h:53
Definition: Exceptions.h:13
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:74
static pnanovdb_uint32_t allocate(pnanovdb_uint32_t *poffset, pnanovdb_uint32_t size, pnanovdb_uint32_t alignment)
Definition: pnanovdb_validate_strides.h:20
typename T::ValueType ElementType
Definition: Types.h:208
static ValueType get(GetterPtr functor, const AttributeArray *array, const Index n)
Getter that calls the supplied functor.
Definition: AttributeArray.h:2062
void(*)(AttributeArray *array, const Index n, const ValueType &value) SetterPtr
Definition: AttributeArray.h:2059
static void set(SetterPtr functor, AttributeArray *array, const Index n, const ValueType &value)
Setter that calls the supplied functor.
Definition: AttributeArray.h:2067
ValueType(*)(const AttributeArray *array, const Index n) GetterPtr
Definition: AttributeArray.h:2058
Accessor to call unsafe get and set methods based on templated Codec and Value.
Definition: AttributeArray.h:2036
void(*)(AttributeArray *array, const Index n, const ValueType &value) SetterPtr
Definition: AttributeArray.h:2038
static ValueType get(GetterPtr, const AttributeArray *array, const Index n)
Definition: AttributeArray.h:2042
ValueType(*)(const AttributeArray *array, const Index n) GetterPtr
Definition: AttributeArray.h:2037
static void set(SetterPtr, AttributeArray *array, const Index n, const ValueType &value)
Definition: AttributeArray.h:2048
Accessor base class for AttributeArray storage where type is not available.
Definition: AttributeArray.h:409
virtual ~AccessorBase()=default
Definition: AttributeArray.h:415
SetterPtr mSetter
Definition: AttributeArray.h:424
GetterPtr mGetter
Definition: AttributeArray.h:423
void(*)(AttributeArray *array, const T &value) ValuePtr
Definition: AttributeArray.h:418
T(*)(const AttributeArray *array, const Index n) GetterPtr
Definition: AttributeArray.h:416
void(*)(AttributeArray *array, const Index n, const T &value) SetterPtr
Definition: AttributeArray.h:417
ValuePtr mFiller
Definition: AttributeArray.h:426
Accessor(GetterPtr getter, SetterPtr setter, ValuePtr collapser, ValuePtr filler)
Definition: AttributeArray.h:420
ValuePtr mCollapser
Definition: AttributeArray.h:425
Definition: AttributeArray.h:507
typename attribute_traits::UIntTypeTrait< OneByte, T >::Type Type
Definition: AttributeArray.h:507
Definition: AttributeArray.h:505
static const char * name()
Definition: AttributeArray.h:512
Definition: AttributeArray.h:466
T Type
Definition: AttributeArray.h:466
Definition: AttributeArray.h:464
static const char * name()
Definition: AttributeArray.h:470
Definition: AttributeArray.h:487
static ValueType decode(const ValueType &value)
Definition: AttributeArray.h:490
static ValueType encode(const ValueType &value)
Definition: AttributeArray.h:489
static const char * name()
Definition: AttributeArray.h:488
Definition: AttributeArray.h:477
typename attribute_traits::TruncateTrait< T >::Type Type
Definition: AttributeArray.h:477
Definition: AttributeArray.h:475
static const char * name()
Definition: AttributeArray.h:481
Definition: AttributeArray.h:496
static ValueType decode(const ValueType &value)
Definition: AttributeArray.h:499
static ValueType encode(const ValueType &value)
Definition: AttributeArray.h:498
static const char * name()
Definition: AttributeArray.h:497
Definition: AttributeArray.h:524
StorageType Type
Definition: AttributeArray.h:524
Definition: AttributeArray.h:520
uint16_t StorageType
Definition: AttributeArray.h:521
static const char * name()
Definition: AttributeArray.h:528
Definition: AttributeArray.h:460
short Type
Definition: AttributeArray.h:437
Definition: AttributeArray.h:435
uint16_t Type
Definition: AttributeArray.h:445
uint8_t Type
Definition: AttributeArray.h:444
Definition: AttributeArray.h:443
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:116
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:202