Go to the documentation of this file.
10 #ifndef OPENVDB_POINTS_ATTRIBUTE_ARRAY_STRING_HAS_BEEN_INCLUDED
11 #define OPENVDB_POINTS_ATTRIBUTE_ARRAY_STRING_HAS_BEEN_INCLUDED
16 #include <unordered_map>
31 using StringIndexType =
Index;
36 namespace attribute_traits
43 template <
bool Truncate>
51 template<
typename StorageType>
static void decode(
const StorageType&,
ValueType&);
52 template<
typename StorageType>
static void encode(
const ValueType&, StorageType&);
53 static const char*
name() {
return Truncate ?
"str_trnc" :
"str"; }
68 using ValueMap = std::unordered_map<Name, Index>;
74 bool empty()
const {
return mCache.empty(); }
76 size_t size()
const {
return mCache.size(); }
99 using UniquePtr = std::unique_ptr<StringMetaInserter>;
120 using IndexPairArray = std::deque<std::pair<Index, Index>>;
123 IndexPairArray mIdBlocks;
131 template <
bool Truncate>
132 template<
typename StorageType>
140 template <
bool Truncate>
141 template<
typename StorageType>
164 using Ptr = std::shared_ptr<StringAttributeHandle>;
165 using UniquePtr = std::unique_ptr<StringAttributeHandle>;
171 const bool preserveCompression =
true);
197 using Ptr = std::shared_ptr<StringAttributeWriteHandle>;
198 using UniquePtr = std::unique_ptr<StringAttributeWriteHandle>;
204 const bool expand =
true);
254 #endif // OPENVDB_POINTS_ATTRIBUTE_ARRAY_STRING_HAS_BEEN_INCLUDED
Definition: AttributeArrayString.h:49
void set(Index n, const Name &name)
Set the value of the index to name.
Index stride() const
Definition: AttributeArrayString.h:173
void resetCache()
Reset the value cache from the metadata.
Definition: AttributeArray.h:849
Definition: AttributeArrayString.h:195
std::shared_ptr< StringAttributeHandle > Ptr
Definition: AttributeArrayString.h:164
static const char * name()
Definition: AttributeArrayString.h:53
AttributeArray & array()
Returns a reference to the array held in the Write Handle.
void collapse()
Set membership for the whole array and attempt to collapse.
Index32 Index
Definition: Types.h:31
Index OPENVDB_DEPRECATED
Definition: AttributeArrayString.h:33
std::string Name
Definition: Name.h:17
Index Type
Definition: AttributeArrayString.h:38
bool isString(const AttributeArray &array)
Definition: AttributeArrayString.h:152
std::unique_ptr< StringAttributeHandle > UniquePtr
Definition: AttributeArrayString.h:165
uint16_t Type
Definition: AttributeArrayString.h:39
Write-able version of AttributeHandle.
Definition: AttributeArray.h:920
void collapse(const Name &name)
Set membership for the whole array and attempt to collapse.
Index ValueType
Definition: AttributeArrayString.h:46
Attribute Array storage templated on type and compression codec.
AttributeHandle< Index, StringCodec< false > > mHandle
Definition: AttributeArrayString.h:186
const AttributeArray & array() const
Returns a reference to the array held in the Handle.
void set(Index n, Index m, const Name &name)
bool contains(const Name &name) const
Returns whether or not the metadata cache contains a given value.
typename attribute_traits::StringTypeTrait< Truncate >::Type Type
Definition: AttributeArrayString.h:49
Typed class for storing attribute data.
Definition: AttributeArray.h:566
Definition: AttributeArrayString.h:38
bool isUniform() const
Definition: AttributeArrayString.h:176
Index size() const
Definition: AttributeArrayString.h:174
Definition: AttributeArrayString.h:45
bool hasConstantStride() const
Definition: AttributeArrayString.h:177
bool isType() const
Return true if this attribute is of the same type as the template parameter.
Definition: AttributeArray.h:225
StringAttributeHandle(const AttributeArray &array, const MetaMap &metadata, const bool preserveCompression=true)
Definition: AttributeArrayString.h:162
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:146
void expand(bool fill=true)
If this array is uniform, replace it with an array of length size().
Base class for storing attribute data.
Definition: AttributeArray.h:93
bool compact()
Compact the existing array to become uniform if all values are identical.
static Ptr create(const AttributeArray &array, const MetaMap &metadata, const bool preserveCompression=true)
const MetaMap & mMetadata
Definition: AttributeArrayString.h:187
Type Truncate(Type x, unsigned int digits)
Return x truncated to the given number of decimal digits.
Definition: Math.h:837
Name get(Index n, Index m=0) const
StringAttributeWriteHandle(AttributeArray &array, const MetaMap &metadata, const bool expand=true)
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:94
void fill(const Name &name)
Fill the existing array with the given value.
static Ptr create(AttributeArray &array, const MetaMap &metadata, const bool expand=true)
Definition: Exceptions.h:13
void get(Name &name, Index n, Index m=0) const