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
15 #include <unordered_set>
16 #include <unordered_map>
31 namespace attribute_traits
38 template <
bool Truncate>
46 template<
typename StorageType>
static void decode(
const StorageType&,
ValueType&);
47 template<
typename StorageType>
static void encode(
const ValueType&, StorageType&);
48 static const char*
name() {
return Truncate ?
"str_trnc" :
"str"; }
64 void insert(
const Name& name);
71 std::vector<std::pair<Index, Index>> mIdBlocks;
72 std::unordered_set<Name> mValues;
79 template <
bool Truncate>
80 template<
typename StorageType>
84 val = static_cast<ValueType>(data);
88 template <
bool Truncate>
89 template<
typename StorageType>
93 data = static_cast<ValueType>(val);
112 using Ptr = std::shared_ptr<StringAttributeHandle>;
118 const bool preserveCompression =
true);
144 using Ptr = std::shared_ptr<StringAttributeWriteHandle>;
150 const bool expand =
true);
154 void expand(
bool fill =
true);
160 void collapse(
const Name& name);
167 void fill(
const Name& name);
181 bool contains(
const Name& name)
const;
188 using ValueMap = std::unordered_map<std::string, Index>;
202 #endif // OPENVDB_POINTS_ATTRIBUTE_ARRAY_STRING_HAS_BEEN_INCLUDED
AttributeHandle< StringIndexType, StringCodec< false > > mHandle
Definition: AttributeArrayString.h:133
Index stride() const
Definition: AttributeArrayString.h:120
Definition: AttributeArrayString.h:109
Base class for storing attribute data.
Definition: AttributeArray.h:92
Definition: AttributeArrayString.h:39
std::shared_ptr< StringAttributeHandle > Ptr
Definition: AttributeArrayString.h:112
uint32_t StringIndexType
Definition: AttributeArrayString.h:28
uint16_t Type
Definition: AttributeArrayString.h:34
typename attribute_traits::StringTypeTrait< Truncate >::Type Type
Definition: AttributeArrayString.h:44
Attribute Array storage templated on type and compression codec.
StringIndexType Type
Definition: AttributeArrayString.h:33
Definition: AttributeArrayString.h:141
Write-able version of AttributeHandle.
Definition: AttributeArray.h:920
bool isUniform() const
Definition: AttributeArrayString.h:123
Typed class for storing attribute data.
Definition: AttributeArray.h:566
Definition: AttributeArrayString.h:33
StringIndexType ValueType
Definition: AttributeArrayString.h:41
Index size() const
Definition: AttributeArrayString.h:121
bool hasConstantStride() const
Definition: AttributeArrayString.h:124
Definition: AttributeArray.h:849
bool isType() const
Return true if this attribute is of the same type as the template parameter.
Definition: AttributeArray.h:224
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:154
static const char * name()
Definition: AttributeArrayString.h:48
const MetaMap & mMetadata
Definition: AttributeArrayString.h:134
Index32 Index
Definition: Types.h:31
std::string Name
Definition: Name.h:17
Definition: AttributeArrayString.h:44
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:102
Definition: Exceptions.h:13
bool isString(const AttributeArray &array)
Definition: AttributeArrayString.h:100
Type Truncate(Type x, unsigned int digits)
Return x truncated to the given number of decimal digits.
Definition: Math.h:817