Typed class for storing attribute data. More...
#include <openvdb/points/AttributeArray.h>
 
  
| Public Types | |
| using | Ptr = std::shared_ptr<TypedAttributeArray> | 
| using | ConstPtr = std::shared_ptr<const TypedAttributeArray> | 
| using | ValueType = ValueType_ | 
| using | Codec = Codec_ | 
| using | StorageType = typename Codec::template Storage<ValueType>::Type | 
| enum | Flag { TRANSIENT = 0x1 , HIDDEN = 0x2 , CONSTANTSTRIDE = 0x8 , STREAMING = 0x10 , PARTIALREAD = 0x20 } | 
| enum | SerializationFlag { WRITESTRIDED = 0x1 , WRITEUNIFORM = 0x2 , WRITEMEMCOMPRESS = 0x4 , WRITEPAGED = 0x8 } | 
| using | FactoryMethod = Ptr (*)(Index, Index, bool, const Metadata*) | 
| Public Member Functions | |
| TypedAttributeArray (Index n=1, Index strideOrTotalSize=1, bool constantStride=true, const ValueType &uniformValue=zeroVal< ValueType >()) | |
| Default constructor, always constructs a uniform attribute. | |
| TypedAttributeArray (const TypedAttributeArray &) | |
| TypedAttributeArray & | operator= (const TypedAttributeArray &) | 
| TypedAttributeArray (TypedAttributeArray &&)=delete | |
| Move constructor disabled. | |
| TypedAttributeArray & | operator= (TypedAttributeArray &&)=delete | 
| Move assignment operator disabled. | |
| ~TypedAttributeArray () override | |
| AttributeArray::Ptr | copy () const override | 
| const NamePair & | type () const override | 
| Return the name of this attribute's type. | |
| Index | size () const override | 
| Return the number of elements in this array. | |
| Index | stride () const override | 
| Index | dataSize () const override | 
| Return the size of the data in this array. | |
| Name | valueType () const override | 
| Return the name of the value type of a single element in this array (e.g., "float" or "vec3d"). | |
| Name | codecType () const override | 
| Return the name of the codec used by this array (e.g., "trnc" or "fxpt"). | |
| Index | valueTypeSize () const override | 
| Return the size in bytes of the value type of a single element in this array. | |
| Index | storageTypeSize () const override | 
| bool | valueTypeIsFloatingPoint () const override | 
| Return trueif the value type is floating point. | |
| bool | valueTypeIsClass () const override | 
| Return trueif the value type is a class (ie vector, matrix or quaternion return true) | |
| bool | valueTypeIsVector () const override | 
| Return trueif the value type is a vector. | |
| bool | valueTypeIsQuaternion () const override | 
| Return trueif the value type is a quaternion. | |
| bool | valueTypeIsMatrix () const override | 
| Return trueif the value type is a matrix. | |
| size_t | memUsage () const override | 
| Return the number of bytes of memory used by this attribute. | |
| size_t | memUsageIfLoaded () const override | 
| ValueType | getUnsafe (Index n) const | 
| Return the value at index n (assumes in-core) | |
| ValueType | get (Index n) const | 
| Return the value at index n. | |
| template<typename T> | |
| void | getUnsafe (Index n, T &value) const | 
| Return the value at index n (assumes in-core) | |
| template<typename T> | |
| void | get (Index n, T &value) const | 
| Return the value at index n. | |
| void | setUnsafe (Index n, const ValueType &value) | 
| Set value at the given index n (assumes in-core) | |
| void | set (Index n, const ValueType &value) | 
| Set value at the given index n. | |
| template<typename T> | |
| void | setUnsafe (Index n, const T &value) | 
| Set value at the given index n (assumes in-core) | |
| template<typename T> | |
| void | set (Index n, const T &value) | 
| Set value at the given index n. | |
| bool | isUniform () const override | 
| Return trueif this array is stored as a single uniform value. | |
| void | expand (bool fill=true) override | 
| Replace the single value storage with an array of length size(). | |
| void | collapse () override | 
| Replace the existing array with a uniform zero value. | |
| bool | compact () override | 
| Compact the existing array to become uniform if all values are identical. | |
| void | collapse (const ValueType &uniformValue) | 
| Replace the existing array with the given uniform value. | |
| void | fill (const ValueType &value) | 
| Fill the existing array with the given value. | |
| void | read (std::istream &) override | 
| Read attribute data from a stream. | |
| void | write (std::ostream &os, bool outputTransient) const override | 
| void | write (std::ostream &) const override | 
| Write attribute data to a stream, don't write transient attributes. | |
| void | readMetadata (std::istream &) override | 
| Read attribute metadata from a stream. | |
| void | writeMetadata (std::ostream &os, bool outputTransient, bool paged) const override | 
| void | readBuffers (std::istream &) override | 
| Read attribute buffers from a stream. | |
| void | writeBuffers (std::ostream &os, bool outputTransient) const override | 
| void | readPagedBuffers (compression::PagedInputStream &) override | 
| Read attribute buffers from a paged stream. | |
| void | writePagedBuffers (compression::PagedOutputStream &os, bool outputTransient) const override | 
| bool | isOutOfCore () const | 
| Return trueif this buffer's values have not yet been read from disk. | |
| void | loadData () const override | 
| Ensures all data is in-core. | |
| bool | isDataLoaded () const override | 
| Return trueif all data has been loaded. | |
| const StorageType * | constData () const | 
| Return the raw data buffer. | |
| template<typename AttributeArrayType> | |
| bool | isType () const | 
| Return trueif this attribute is of the same type as the template parameter. | |
| template<typename ValueType> | |
| bool | hasValueType () const | 
| Return trueif this attribute has a value type the same as the template parameter. | |
| template<typename IterT> | |
| void | copyValuesUnsafe (const AttributeArray &sourceArray, const IterT &iter) | 
| Copy values into this array from a source array to a target array as referenced by an iterator. | |
| template<typename IterT> | |
| void | copyValues (const AttributeArray &sourceArray, const IterT &iter, bool compact=true) | 
| Like copyValuesUnsafe(), but if compact is true, attempt to collapse this array. | |
| void | setHidden (bool state) | 
| Specify whether this attribute should be hidden (e.g., from UI or iterators). | |
| bool | isHidden () const | 
| Return trueif this attribute is hidden (e.g., from UI or iterators). | |
| void | setTransient (bool state) | 
| Specify whether this attribute should only exist in memory and not be serialized during stream output. | |
| bool | isTransient () const | 
| Return trueif this attribute is not serialized during stream output. | |
| void | setStreaming (bool state) | 
| Specify whether this attribute is to be streamed off disk, in which case, the attributes are collapsed after being first loaded leaving them in a destroyed state. | |
| bool | isStreaming () const | 
| Return trueif this attribute is in streaming mode. | |
| bool | hasConstantStride () const | 
| Return trueif this attribute has a constant stride. | |
| uint8_t | flags () const | 
| Retrieve the attribute array flags. | |
| bool | operator== (const AttributeArray &other) const | 
| bool | operator!= (const AttributeArray &other) const | 
| const char * | constDataAsByteArray () const | 
| Indirect virtual function to retrieve the data buffer cast to a char byte array. | |
| Static Public Member Functions | |
| 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. | |
| static TypedAttributeArray & | cast (AttributeArray &attributeArray) | 
| Cast an AttributeArray to TypedAttributeArray<T> | |
| static const TypedAttributeArray & | cast (const AttributeArray &attributeArray) | 
| Cast an AttributeArray to TypedAttributeArray<T> | |
| static const NamePair & | attributeType () | 
| Return the name of this attribute's type (includes codec) | |
| static bool | isRegistered () | 
| Return trueif this attribute type is registered. | |
| static void | registerType () | 
| Register this attribute type along with a factory function. | |
| static void | unregisterType () | 
| Remove this attribute type from the registry. | |
| static ValueType | getUnsafe (const AttributeArray *array, const Index n) | 
| static void | setUnsafe (AttributeArray *array, const Index n, const ValueType &value) | 
| static void | collapse (AttributeArray *array, const ValueType &value) | 
| Non-member equivalent to collapse() that static_casts array to this TypedAttributeArray. | |
| static void | fill (AttributeArray *array, const ValueType &value) | 
| Non-member equivalent to fill() that static_casts array to this TypedAttributeArray. | |
| static Ptr | create (const NamePair &type, Index length, Index stride=1, bool constantStride=true, const Metadata *metadata=nullptr, const ScopedRegistryLock *lock=nullptr) | 
| static bool | isRegistered (const NamePair &type, const ScopedRegistryLock *lock=nullptr) | 
| Return trueif the given attribute type name is registered. | |
| static void | clearRegistry (const ScopedRegistryLock *lock=nullptr) | 
| Clear the attribute type registry. | |
| Protected Types | |
| using | AccessorBasePtr = std::shared_ptr<AccessorBase> | 
| Protected Member Functions | |
| AccessorBasePtr | getAccessor () const override | 
| Obtain an Accessor that stores getter and setter functors. | |
| StorageType * | data () | 
| Return the raw data buffer. | |
| const StorageType * | data () const | 
| bool | validData () const | 
| Verify that data is not out-of-core or in a partially-read state. | |
| void | setConstantStride (bool state) | 
| Specify whether this attribute has a constant stride or not. | |
| Static Protected Member Functions | |
| static void | registerType (const NamePair &type, FactoryMethod, const ScopedRegistryLock *lock=nullptr) | 
| Register a attribute type along with a factory function. | |
| static void | unregisterType (const NamePair &type, const ScopedRegistryLock *lock=nullptr) | 
| Remove a attribute type from the registry. | |
| Protected Attributes | ||
| bool | mIsUniform = true | |
| tbb::spin_mutex | mMutex | |
| uint8_t | mFlags = 0 | |
| uint8_t | mUsePagedRead = 0 | |
| std::atomic< Index32 > | mOutOfCore | |
| union { | ||
| compression::PageHandle::Ptr mPageHandle | ||
| size_t mCompressedBytes | ||
| }; | ||
| used for out-of-core, paged reading | ||
| Friends | |
| class | ::TestAttributeArray | 
Typed class for storing attribute data.
| 
 | protectedinherited | 
| using Codec = Codec_ | 
| using ConstPtr = std::shared_ptr<const TypedAttributeArray> | 
| 
 | inherited | 
| using Ptr = std::shared_ptr<TypedAttributeArray> | 
| using StorageType = typename Codec::template Storage<ValueType>::Type | 
| using ValueType = ValueType_ | 
| 
 | inherited | 
| 
 | inherited | 
| 
 | explicit | 
Default constructor, always constructs a uniform attribute.
| TypedAttributeArray | ( | const TypedAttributeArray< ValueType_, Codec_ > & | rhs | ) | 
Deep copy constructor.
| 
 | delete | 
Move constructor disabled.
| 
 | inlineoverride | 
| 
 | inlinestatic | 
Return the name of this attribute's type (includes codec)
| 
 | inlinestatic | 
Cast an AttributeArray to TypedAttributeArray<T>
| 
 | inlinestatic | 
Cast an AttributeArray to TypedAttributeArray<T>
| 
 | staticinherited | 
Clear the attribute type registry.
| 
 | inlineoverridevirtual | 
Return the name of the codec used by this array (e.g., "trnc" or "fxpt").
Implements AttributeArray.
| 
 | overridevirtual | 
Replace the existing array with a uniform zero value.
Implements AttributeArray.
| 
 | static | 
Non-member equivalent to collapse() that static_casts array to this TypedAttributeArray.
| void collapse | ( | const ValueType & | uniformValue | ) | 
Replace the existing array with the given uniform value.
| 
 | overridevirtual | 
Compact the existing array to become uniform if all values are identical.
Implements AttributeArray.
| 
 | inline | 
Return the raw data buffer.
| 
 | inlineinherited | 
Indirect virtual function to retrieve the data buffer cast to a char byte array.
| 
 | overridevirtual | 
| 
 | inherited | 
Like copyValuesUnsafe(), but if compact is true, attempt to collapse this array.
| 
 | inherited | 
Copy values into this array from a source array to a target array as referenced by an iterator.
Iterators must adhere to the ForwardIterator interface described in the example below:
| 
 | staticinherited | 
Create a new attribute array of the given (registered) type, length and stride.
If lock is non-null, the AttributeArray registry mutex has already been locked
| 
 | inlinestatic | 
Return a new attribute array of the given length n and stride with uniform value zero.
| 
 | inlineprotected | 
Return the raw data buffer.
| 
 | inlineprotected | 
| 
 | inlineoverridevirtual | 
Return the size of the data in this array.
Implements AttributeArray.
| 
 | overridevirtual | 
Replace the single value storage with an array of length size().
| fill | toggle to initialize the array elements with the pre-expanded value. | 
Implements AttributeArray.
| 
 | static | 
Non-member equivalent to fill() that static_casts array to this TypedAttributeArray.
| void fill | ( | const ValueType & | value | ) | 
Fill the existing array with the given value.
| 
 | inlineinherited | 
Retrieve the attribute array flags.
| TypedAttributeArray< ValueType_, Codec_ >::ValueType get | ( | Index | n | ) | const | 
Return the value at index n.
| void get | ( | Index | n, | 
| T & | value ) const | 
Return the value at index n.
| 
 | overrideprotectedvirtual | 
Obtain an Accessor that stores getter and setter functors.
Implements AttributeArray.
| 
 | static | 
Non-member equivalent to getUnsafe() that static_casts array to this TypedAttributeArray (assumes in-core)
| TypedAttributeArray< ValueType_, Codec_ >::ValueType getUnsafe | ( | Index | n | ) | const | 
Return the value at index n (assumes in-core)
| void getUnsafe | ( | Index | n, | 
| T & | value ) const | 
Return the value at index n (assumes in-core)
| 
 | inlineinherited | 
Return true if this attribute has a constant stride. 
| 
 | inlineinherited | 
Return true if this attribute has a value type the same as the template parameter. 
| 
 | overridevirtual | 
Return true if all data has been loaded. 
Implements AttributeArray.
| 
 | inlineinherited | 
Return true if this attribute is hidden (e.g., from UI or iterators). 
| 
 | inline | 
Return true if this buffer's values have not yet been read from disk. 
| 
 | staticinherited | 
Return true if the given attribute type name is registered. 
| 
 | inlinestatic | 
Return true if this attribute type is registered. 
| 
 | inlineinherited | 
Return true if this attribute is in streaming mode. 
| 
 | inlineinherited | 
Return true if this attribute is not serialized during stream output. 
| 
 | inlineinherited | 
Return true if this attribute is of the same type as the template parameter. 
| 
 | inlineoverridevirtual | 
Return true if this array is stored as a single uniform value. 
Implements AttributeArray.
| 
 | overridevirtual | 
Ensures all data is in-core.
Implements AttributeArray.
| 
 | overridevirtual | 
Return the number of bytes of memory used by this attribute.
Implements AttributeArray.
| 
 | overridevirtual | 
Return the number of bytes of memory used by this attribute array once it has been deserialized (this may be different to memUsage() if delay-loading is in use). Note that this method does NOT consider the fact that a uniform attribute could be expanded and only deals with delay-loading.
Implements AttributeArray.
| 
 | inlineinherited | 
| TypedAttributeArray< ValueType_, Codec_ > & operator= | ( | const TypedAttributeArray< ValueType_, Codec_ > & | rhs | ) | 
Deep copy assignment operator.
| 
 | delete | 
Move assignment operator disabled.
| 
 | inherited | 
Check the compressed bytes and flags. If they are equal, perform a deeper comparison check necessary on the inherited types (TypedAttributeArray) Requires non operator implementation due to inheritance
| 
 | overridevirtual | 
Read attribute data from a stream.
Implements AttributeArray.
| 
 | overridevirtual | 
Read attribute buffers from a stream.
Implements AttributeArray.
| 
 | overridevirtual | 
Read attribute metadata from a stream.
Implements AttributeArray.
| 
 | overridevirtual | 
Read attribute buffers from a paged stream.
Implements AttributeArray.
| 
 | staticprotectedinherited | 
Register a attribute type along with a factory function.
| 
 | inlinestatic | 
Register this attribute type along with a factory function.
| void set | ( | Index | n, | 
| const T & | value ) | 
Set value at the given index n.
Set value at the given index n.
| 
 | protectedinherited | 
Specify whether this attribute has a constant stride or not.
| 
 | inherited | 
Specify whether this attribute should be hidden (e.g., from UI or iterators).
This is useful if the attribute is used for blind data or as scratch space for a calculation.
| 
 | inherited | 
Specify whether this attribute is to be streamed off disk, in which case, the attributes are collapsed after being first loaded leaving them in a destroyed state.
| 
 | inherited | 
Specify whether this attribute should only exist in memory and not be serialized during stream output.
| 
 | static | 
Non-member equivalent to setUnsafe() that static_casts array to this TypedAttributeArray (assumes in-core)
| void setUnsafe | ( | Index | n, | 
| const T & | value ) | 
Set value at the given index n (assumes in-core)
Set value at the given index n (assumes in-core)
| 
 | inlineoverridevirtual | 
Return the number of elements in this array.
Implements AttributeArray.
| 
 | inlineoverridevirtual | 
Return the size in bytes of the storage type of a single element of this array.
Implements AttributeArray.
| 
 | inlineoverridevirtual | 
Return the stride of this array.
Implements AttributeArray.
| 
 | inlineoverridevirtual | 
Return the name of this attribute's type.
Implements AttributeArray.
| 
 | staticprotectedinherited | 
Remove a attribute type from the registry.
| 
 | inlinestatic | 
Remove this attribute type from the registry.
| 
 | inlineprotected | 
Verify that data is not out-of-core or in a partially-read state.
| 
 | inlineoverridevirtual | 
Return the name of the value type of a single element in this array (e.g., "float" or "vec3d").
Implements AttributeArray.
| 
 | overridevirtual | 
Return true if the value type is a class (ie vector, matrix or quaternion return true) 
Implements AttributeArray.
| 
 | overridevirtual | 
Return true if the value type is floating point. 
Implements AttributeArray.
| 
 | overridevirtual | 
Return true if the value type is a matrix. 
Implements AttributeArray.
| 
 | overridevirtual | 
Return true if the value type is a quaternion. 
Implements AttributeArray.
| 
 | overridevirtual | 
Return true if the value type is a vector. 
Implements AttributeArray.
| 
 | inlineoverridevirtual | 
Return the size in bytes of the value type of a single element in this array.
Implements AttributeArray.
| 
 | overridevirtual | 
Write attribute data to a stream, don't write transient attributes.
Implements AttributeArray.
| 
 | overridevirtual | 
Write attribute data to a stream.
| os | the output stream | 
| outputTransient | if true, write out transient attributes | 
Implements AttributeArray.
| 
 | overridevirtual | 
Write attribute buffers to a stream.
| os | the output stream | 
| outputTransient | if true, write out transient attributes | 
Implements AttributeArray.
| 
 | overridevirtual | 
Write attribute metadata to a stream.
| os | the output stream | 
| outputTransient | if true, write out transient attributes | 
| paged | if true, data is written out in pages | 
Implements AttributeArray.
| 
 | overridevirtual | 
Write attribute buffers to a paged stream.
| os | the output stream | 
| outputTransient | if true, write out transient attributes | 
Implements AttributeArray.
| 
 | friend | 
| union { ... } | 
used for out-of-core, paged reading
| 
 | inherited | 
| 
 | protectedinherited | 
| 
 | protectedinherited | 
| 
 | mutableprotectedinherited | 
| 
 | protectedinherited | 
| 
 | inherited | 
| 
 | protectedinherited |