10#ifndef OPENVDB_POINTS_ATTRIBUTE_ARRAY_HAS_BEEN_INCLUDED
11#define OPENVDB_POINTS_ATTRIBUTE_ARRAY_HAS_BEEN_INCLUDED
24#include <tbb/spin_mutex.h>
33class TestAttributeArray;
49template <
typename IntegerT,
typename FloatT>
53 static_assert(std::is_unsigned<IntegerT>::value,
"IntegerT must be unsigned");
54 if (FloatT(0.0) > s)
return std::numeric_limits<IntegerT>::min();
55 else if (FloatT(1.0) <= s)
return std::numeric_limits<IntegerT>::max();
56 return IntegerT(s * FloatT(std::numeric_limits<IntegerT>::max()));
60template <
typename FloatT,
typename IntegerT>
64 static_assert(std::is_unsigned<IntegerT>::value,
"IntegerT must be unsigned");
65 return FloatT(s) / FloatT((std::numeric_limits<IntegerT>::max()));
68template <
typename IntegerVectorT,
typename FloatT>
72 return IntegerVectorT(
73 floatingPointToFixedPoint<typename IntegerVectorT::ValueType>(v.
x()),
74 floatingPointToFixedPoint<typename IntegerVectorT::ValueType>(v.
y()),
75 floatingPointToFixedPoint<typename IntegerVectorT::ValueType>(v.
z()));
78template <
typename FloatVectorT,
typename IntegerT>
83 fixedPointToFloatingPoint<typename FloatVectorT::ValueType>(v.
x()),
84 fixedPointToFloatingPoint<typename FloatVectorT::ValueType>(v.
y()),
85 fixedPointToFloatingPoint<typename FloatVectorT::ValueType>(v.
z()));
97 template <
typename T>
struct Accessor;
105 CONSTANTSTRIDE = 0x8,
113 WRITEMEMCOMPRESS = 0x4,
121 tbb::spin_mutex::scoped_lock lock;
126 using Ptr = std::shared_ptr<AttributeArray>;
127 using ConstPtr = std::shared_ptr<const AttributeArray>;
138 if (mFlags & PARTIALREAD) mCompressedBytes = 0;
202 bool constantStride =
true,
214 template<
typename AttributeArrayType>
215 bool isType()
const {
return this->type() == AttributeArrayType::attributeType(); }
218 template<
typename ValueType>
219 bool hasValueType()
const {
return this->type().first == typeNameAsString<ValueType>(); }
244 template<
typename IterT>
245 void copyValuesUnsafe(
const AttributeArray& sourceArray,
const IterT& iter);
249 template<
typename IterT>
250 void copyValues(
const AttributeArray& sourceArray,
const IterT& iter,
bool compact =
true);
256 virtual void expand(
bool fill =
true) = 0;
268 bool isHidden()
const {
return bool(mFlags & HIDDEN); }
289 uint8_t
flags()
const {
return mFlags; }
292 virtual void read(std::istream&) = 0;
295 virtual void write(std::ostream&,
bool outputTransient)
const = 0;
297 virtual void write(std::ostream&)
const = 0;
304 virtual void writeMetadata(std::ostream&,
bool outputTransient,
bool paged)
const = 0;
310 virtual void writeBuffers(std::ostream&,
bool outputTransient)
const = 0;
334 friend class ::TestAttributeArray;
341 virtual char* dataAsByteArray() = 0;
342 virtual const char* dataAsByteArray()
const = 0;
345 template <
typename IterT>
346 void doCopyValues(
const AttributeArray& sourceArray,
const IterT& iter,
347 bool rangeChecking =
true);
365 bool mIsUniform =
true;
368 uint8_t mUsePagedRead = 0;
394 mGetter(getter), mSetter(setter), mCollapser(collapser), mFiller(filler) { }
406namespace attribute_traits
438 template <
typename T>
441 template<
typename ValueType>
static void decode(
const ValueType&, ValueType&);
442 template<
typename ValueType>
static void encode(
const ValueType&, ValueType&);
443 static const char*
name() {
return "null"; }
449 template <
typename T>
452 template<
typename StorageType,
typename ValueType>
static void decode(
const StorageType&, ValueType&);
453 template<
typename StorageType,
typename ValueType>
static void encode(
const ValueType&, StorageType&);
454 static const char*
name() {
return "trnc"; }
461 static const char*
name() {
return "fxpt"; }
462 template <
typename ValueType>
static ValueType
encode(
const ValueType& value) {
return value + ValueType(0.5); }
463 template <
typename ValueType>
static ValueType
decode(
const ValueType& value) {
return value - ValueType(0.5); }
470 static const char*
name() {
return "ufxpt"; }
471 template <
typename ValueType>
static ValueType
encode(
const ValueType& value) {
return value; }
472 template <
typename ValueType>
static ValueType
decode(
const ValueType& value) {
return value; }
476template <
bool OneByte,
typename Range=PositionRange>
479 template <
typename T>
482 template<
typename StorageType,
typename ValueType>
static void decode(
const StorageType&, ValueType&);
483 template<
typename StorageType,
typename ValueType>
static void encode(
const ValueType&, StorageType&);
486 static const std::string
Name = std::string(Range::name()) + (OneByte ?
"8" :
"16");
496 template <
typename T>
501 static const char*
name() {
return "uvec"; }
510template<
typename ValueType_,
typename Codec_ = NullCodec>
514 using Ptr = std::shared_ptr<TypedAttributeArray>;
515 using ConstPtr = std::shared_ptr<const TypedAttributeArray>;
519 using StorageType =
typename Codec::template Storage<ValueType>::Type;
525 const ValueType& uniformValue = zeroVal<ValueType>());
550 static Ptr create(
Index n,
Index strideOrTotalSize = 1,
bool constantStride =
true,
551 const Metadata* metadata =
nullptr);
560 static const NamePair& attributeType();
565 static bool isRegistered();
567 static void registerType();
569 static void unregisterType();
576 Index stride()
const override {
return hasConstantStride() ? mStrideOrTotalSize : 0; }
580 return hasConstantStride() ? mSize * mStrideOrTotalSize : mStrideOrTotalSize;
597 bool valueTypeIsFloatingPoint()
const override;
600 bool valueTypeIsClass()
const override;
603 bool valueTypeIsVector()
const override;
606 bool valueTypeIsQuaternion()
const override;
609 bool valueTypeIsMatrix()
const override;
612 size_t memUsage()
const override;
618 size_t memUsageIfLoaded()
const override;
621 ValueType getUnsafe(
Index n)
const;
623 ValueType get(
Index n)
const;
625 template<
typename T>
void getUnsafe(
Index n, T& value)
const;
627 template<
typename T>
void get(
Index n, T& value)
const;
634 void setUnsafe(
Index n,
const ValueType& value);
636 void set(
Index n,
const ValueType& value);
638 template<
typename T>
void setUnsafe(
Index n,
const T& value);
640 template<
typename T>
void set(
Index n,
const T& value);
651 void expand(
bool fill =
true)
override;
653 void collapse()
override;
655 bool compact()
override;
658 void collapse(
const ValueType& uniformValue);
661 void fill(
const ValueType& value);
664 static void collapse(
AttributeArray* array,
const ValueType& value);
669 void read(std::istream&)
override;
673 void write(std::ostream& os,
bool outputTransient)
const override;
675 void write(std::ostream&)
const override;
678 void readMetadata(std::istream&)
override;
683 void writeMetadata(std::ostream& os,
bool outputTransient,
bool paged)
const override;
686 void readBuffers(std::istream&)
override;
690 void writeBuffers(std::ostream& os,
bool outputTransient)
const override;
700 inline bool isOutOfCore()
const;
703 void loadData()
const override;
706 bool isDataLoaded()
const override;
712 AccessorBasePtr getAccessor()
const override;
719 inline bool validData()
const {
return !(isOutOfCore() || (flags() & PARTIALREAD)); }
722 friend class ::TestAttributeArray;
727 inline void doLoad()
const;
729 inline void doLoadUnsafe()
const;
732 inline void setOutOfCore(
const bool);
738 char* dataAsByteArray()
override;
739 const char* dataAsByteArray()
const override;
741 size_t arrayMemUsage()
const;
748 return TypedAttributeArray::create(n, strideOrTotalSize, constantStride, metadata);
751 std::unique_ptr<StorageType[]> mData;
753 Index mStrideOrTotalSize;
762template <
typename ValueType,
typename CodecType = UnknownCodec>
767 using Ptr = std::shared_ptr<Handle>;
806 friend class ::TestAttributeArray;
808 template <
bool IsUnknownCodec>
809 typename std::enable_if<IsUnknownCodec, bool>::type compatibleType()
const;
811 template <
bool IsUnknownCodec>
812 typename std::enable_if<!IsUnknownCodec, bool>::type compatibleType()
const;
814 template <
bool IsUnknownCodec>
815 typename std::enable_if<IsUnknownCodec, ValueType>::type get(
Index index)
const;
817 template <
bool IsUnknownCodec>
818 typename std::enable_if<!IsUnknownCodec, ValueType>::type get(
Index index)
const;
823 Index mStrideOrTotalSize;
825 bool mCollapseOnDestruction;
833template <
typename ValueType,
typename CodecType = UnknownCodec>
838 using Ptr = std::shared_ptr<Handle>;
860 void fill(
const ValueType& value);
868 friend class ::TestAttributeArray;
870 template <
bool IsUnknownCodec>
871 typename std::enable_if<IsUnknownCodec, void>::type set(
Index index,
const ValueType& value)
const;
873 template <
bool IsUnknownCodec>
874 typename std::enable_if<!IsUnknownCodec, void>::type set(
Index index,
const ValueType& value)
const;
884template<
typename ValueType>
886NullCodec::decode(
const ValueType& data, ValueType& val)
892template<
typename ValueType>
894NullCodec::encode(
const ValueType& val, ValueType& data)
900template<
typename StorageType,
typename ValueType>
902TruncateCodec::decode(
const StorageType& data, ValueType& val)
904 val =
static_cast<ValueType
>(data);
908template<
typename StorageType,
typename ValueType>
910TruncateCodec::encode(
const ValueType& val, StorageType& data)
912 data =
static_cast<StorageType
>(val);
916template <
bool OneByte,
typename Range>
917template<
typename StorageType,
typename ValueType>
921 val = fixedPointToFloatingPoint<ValueType>(data);
925 val = Range::template decode<ValueType>(val);
929template <
bool OneByte,
typename Range>
930template<
typename StorageType,
typename ValueType>
936 const ValueType newVal = Range::template encode<ValueType>(val);
938 data = floatingPointToFixedPoint<StorageType>(newVal);
946 val = math::QuantizedUnitVec::unpack(data);
954 data = math::QuantizedUnitVec::pack(val);
962template <
typename IterT>
963void AttributeArray::doCopyValues(
const AttributeArray& sourceArray,
const IterT& iter,
975 const char*
const sourceBuffer = sourceArray.dataAsByteArray();
976 char*
const targetBuffer = this->dataAsByteArray();
979 if (rangeChecking && this->isUniform()) {
983 const bool sourceIsUniform = sourceArray.
isUniform();
985 const Index sourceDataSize = rangeChecking ? sourceArray.
dataSize() : 0;
986 const Index targetDataSize = rangeChecking ? this->dataSize() : 0;
988 for (IterT it(iter); it; ++it) {
989 const Index sourceIndex = sourceIsUniform ? 0 : it.sourceIndex();
990 const Index targetIndex = it.targetIndex();
993 if (sourceIndex >= sourceDataSize) {
995 "Cannot copy array data as source index exceeds size of source array.");
997 if (targetIndex >= targetDataSize) {
999 "Cannot copy array data as target index exceeds size of target array.");
1008 const size_t targetOffset(targetIndex * bytes);
1009 const size_t sourceOffset(sourceIndex * bytes);
1011 std::memcpy(targetBuffer + targetOffset, sourceBuffer + sourceOffset, bytes);
1015template <
typename IterT>
1016void AttributeArray::copyValuesUnsafe(
const AttributeArray& sourceArray,
const IterT& iter)
1018 this->doCopyValues(sourceArray, iter,
false);
1021template <
typename IterT>
1026 if (bytes != this->storageTypeSize()) {
1043 this->doCopyValues(sourceArray, iter,
true);
1057template<
typename ValueType_,
typename Codec_>
1063 , mStrideOrTotalSize(strideOrTotalSize)
1065 if (constantStride) {
1067 if (strideOrTotalSize == 0) {
1069 "stride to be at least one.")
1074 if (mStrideOrTotalSize < n) {
1076 "a total size of at least the number of elements in the array.")
1079 mSize = std::max(
Index(1), mSize);
1080 mStrideOrTotalSize = std::max(
Index(1), mStrideOrTotalSize);
1081 Codec::encode(uniformValue, this->
data()[0]);
1085template<
typename ValueType_,
typename Codec_>
1092template<
typename ValueType_,
typename Codec_>
1094 const tbb::spin_mutex::scoped_lock& lock)
1097 , mStrideOrTotalSize(rhs.mStrideOrTotalSize)
1101 std::memcpy(
static_cast<void*
>(this->
data()), rhs.
data(), this->arrayMemUsage());
1106template<
typename ValueType_,
typename Codec_>
1107TypedAttributeArray<ValueType_, Codec_>&
1112 tbb::spin_mutex::scoped_lock lock(mMutex);
1113 tbb::spin_mutex::scoped_lock rhsLock(rhs.
mMutex);
1120 mStrideOrTotalSize = rhs.mStrideOrTotalSize;
1123 if (this->validData()) {
1125 std::memcpy(
static_cast<void*
>(this->data()), rhs.
data(), this->arrayMemUsage());
1133template<
typename ValueType_,
typename Codec_>
1144template<
typename ValueType_,
typename Codec_>
1152template<
typename ValueType_,
typename Codec_>
1160template<
typename ValueType_,
typename Codec_>
1168template<
typename ValueType_,
typename Codec_>
1180template<
typename ValueType_,
typename Codec_>
1190template<
typename ValueType_,
typename Codec_>
1200template<
typename ValueType_,
typename Codec_>
1208template<
typename ValueType_,
typename Codec_>
1212 if (this->isOutOfCore())
return 0;
1214 return (mIsUniform ? 1 : this->dataSize()) *
sizeof(StorageType);
1218template<
typename ValueType_,
typename Codec_>
1220TypedAttributeArray<ValueType_, Codec_>::allocate()
1224 mData.reset(
new StorageType[1]);
1227 const size_t size(this->dataSize());
1229 mData.reset(
new StorageType[size]);
1234template<
typename ValueType_,
typename Codec_>
1236TypedAttributeArray<ValueType_, Codec_>::deallocate()
1239 if (this->isOutOfCore()) {
1240 this->setOutOfCore(
false);
1241 this->mPageHandle.reset();
1243 if (mData) mData.reset();
1247template<
typename ValueType_,
typename Codec_>
1253 if (std::is_same<ValueType, Quats>::value ||
1254 std::is_same<ValueType, Quatd>::value ||
1255 std::is_same<ValueType, Mat3s>::value ||
1256 std::is_same<ValueType, Mat3d>::value ||
1257 std::is_same<ValueType, Mat4s>::value ||
1258 std::is_same<ValueType, Mat4d>::value)
return true;
1263 return std::is_floating_point<ElementT>::value || std::is_same<math::half, ElementT>::value;
1267template<
typename ValueType_,
typename Codec_>
1272 return std::is_class<ValueType>::value && !std::is_same<math::half, ValueType>::value;
1276template<
typename ValueType_,
typename Codec_>
1284template<
typename ValueType_,
typename Codec_>
1289 return !this->valueType().compare(0, 4,
"quat");
1293template<
typename ValueType_,
typename Codec_>
1298 return !this->valueType().compare(0, 3,
"mat");
1302template<
typename ValueType_,
typename Codec_>
1306 return sizeof(*this) + (bool(mData) ? this->arrayMemUsage() : 0);
1310template<
typename ValueType_,
typename Codec_>
1314 return sizeof(*this) + (mIsUniform ? 1 : this->dataSize()) *
sizeof(
StorageType);
1318template<
typename ValueType_,
typename Codec_>
1325 Codec::decode(this->data()[mIsUniform ? 0 : n], val);
1330template<
typename ValueType_,
typename Codec_>
1335 if (this->isOutOfCore()) this->doLoad();
1337 return this->getUnsafe(n);
1341template<
typename ValueType_,
typename Codec_>
1346 val =
static_cast<T
>(this->getUnsafe(n));
1350template<
typename ValueType_,
typename Codec_>
1355 val =
static_cast<T
>(this->get(n));
1359template<
typename ValueType_,
typename Codec_>
1367template<
typename ValueType_,
typename Codec_>
1378 Codec::encode(val, this->data()[mIsUniform ? 0 : n]);
1382template<
typename ValueType_,
typename Codec_>
1387 if (this->isOutOfCore()) this->doLoad();
1388 if (this->isUniform()) this->expand();
1390 this->setUnsafe(n, val);
1394template<
typename ValueType_,
typename Codec_>
1399 this->setUnsafe(n,
static_cast<ValueType>(val));
1403template<
typename ValueType_,
typename Codec_>
1408 this->set(n,
static_cast<ValueType>(val));
1412template<
typename ValueType_,
typename Codec_>
1420template<
typename ValueType_,
typename Codec_>
1424 if (!mIsUniform)
return;
1429 tbb::spin_mutex::scoped_lock lock(mMutex);
1436 for (
Index i = 0; i < this->dataSize(); ++i) this->data()[i] = val;
1441template<
typename ValueType_,
typename Codec_>
1445 if (mIsUniform)
return true;
1448 const ValueType_ val = this->get(0);
1449 for (
Index i = 1; i < this->dataSize(); i++) {
1453 this->collapse(this->get(0));
1458template<
typename ValueType_,
typename Codec_>
1466template<
typename ValueType_,
typename Codec_>
1471 tbb::spin_mutex::scoped_lock lock(mMutex);
1476 Codec::encode(uniformValue, this->data()[0]);
1480template<
typename ValueType_,
typename Codec_>
1488template<
typename ValueType_,
typename Codec_>
1492 if (this->isOutOfCore()) {
1493 tbb::spin_mutex::scoped_lock lock(mMutex);
1498 const Index size = mIsUniform ? 1 : this->dataSize();
1499 for (
Index i = 0; i < size; ++i) {
1500 Codec::encode(value, this->data()[i]);
1505template<
typename ValueType_,
typename Codec_>
1513template<
typename ValueType_,
typename Codec_>
1521template<
typename ValueType_,
typename Codec_>
1529template<
typename ValueType_,
typename Codec_>
1531TypedAttributeArray<ValueType_, Codec_>::doLoad()
const
1533 if (!(this->isOutOfCore()))
return;
1535 TypedAttributeArray<ValueType_, Codec_>* self =
1536 const_cast<TypedAttributeArray<ValueType_, Codec_>*
>(
this);
1540 tbb::spin_mutex::scoped_lock lock(self->mMutex);
1541 this->doLoadUnsafe();
1545template<
typename ValueType_,
typename Codec_>
1553template<
typename ValueType_,
typename Codec_>
1557 return !this->isOutOfCore();
1561template<
typename ValueType_,
typename Codec_>
1565 this->readMetadata(is);
1566 this->readBuffers(is);
1570template<
typename ValueType_,
typename Codec_>
1577 is.read(
reinterpret_cast<char*
>(&bytes),
sizeof(
Index64));
1578 bytes = bytes -
sizeof(
Int16) -
sizeof(
Index);
1580 uint8_t flags = uint8_t(0);
1581 is.read(
reinterpret_cast<char*
>(&flags),
sizeof(uint8_t));
1584 uint8_t serializationFlags = uint8_t(0);
1585 is.read(
reinterpret_cast<char*
>(&serializationFlags),
sizeof(uint8_t));
1588 is.read(
reinterpret_cast<char*
>(&size),
sizeof(
Index));
1592 if (mFlags >= 0x20) {
1597 if (serializationFlags >= 0x10) {
1603 mIsUniform = serializationFlags & WRITEUNIFORM;
1604 mUsePagedRead = serializationFlags & WRITEPAGED;
1605 mCompressedBytes = bytes;
1606 mFlags |= PARTIALREAD;
1610 if (serializationFlags & WRITESTRIDED) {
1612 is.read(
reinterpret_cast<char*
>(&stride),
sizeof(
Index));
1613 mStrideOrTotalSize = stride;
1616 mStrideOrTotalSize = 1;
1621template<
typename ValueType_,
typename Codec_>
1625 if (mUsePagedRead) {
1630 tbb::spin_mutex::scoped_lock lock(mMutex);
1634 uint8_t bloscCompressed(0);
1635 if (!mIsUniform) is.read(
reinterpret_cast<char*
>(&bloscCompressed),
sizeof(uint8_t));
1638 std::unique_ptr<char[]> buffer(
new char[mCompressedBytes]);
1639 is.read(buffer.get(), mCompressedBytes);
1640 mCompressedBytes = 0;
1641 mFlags =
static_cast<uint8_t
>(mFlags & ~PARTIALREAD);
1645 if (bloscCompressed == uint8_t(1)) {
1649 const size_t inBytes = this->dataSize() *
sizeof(
StorageType);
1651 if (newBuffer) buffer.reset(newBuffer.release());
1656 mData.reset(
reinterpret_cast<StorageType*
>(buffer.release()));
1660template<
typename ValueType_,
typename Codec_>
1664 if (!mUsePagedRead) {
1669#ifdef OPENVDB_USE_DELAYED_LOADING
1672 io::MappedFile::Ptr mappedFile = io::getMappedFilePtr(is.
getInputStream());
1673 const bool delayLoad = (mappedFile.get() !=
nullptr);
1678 size_t compressedBytes(mCompressedBytes);
1679 mCompressedBytes = 0;
1680 mFlags =
static_cast<uint8_t
>(mFlags & ~PARTIALREAD);
1688 tbb::spin_mutex::scoped_lock lock(mMutex);
1692#ifdef OPENVDB_USE_DELAYED_LOADING
1693 this->setOutOfCore(delayLoad);
1694 is.
read(mPageHandle, std::streamsize(mPageHandle->size()), delayLoad);
1696 is.
read(mPageHandle, std::streamsize(mPageHandle->size()),
false);
1699#ifdef OPENVDB_USE_DELAYED_LOADING
1702 std::unique_ptr<char[]> buffer = mPageHandle->read();
1703 mData.reset(
reinterpret_cast<StorageType*
>(buffer.release()));
1704 mPageHandle.reset();
1705#ifdef OPENVDB_USE_DELAYED_LOADING
1715template<
typename ValueType_,
typename Codec_>
1719 this->write(os,
false);
1723template<
typename ValueType_,
typename Codec_>
1727 this->writeMetadata(os, outputTransient,
false);
1728 this->writeBuffers(os, outputTransient);
1732template<
typename ValueType_,
typename Codec_>
1736 if (!outputTransient && this->isTransient())
return;
1738 if (mFlags & PARTIALREAD) {
1742 uint8_t flags(mFlags);
1743 uint8_t serializationFlags(0);
1745 Index strideOrTotalSize(mStrideOrTotalSize);
1746 bool strideOfOne(this->stride() == 1);
1751 if (bloscCompression) this->doLoad();
1753 size_t compressedBytes = 0;
1757 serializationFlags |= WRITESTRIDED;
1762 serializationFlags |= WRITEUNIFORM;
1763 if (bloscCompression && paged) serializationFlags |= WRITEPAGED;
1765 else if (bloscCompression)
1767 if (paged) serializationFlags |= WRITEPAGED;
1769 const char* charBuffer =
reinterpret_cast<const char*
>(this->data());
1770 const size_t inBytes = this->arrayMemUsage();
1777 bytes += (compressedBytes > 0) ? compressedBytes : this->arrayMemUsage();
1781 os.write(
reinterpret_cast<const char*
>(&bytes),
sizeof(
Index64));
1782 os.write(
reinterpret_cast<const char*
>(&flags),
sizeof(uint8_t));
1783 os.write(
reinterpret_cast<const char*
>(&serializationFlags),
sizeof(uint8_t));
1784 os.write(
reinterpret_cast<const char*
>(&size),
sizeof(
Index));
1787 if (!strideOfOne) os.write(
reinterpret_cast<const char*
>(&strideOrTotalSize),
sizeof(
Index));
1791template<
typename ValueType_,
typename Codec_>
1795 if (!outputTransient && this->isTransient())
return;
1797 if (mFlags & PARTIALREAD) {
1803 if (this->isUniform()) {
1804 os.write(
reinterpret_cast<const char*
>(this->data()),
sizeof(
StorageType));
1808 std::unique_ptr<char[]> compressedBuffer;
1809 size_t compressedBytes = 0;
1810 const char* charBuffer =
reinterpret_cast<const char*
>(this->data());
1811 const size_t inBytes = this->arrayMemUsage();
1813 if (compressedBuffer) {
1814 uint8_t bloscCompressed(1);
1815 os.write(
reinterpret_cast<const char*
>(&bloscCompressed),
sizeof(uint8_t));
1816 os.write(
reinterpret_cast<const char*
>(compressedBuffer.get()), compressedBytes);
1819 uint8_t bloscCompressed(0);
1820 os.write(
reinterpret_cast<const char*
>(&bloscCompressed),
sizeof(uint8_t));
1821 os.write(
reinterpret_cast<const char*
>(this->data()), inBytes);
1826 uint8_t bloscCompressed(0);
1827 os.write(
reinterpret_cast<const char*
>(&bloscCompressed),
sizeof(uint8_t));
1828 os.write(
reinterpret_cast<const char*
>(this->data()), this->arrayMemUsage());
1833template<
typename ValueType_,
typename Codec_>
1837 if (!outputTransient && this->isTransient())
return;
1841 if (!bloscCompression) {
1846 if (mFlags & PARTIALREAD) {
1852 os.
write(
reinterpret_cast<const char*
>(this->data()), this->arrayMemUsage());
1856template<
typename ValueType_,
typename Codec_>
1860 if (!(this->isOutOfCore()))
return;
1869 std::unique_ptr<char[]> buffer = self->mPageHandle->read();
1871 self->mData.reset(
reinterpret_cast<StorageType*
>(buffer.release()));
1873 self->mPageHandle.reset();
1877 self->mOutOfCore =
false;
1881template<
typename ValueType_,
typename Codec_>
1896template<
typename ValueType_,
typename Codec_>
1901 if(!otherT)
return false;
1902 if(this->mSize != otherT->mSize ||
1903 this->mStrideOrTotalSize != otherT->mStrideOrTotalSize ||
1905 this->attributeType() != this->attributeType())
return false;
1910 const StorageType *target = this->data(), *source = otherT->
data();
1911 if (!target && !source)
return true;
1912 if (!target || !source)
return false;
1913 Index n = this->mIsUniform ? 1 : mSize;
1919template<
typename ValueType_,
typename Codec_>
1921TypedAttributeArray<ValueType_, Codec_>::dataAsByteArray()
1923 return reinterpret_cast<char*
>(this->data());
1927template<
typename ValueType_,
typename Codec_>
1929TypedAttributeArray<ValueType_, Codec_>::dataAsByteArray()
const
1931 return reinterpret_cast<const char*
>(this->data());
1939template <
typename CodecType,
typename ValueType>
1960template <
typename ValueType>
1968 return (*functor)(array, n);
1973 (*functor)(array, n, value);
1982template <
typename ValueType,
typename CodecType>
1990template <
typename ValueType,
typename CodecType>
1993 , mStrideOrTotalSize(array.hasConstantStride() ? array.stride() : 1)
1994 , mSize(array.hasConstantStride() ? array.size() : array.dataSize())
1995 , mCollapseOnDestruction(collapseOnDestruction && array.isStreaming())
1997 if (!this->compatibleType<std::is_same<CodecType, UnknownCodec>::value>()) {
2018template <
typename ValueType,
typename CodecType>
2022 if (mCollapseOnDestruction)
const_cast<AttributeArray*
>(this->mArray)->collapse();
2025template <
typename ValueType,
typename CodecType>
2026template <
bool IsUnknownCodec>
2027typename std::enable_if<IsUnknownCodec, bool>::type
2032 return mArray->hasValueType<ValueType>();
2035template <
typename ValueType,
typename CodecType>
2036template <
bool IsUnknownCodec>
2037typename std::enable_if<!IsUnknownCodec, bool>::type
2038AttributeHandle<ValueType, CodecType>::compatibleType()
const
2042 return mArray->isType<TypedAttributeArray<ValueType, CodecType>>();
2045template <
typename ValueType,
typename CodecType>
2052template <
typename ValueType,
typename CodecType>
2055 Index index = n * mStrideOrTotalSize + m;
2060template <
typename ValueType,
typename CodecType>
2063 return this->get<std::is_same<CodecType, UnknownCodec>::value>(this->index(n, m));
2066template <
typename ValueType,
typename CodecType>
2067template <
bool IsUnknownCodec>
2068typename std::enable_if<IsUnknownCodec, ValueType>::type
2073 return (*mGetter)(mArray, index);
2076template <
typename ValueType,
typename CodecType>
2077template <
bool IsUnknownCodec>
2078typename std::enable_if<!IsUnknownCodec, ValueType>::type
2086template <
typename ValueType,
typename CodecType>
2089 return mArray->isUniform();
2092template <
typename ValueType,
typename CodecType>
2095 return mArray->hasConstantStride();
2102template <
typename ValueType,
typename CodecType>
2110template <
typename ValueType,
typename CodecType>
2117template <
typename ValueType,
typename CodecType>
2120 this->set<std::is_same<CodecType, UnknownCodec>::value>(this->index(n, 0), value);
2123template <
typename ValueType,
typename CodecType>
2126 this->set<std::is_same<CodecType, UnknownCodec>::value>(this->index(n, m), value);
2129template <
typename ValueType,
typename CodecType>
2135template <
typename ValueType,
typename CodecType>
2141template <
typename ValueType,
typename CodecType>
2147template <
typename ValueType,
typename CodecType>
2150 this->mCollapser(
const_cast<AttributeArray*
>(this->mArray), uniformValue);
2153template <
typename ValueType,
typename CodecType>
2159template <
typename ValueType,
typename CodecType>
2160template <
bool IsUnknownCodec>
2161typename std::enable_if<IsUnknownCodec, void>::type
2166 (*this->mSetter)(
const_cast<AttributeArray*
>(this->mArray), index, value);
2169template <
typename ValueType,
typename CodecType>
2170template <
bool IsUnknownCodec>
2171typename std::enable_if<!IsUnknownCodec, void>::type
2179template <
typename ValueType,
typename CodecType>
#define OPENVDB_ASSERT(X)
Definition Assert.h:41
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:173
A Paging wrapper to std::istream that is responsible for reading from a given input stream and creati...
Definition StreamCompression.h:208
PageHandle::Ptr createHandle(std::streamsize n)
Creates a PageHandle to access the next.
bool sizeOnly() const
Definition StreamCompression.h:218
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:221
A Paging wrapper to std::ostream that is responsible for writing from a given output stream at interv...
Definition StreamCompression.h:245
std::ostream & getOutputStream()
Set and get the output stream.
Definition StreamCompression.h:258
bool sizeOnly() const
Definition StreamCompression.h:255
PagedOutputStream & write(const char *str, std::streamsize n)
Writes the given.
T & x()
Reference to the component, e.g. v.x() = 4.5f;.
Definition Vec3.h:86
T & y()
Definition Vec3.h:87
T & z()
Definition Vec3.h:88
Definition AttributeArray.h:120
Base class for storing attribute data.
Definition AttributeArray.h:94
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:331
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:275
SerializationFlag
Definition AttributeArray.h:110
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:126
virtual ~AttributeArray()
Definition AttributeArray.h:134
compression::PageHandle::Ptr mPageHandle
Definition AttributeArray.h:372
Flag
Definition AttributeArray.h:102
AttributeArray()
Definition AttributeArray.h:133
virtual Index stride() const =0
bool isHidden() const
Return true if this attribute is hidden (e.g., from UI or iterators).
Definition AttributeArray.h:268
bool isType() const
Return true if this attribute is of the same type as the template parameter.
Definition AttributeArray.h:215
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.
uint8_t mFlags
Definition AttributeArray.h:367
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:289
bool hasValueType() const
Return true if this attribute has a value type the same as the template parameter.
Definition AttributeArray.h:219
std::atomic< Index32 > mOutOfCore
Definition AttributeArray.h:369
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:99
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 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 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:368
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:366
bool operator!=(const AttributeArray &other) const
Definition AttributeArray.h:328
bool isStreaming() const
Return true if this attribute is in streaming mode.
Definition AttributeArray.h:283
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:129
virtual Name codecType() const =0
Return the name of the codec used by this array (e.g., "trnc" or "fxpt").
virtual size_t memUsageIfLoaded() const =0
virtual void readMetadata(std::istream &)=0
Read attribute metadata from a stream.
std::shared_ptr< const AttributeArray > ConstPtr
Definition AttributeArray.h:127
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:286
virtual const NamePair & type() const =0
Return the name of this attribute's type.
size_t mCompressedBytes
Definition AttributeArray.h:373
bool mIsUniform
Definition AttributeArray.h:365
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:764
virtual ~AttributeHandle()
Definition AttributeArray.h:2019
Index size() const
Definition AttributeArray.h:786
void(*)(AttributeArray *array, const ValueType &value) ValuePtr
Definition AttributeArray.h:773
SetterPtr mSetter
Definition AttributeArray.h:801
Index stride() const
Definition AttributeArray.h:785
std::shared_ptr< Handle > Ptr
Definition AttributeArray.h:767
GetterPtr mGetter
Definition AttributeArray.h:800
void(*)(AttributeArray *array, const Index n, const ValueType &value) SetterPtr
Definition AttributeArray.h:772
static Ptr create(const AttributeArray &array, const bool collapseOnDestruction=true)
Definition AttributeArray.h:1984
AttributeHandle(const AttributeArray &array, const bool collapseOnDestruction=true)
Definition AttributeArray.h:1991
ValuePtr mFiller
Definition AttributeArray.h:803
ValueType get(Index n, Index m=0) const
Definition AttributeArray.h:2061
ValueType(*)(const AttributeArray *array, const Index n) GetterPtr
Definition AttributeArray.h:771
AttributeHandle(const AttributeHandle &)=default
ValuePtr mCollapser
Definition AttributeArray.h:802
const AttributeArray & array() const
Definition AttributeArray.h:2046
const AttributeArray * mArray
Definition AttributeArray.h:798
bool isUniform() const
Definition AttributeArray.h:2087
std::unique_ptr< Handle > UniquePtr
Definition AttributeArray.h:768
bool hasConstantStride() const
Definition AttributeArray.h:2093
AttributeHandle & operator=(const AttributeHandle &)=default
Index index(Index n, Index m) const
Definition AttributeArray.h:2053
Write-able version of AttributeHandle.
Definition AttributeArray.h:835
virtual ~AttributeWriteHandle()=default
AttributeWriteHandle(AttributeArray &array, const bool expand=true)
Definition AttributeArray.h:2111
std::shared_ptr< Handle > Ptr
Definition AttributeArray.h:838
bool compact()
Compact the existing array to become uniform if all values are identical.
Definition AttributeArray.h:2142
void collapse()
Replace the existing array with a uniform value (zero if none provided).
Definition AttributeArray.h:2136
void set(Index n, const ValueType &value)
Definition AttributeArray.h:2118
void expand(bool fill=true)
If this array is uniform, replace it with an array of length size().
Definition AttributeArray.h:2130
AttributeArray & array()
Definition AttributeArray.h:2180
std::unique_ptr< Handle > ScopedPtr
Definition AttributeArray.h:839
static Ptr create(AttributeArray &array, const bool expand=true)
Definition AttributeArray.h:2104
void set(Index n, Index m, const ValueType &value)
Definition AttributeArray.h:2124
void fill(const ValueType &value)
Fill the existing array with the given value.
Definition AttributeArray.h:2154
void collapse(const ValueType &uniformValue)
Definition AttributeArray.h:2148
Typed class for storing attribute data.
Definition AttributeArray.h:512
Index valueTypeSize() const override
Return the size in bytes of the value type of a single element in this array.
Definition AttributeArray.h:590
size_t memUsageIfLoaded() const override
Definition AttributeArray.h:1312
ValueType getUnsafe(Index n) const
Return the value at index n (assumes in-core)
Definition AttributeArray.h:1320
bool isUniform() const override
Return true if this array is stored as a single uniform value.
Definition AttributeArray.h:647
void readBuffers(std::istream &) override
Read attribute buffers from a stream.
Definition AttributeArray.h:1623
std::shared_ptr< TypedAttributeArray > Ptr
Definition AttributeArray.h:514
AccessorBasePtr getAccessor() const override
Obtain an Accessor that stores getter and setter functors.
Definition AttributeArray.h:1883
void write(std::ostream &os, bool outputTransient) const override
Definition AttributeArray.h:1725
typename Codec::template Storage< ValueType >::Type StorageType
Definition AttributeArray.h:519
size_t memUsage() const override
Return the number of bytes of memory used by this attribute.
Definition AttributeArray.h:1304
ValueType_ ValueType
Definition AttributeArray.h:517
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:1058
bool isDataLoaded() const override
Return true if all data has been loaded.
Definition AttributeArray.h:1555
bool isOutOfCore() const
Return true if this buffer's values have not yet been read from disk.
Definition AttributeArray.h:1515
std::shared_ptr< const TypedAttributeArray > ConstPtr
Definition AttributeArray.h:515
bool valueTypeIsVector() const override
Return true if the value type is a vector.
Definition AttributeArray.h:1278
bool validData() const
Verify that data is not out-of-core or in a partially-read state.
Definition AttributeArray.h:719
bool compact() override
Compact the existing array to become uniform if all values are identical.
Definition AttributeArray.h:1443
static TypedAttributeArray & cast(AttributeArray &attributeArray)
Cast an AttributeArray to TypedAttributeArray<T>
Definition AttributeArray.h:1182
TypedAttributeArray & operator=(TypedAttributeArray &&)=delete
Move assignment operator disabled.
void writeBuffers(std::ostream &os, bool outputTransient) const override
Definition AttributeArray.h:1793
AttributeArray::Ptr copy() const override
Definition AttributeArray.h:1202
Index storageTypeSize() const override
Definition AttributeArray.h:594
bool valueTypeIsQuaternion() const override
Return true if the value type is a quaternion.
Definition AttributeArray.h:1286
void readPagedBuffers(compression::PagedInputStream &) override
Read attribute buffers from a paged stream.
Definition AttributeArray.h:1662
void set(Index n, const ValueType &value)
Set value at the given index n.
Definition AttributeArray.h:1384
TypedAttributeArray & operator=(const TypedAttributeArray &)
Definition AttributeArray.h:1108
static void registerType()
Register this attribute type along with a factory function.
Definition AttributeArray.h:1154
bool valueTypeIsFloatingPoint() const override
Return true if the value type is floating point.
Definition AttributeArray.h:1249
void writeMetadata(std::ostream &os, bool outputTransient, bool paged) const override
Definition AttributeArray.h:1734
static void unregisterType()
Remove this attribute type from the registry.
Definition AttributeArray.h:1162
const StorageType * data() const
Definition AttributeArray.h:716
void loadData() const override
Ensures all data is in-core.
Definition AttributeArray.h:1547
void read(std::istream &) override
Read attribute data from a stream.
Definition AttributeArray.h:1563
ValueType get(Index n) const
Return the value at index n.
Definition AttributeArray.h:1332
TypedAttributeArray(TypedAttributeArray &&)=delete
Move constructor disabled.
static const NamePair & attributeType()
Return the name of this attribute's type (includes codec)
Definition AttributeArray.h:1135
const NamePair & type() const override
Return the name of this attribute's type.
Definition AttributeArray.h:562
bool valueTypeIsClass() const override
Return true if the value type is a class (ie vector, matrix or quaternion return true)
Definition AttributeArray.h:1269
Index size() const override
Return the number of elements in this array.
Definition AttributeArray.h:572
void collapse() override
Replace the existing array with a uniform zero value.
Definition AttributeArray.h:1460
Index dataSize() const override
Return the size of the data in this array.
Definition AttributeArray.h:579
Codec_ Codec
Definition AttributeArray.h:518
~TypedAttributeArray() override
Definition AttributeArray.h:543
void expand(bool fill=true) override
Replace the single value storage with an array of length size().
Definition AttributeArray.h:1422
static bool isRegistered()
Return true if this attribute type is registered.
Definition AttributeArray.h:1146
bool valueTypeIsMatrix() const override
Return true if the value type is a matrix.
Definition AttributeArray.h:1295
StorageType * data()
Return the raw data buffer.
Definition AttributeArray.h:715
const StorageType * constData() const
Return the raw data buffer.
Definition AttributeArray.h:709
void fill(const ValueType &value)
Fill the existing array with the given value.
Definition AttributeArray.h:1490
Index stride() const override
Definition AttributeArray.h:576
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:1170
Name codecType() const override
Return the name of the codec used by this array (e.g., "trnc" or "fxpt").
Definition AttributeArray.h:587
void writePagedBuffers(compression::PagedOutputStream &os, bool outputTransient) const override
Definition AttributeArray.h:1835
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:584
void setUnsafe(Index n, const ValueType &value)
Set value at the given index n (assumes in-core)
Definition AttributeArray.h:1369
void readMetadata(std::istream &) override
Read attribute metadata from a stream.
Definition AttributeArray.h:1572
#define OPENVDB_LOG_WARN(message)
Log a warning message of the form 'someVar << "some text" << ...'.
Definition logging.h:256
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,...
@ COMPRESS_BLOSC
Definition Compression.h:57
bool isExactlyEqual(const T0 &a, const T1 &b)
Return true if a is exactly equal to b.
Definition Math.h:443
internal::half half
Definition Types.h:29
FloatT fixedPointToFloatingPoint(const IntegerT s)
Definition AttributeArray.h:62
IntegerT floatingPointToFixedPoint(const FloatT s)
Definition AttributeArray.h:51
std::string Name
Definition Name.h:19
Index32 Index
Definition Types.h:54
int16_t Int16
Definition Types.h:55
std::pair< Name, Name > NamePair
Definition AttributeArray.h:40
constexpr T zeroVal()
Return the value of type T that corresponds to zero.
Definition Math.h:70
uint64_t Index64
Definition Types.h:53
const char * typeNameAsString()
Definition Types.h:516
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:247
static ValueType get(GetterPtr functor, const AttributeArray *array, const Index n)
Getter that calls the supplied functor.
Definition AttributeArray.h:1967
void(*)(AttributeArray *array, const Index n, const ValueType &value) SetterPtr
Definition AttributeArray.h:1964
static void set(SetterPtr functor, AttributeArray *array, const Index n, const ValueType &value)
Setter that calls the supplied functor.
Definition AttributeArray.h:1972
ValueType(*)(const AttributeArray *array, const Index n) GetterPtr
Definition AttributeArray.h:1963
Accessor to call unsafe get and set methods based on templated Codec and Value.
Definition AttributeArray.h:1941
void(*)(AttributeArray *array, const Index n, const ValueType &value) SetterPtr
Definition AttributeArray.h:1943
static ValueType get(GetterPtr, const AttributeArray *array, const Index n)
Definition AttributeArray.h:1947
ValueType(*)(const AttributeArray *array, const Index n) GetterPtr
Definition AttributeArray.h:1942
static void set(SetterPtr, AttributeArray *array, const Index n, const ValueType &value)
Definition AttributeArray.h:1953
Accessor base class for AttributeArray storage where type is not available.
Definition AttributeArray.h:382
virtual ~AccessorBase()=default
Definition AttributeArray.h:388
SetterPtr mSetter
Definition AttributeArray.h:397
GetterPtr mGetter
Definition AttributeArray.h:396
void(*)(AttributeArray *array, const T &value) ValuePtr
Definition AttributeArray.h:391
T(*)(const AttributeArray *array, const Index n) GetterPtr
Definition AttributeArray.h:389
void(*)(AttributeArray *array, const Index n, const T &value) SetterPtr
Definition AttributeArray.h:390
ValuePtr mFiller
Definition AttributeArray.h:399
Accessor(GetterPtr getter, SetterPtr setter, ValuePtr collapser, ValuePtr filler)
Definition AttributeArray.h:393
ValuePtr mCollapser
Definition AttributeArray.h:398
Definition AttributeArray.h:480
typename attribute_traits::UIntTypeTrait< OneByte, T >::Type Type
Definition AttributeArray.h:480
Definition AttributeArray.h:478
static const char * name()
Definition AttributeArray.h:485
Definition AttributeArray.h:439
T Type
Definition AttributeArray.h:439
Definition AttributeArray.h:437
static const char * name()
Definition AttributeArray.h:443
Definition AttributeArray.h:460
static ValueType decode(const ValueType &value)
Definition AttributeArray.h:463
static ValueType encode(const ValueType &value)
Definition AttributeArray.h:462
static const char * name()
Definition AttributeArray.h:461
Definition AttributeArray.h:450
typename attribute_traits::TruncateTrait< T >::Type Type
Definition AttributeArray.h:450
Definition AttributeArray.h:448
static const char * name()
Definition AttributeArray.h:454
Definition AttributeArray.h:469
static ValueType decode(const ValueType &value)
Definition AttributeArray.h:472
static ValueType encode(const ValueType &value)
Definition AttributeArray.h:471
static const char * name()
Definition AttributeArray.h:470
Definition AttributeArray.h:497
StorageType Type
Definition AttributeArray.h:497
Definition AttributeArray.h:493
uint16_t StorageType
Definition AttributeArray.h:494
static const char * name()
Definition AttributeArray.h:501
Definition AttributeArray.h:433
math::half Type
Definition AttributeArray.h:409
short Type
Definition AttributeArray.h:410
Definition AttributeArray.h:408
uint16_t Type
Definition AttributeArray.h:418
uint8_t Type
Definition AttributeArray.h:417
Definition AttributeArray.h:416
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:218