Base class for storing attribute data. More...
#include <openvdb/points/AttributeArray.h>
 
  
| Classes | |
| struct | Accessor | 
| struct | AccessorBase | 
| Accessor base class for AttributeArray storage where type is not available.  More... | |
| class | ScopedRegistryLock | 
| Public Types | |
| enum | Flag { TRANSIENT = 0x1 , HIDDEN = 0x2 , CONSTANTSTRIDE = 0x8 , STREAMING = 0x10 , PARTIALREAD = 0x20 } | 
| enum | SerializationFlag { WRITESTRIDED = 0x1 , WRITEUNIFORM = 0x2 , WRITEMEMCOMPRESS = 0x4 , WRITEPAGED = 0x8 } | 
| using | Ptr = std::shared_ptr<AttributeArray> | 
| using | ConstPtr = std::shared_ptr<const AttributeArray> | 
| using | FactoryMethod = Ptr (*)(Index, Index, bool, const Metadata*) | 
| Public Member Functions | |
| AttributeArray () | |
| virtual | ~AttributeArray () | 
| AttributeArray (const AttributeArray &rhs) | |
| AttributeArray & | operator= (const AttributeArray &rhs) | 
| AttributeArray (AttributeArray &&)=delete | |
| AttributeArray & | operator= (AttributeArray &&)=delete | 
| virtual AttributeArray::Ptr | copy () const =0 | 
| Return a copy of this attribute. | |
| virtual Index | size () const =0 | 
| virtual Index | stride () const =0 | 
| virtual Index | dataSize () const =0 | 
| virtual Name | valueType () const =0 | 
| Return the name of the value type of a single element in this array (e.g., "float" or "vec3d"). | |
| virtual Name | codecType () const =0 | 
| Return the name of the codec used by this array (e.g., "trnc" or "fxpt"). | |
| virtual Index | valueTypeSize () const =0 | 
| virtual Index | storageTypeSize () const =0 | 
| virtual bool | valueTypeIsFloatingPoint () const =0 | 
| Return trueif the value type is floating point. | |
| virtual bool | valueTypeIsClass () const =0 | 
| Return trueif the value type is a class (ie vector, matrix or quaternion return true) | |
| virtual bool | valueTypeIsVector () const =0 | 
| Return trueif the value type is a vector. | |
| virtual bool | valueTypeIsQuaternion () const =0 | 
| Return trueif the value type is a quaternion. | |
| virtual bool | valueTypeIsMatrix () const =0 | 
| Return trueif the value type is a matrix. | |
| virtual size_t | memUsage () const =0 | 
| Return the number of bytes of memory used by this attribute. | |
| virtual size_t | memUsageIfLoaded () const =0 | 
| virtual const NamePair & | type () const =0 | 
| Return the name of this attribute's type. | |
| 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. | |
| virtual bool | isUniform () const =0 | 
| Return trueif this array is stored as a single uniform value. | |
| virtual void | expand (bool fill=true)=0 | 
| If this array is uniform, replace it with an array of length size(). | |
| virtual void | collapse ()=0 | 
| Replace the existing array with a uniform zero value. | |
| virtual bool | compact ()=0 | 
| Compact the existing array to become uniform if all values are identical. | |
| 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. | |
| virtual void | read (std::istream &)=0 | 
| Read attribute metadata and buffers from a stream. | |
| virtual void | write (std::ostream &, bool outputTransient) const =0 | 
| virtual void | write (std::ostream &) const =0 | 
| Write attribute metadata and buffers to a stream, don't write transient attributes. | |
| virtual void | readMetadata (std::istream &)=0 | 
| Read attribute metadata from a stream. | |
| virtual void | writeMetadata (std::ostream &, bool outputTransient, bool paged) const =0 | 
| virtual void | readBuffers (std::istream &)=0 | 
| Read attribute buffers from a stream. | |
| virtual void | writeBuffers (std::ostream &, bool outputTransient) const =0 | 
| virtual void | readPagedBuffers (compression::PagedInputStream &)=0 | 
| Read attribute buffers from a paged stream. | |
| virtual void | writePagedBuffers (compression::PagedOutputStream &, bool outputTransient) const =0 | 
| virtual void | loadData () const =0 | 
| Ensures all data is in-core. | |
| virtual bool | isDataLoaded () const =0 | 
| Return trueif all data has been loaded. | |
| 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 (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 | |
| AttributeArray (const AttributeArray &rhs, const tbb::spin_mutex::scoped_lock &) | |
| void | setConstantStride (bool state) | 
| Specify whether this attribute has a constant stride or not. | |
| virtual AccessorBasePtr | getAccessor () const =0 | 
| Obtain an Accessor that stores getter and setter functors. | |
| 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 | |
| template<typename ValueType, typename CodecType> | |
| class | AttributeHandle | 
| class | ::TestAttributeArray | 
Base class for storing attribute data.
| 
 | protected | 
| using ConstPtr = std::shared_ptr<const AttributeArray> | 
| using FactoryMethod = Ptr (*)(Index, Index, bool, const Metadata*) | 
| using Ptr = std::shared_ptr<AttributeArray> | 
| enum Flag | 
| enum SerializationFlag | 
| 
 | inline | 
| 
 | inlinevirtual | 
| AttributeArray | ( | const AttributeArray & | rhs | ) | 
| 
 | delete | 
| 
 | protected | 
| 
 | static | 
Clear the attribute type registry.
| 
 | pure virtual | 
Return the name of the codec used by this array (e.g., "trnc" or "fxpt").
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Replace the existing array with a uniform zero value.
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Compact the existing array to become uniform if all values are identical.
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | inline | 
Indirect virtual function to retrieve the data buffer cast to a char byte array.
| 
 | pure virtual | 
Return a copy of this attribute.
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| void copyValues | ( | const AttributeArray & | sourceArray, | 
| const IterT & | iter, | ||
| bool | compact = true ) | 
Like copyValuesUnsafe(), but if compact is true, attempt to collapse this array.
| 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.
Iterators must adhere to the ForwardIterator interface described in the example below:
| 
 | static | 
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
| 
 | pure virtual | 
Return the total number of data elements in this array.
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
If this array is uniform, replace it with an array of length size().
| fill | if true, assign the uniform value to each element of the array. | 
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | inline | 
Retrieve the attribute array flags.
| 
 | protectedpure virtual | 
Obtain an Accessor that stores getter and setter functors.
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | inline | 
Return true if this attribute has a constant stride. 
| 
 | inline | 
Return true if this attribute has a value type the same as the template parameter. 
| 
 | pure virtual | 
Return true if all data has been loaded. 
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | inline | 
Return true if this attribute is hidden (e.g., from UI or iterators). 
| 
 | static | 
Return true if the given attribute type name is registered. 
| 
 | inline | 
Return true if this attribute is in streaming mode. 
| 
 | inline | 
Return true if this attribute is not serialized during stream output. 
| 
 | inline | 
Return true if this attribute is of the same type as the template parameter. 
| 
 | pure virtual | 
Return true if this array is stored as a single uniform value. 
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
| 
 | pure virtual | 
Return the number of bytes of memory used by this attribute.
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
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.
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | inline | 
| 
 | delete | 
| AttributeArray & operator= | ( | const AttributeArray & | rhs | ) | 
| bool operator== | ( | const AttributeArray & | other | ) | const | 
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
| 
 | pure virtual | 
Read attribute metadata and buffers from a stream.
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Read attribute buffers from a stream.
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Read attribute metadata from a stream.
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Read attribute buffers from a paged stream.
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | staticprotected | 
Register a attribute type along with a factory function.
| 
 | protected | 
Specify whether this attribute has a constant stride or not.
| void setHidden | ( | bool | state | ) | 
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.
| 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.
| void setTransient | ( | bool | state | ) | 
Specify whether this attribute should only exist in memory and not be serialized during stream output.
| 
 | pure virtual | 
Return the number of elements in this array.
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Return the size in bytes of the storage type of a single element of this array.
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Return the stride of this array.
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Return the name of this attribute's type.
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | staticprotected | 
Remove a attribute type from the registry.
| 
 | pure virtual | 
Return the name of the value type of a single element in this array (e.g., "float" or "vec3d").
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Return true if the value type is a class (ie vector, matrix or quaternion return true) 
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Return true if the value type is floating point. 
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Return true if the value type is a matrix. 
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Return true if the value type is a quaternion. 
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Return true if the value type is a vector. 
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Return the size in bytes of the value type of a single element in this array. (e.g. "float" -> 4 bytes, "vec3d" -> 24 bytes").
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Write attribute metadata and buffers to a stream, don't write transient attributes.
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Write attribute metadata and buffers to a stream.
| outputTransient | if true, write out transient attributes | 
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Write attribute buffers to a stream.
| outputTransient | if true, write out transient attributes | 
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Write attribute metadata to a stream.
| outputTransient | if true, write out transient attributes | 
| paged | if true, data is written out in pages | 
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | pure virtual | 
Write attribute buffers to a paged stream.
| outputTransient | if true, write out transient attributes | 
Implemented in TypedAttributeArray< ValueType_, Codec_ >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< GroupType, GroupCodec >, TypedAttributeArray< Index, StringCodec< false > >, and TypedAttributeArray< Index, StringCodec< false > >.
| 
 | friend | 
| 
 | friend | 
| union { ... } | 
used for out-of-core, paged reading
| size_t mCompressedBytes | 
| 
 | protected | 
| 
 | protected | 
| 
 | mutableprotected | 
| 
 | protected | 
| compression::PageHandle::Ptr mPageHandle | 
| 
 | protected |