10#ifndef OPENVDB_POINTS_ATTRIBUTE_ARRAY_STRING_HAS_BEEN_INCLUDED
11#define OPENVDB_POINTS_ATTRIBUTE_ARRAY_STRING_HAS_BEEN_INCLUDED
16#include <unordered_map>
28namespace attribute_traits
35template <
bool Truncate>
43 template<
typename StorageType>
static void decode(
const StorageType&,
ValueType&);
44 template<
typename StorageType>
static void encode(
const ValueType&, StorageType&);
45 static const char*
name() {
return Truncate ?
"str_trnc" :
"str"; }
60 using ValueMap = std::unordered_map<Name, Index>;
66 bool empty()
const {
return mCache.empty(); }
68 size_t size()
const {
return mCache.size(); }
91 using UniquePtr = std::unique_ptr<StringMetaInserter>;
112 using IndexPairArray = std::deque<std::pair<Index, Index>>;
115 IndexPairArray mIdBlocks;
123template <
bool Truncate>
124template<
typename StorageType>
132template <
bool Truncate>
133template<
typename StorageType>
156 using Ptr = std::shared_ptr<StringAttributeHandle>;
157 using UniquePtr = std::unique_ptr<StringAttributeHandle>;
163 const bool preserveCompression =
true);
189 using Ptr = std::shared_ptr<StringAttributeWriteHandle>;
190 using UniquePtr = std::unique_ptr<StringAttributeWriteHandle>;
196 const bool expand =
true);
Attribute Array storage templated on type and compression codec.
Base class for storing attribute data.
Definition AttributeArray.h:93
bool isType() const
Return true if this attribute is of the same type as the template parameter.
Definition AttributeArray.h:224
Definition AttributeArray.h:833
Write-able version of AttributeHandle.
Definition AttributeArray.h:904
Definition AttributeArrayString.h:154
AttributeHandle< Index, StringCodec< false > > mHandle
Definition AttributeArrayString.h:178
Index size() const
Definition AttributeArrayString.h:166
std::unique_ptr< StringAttributeHandle > UniquePtr
Definition AttributeArrayString.h:157
Index stride() const
Definition AttributeArrayString.h:165
Name get(Index n, Index m=0) const
std::shared_ptr< StringAttributeHandle > Ptr
Definition AttributeArrayString.h:156
static Ptr create(const AttributeArray &array, const MetaMap &metadata, const bool preserveCompression=true)
const MetaMap & mMetadata
Definition AttributeArrayString.h:179
StringAttributeHandle(const AttributeArray &array, const MetaMap &metadata, const bool preserveCompression=true)
const AttributeArray & array() const
Returns a reference to the array held in the Handle.
bool isUniform() const
Definition AttributeArrayString.h:168
bool hasConstantStride() const
Definition AttributeArrayString.h:169
void get(Name &name, Index n, Index m=0) const
Definition AttributeArrayString.h:187
void fill(const Name &name)
Fill the existing array with the given value.
bool contains(const Name &name) const
Returns whether or not the metadata cache contains a given value.
bool compact()
Compact the existing array to become uniform if all values are identical.
void collapse()
Set membership for the whole array and attempt to collapse.
void resetCache()
Reset the value cache from the metadata.
void collapse(const Name &name)
Set membership for the whole array and attempt to collapse.
std::shared_ptr< StringAttributeWriteHandle > Ptr
Definition AttributeArrayString.h:189
void expand(bool fill=true)
If this array is uniform, replace it with an array of length size().
AttributeArray & array()
Returns a reference to the array held in the Write Handle.
void set(Index n, Index m, const Name &name)
std::unique_ptr< StringAttributeWriteHandle > UniquePtr
Definition AttributeArrayString.h:190
void set(Index n, const Name &name)
Set the value of the index to name.
static Ptr create(AttributeArray &array, const MetaMap &metadata, const bool expand=true)
StringAttributeWriteHandle(AttributeArray &array, const MetaMap &metadata, const bool expand=true)
Typed class for storing attribute data.
Definition AttributeArray.h:545
bool isString(const AttributeArray &array)
Definition AttributeArrayString.h:144
std::string Name
Definition Name.h:19
Index32 Index
Definition Types.h:54
Definition Exceptions.h:13
Definition AttributeArrayString.h:41
typename attribute_traits::StringTypeTrait< Truncate >::Type Type
Definition AttributeArrayString.h:41
Definition AttributeArrayString.h:37
static const char * name()
Definition AttributeArrayString.h:45
Index ValueType
Definition AttributeArrayString.h:38
uint16_t Type
Definition AttributeArrayString.h:31
Definition AttributeArrayString.h:30
Index Type
Definition AttributeArrayString.h:30
#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:212