Go to the documentation of this file.
37 #ifndef OPENVDB_POINTS_ATTRIBUTE_ARRAY_STRING_HAS_BEEN_INCLUDED
38 #define OPENVDB_POINTS_ATTRIBUTE_ARRAY_STRING_HAS_BEEN_INCLUDED
56 namespace attribute_traits
63 template <
bool Truncate>
71 template<
typename StorageType>
static void decode(
const StorageType&,
ValueType&);
72 template<
typename StorageType>
static void encode(
const ValueType&, StorageType&);
73 static const char*
name() {
return Truncate ?
"str_trnc" :
"str"; }
96 std::vector<Index> mIndices;
97 std::vector<Name> mValues;
104 template <
bool Truncate>
105 template<
typename StorageType>
113 template <
bool Truncate>
114 template<
typename StorageType>
137 using Ptr = std::shared_ptr<StringAttributeHandle>;
143 const bool preserveCompression =
true);
163 using Ptr = std::shared_ptr<StringAttributeWriteHandle>;
169 const bool expand =
true);
200 using ValueMap = std::map<std::string, Index>;
214 #endif // OPENVDB_POINTS_ATTRIBUTE_ARRAY_STRING_HAS_BEEN_INCLUDED
StringIndexType ValueType
Definition: AttributeArrayString.h:66
Typed class for storing attribute data.
Definition: AttributeArray.h:442
AttributeHandle< StringIndexType, StringCodec< false > > mHandle
Definition: AttributeArrayString.h:152
Definition: AttributeArrayString.h:161
Definition: AttributeArrayString.h:135
bool isString(const AttributeArray &array)
Definition: AttributeArrayString.h:125
StringIndexType Type
Definition: AttributeArrayString.h:58
Definition: AttributeArrayString.h:65
void collapse()
Set membership for the whole array and attempt to collapse.
StringAttributeHandle(const AttributeArray &array, const MetaMap &metadata, const bool preserveCompression=true)
uint32_t StringIndexType
Definition: AttributeArrayString.h:53
Attribute Array storage templated on type and compression codec.
void get(Name &name, Index n, Index m=0) const
static const char * name()
Definition: AttributeArrayString.h:73
void collapse(const Name &name)
Set membership for the whole array and attempt to collapse.
Definition: AttributeArrayString.h:69
Base class for storing attribute data.
Definition: AttributeArray.h:119
std::shared_ptr< StringAttributeHandle > Ptr
Definition: AttributeArrayString.h:137
Definition: AttributeArray.h:645
Name get(Index n, Index m=0) const
void set(Index n, Index m, const Name &name)
bool isType() const
Return true if this attribute is of the same type as the template parameter.
Definition: AttributeArray.h:186
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)
Type Truncate(Type x, unsigned int digits)
Return x truncated to the given number of decimal digits.
Definition: Math.h:824
Index32 Index
Definition: Types.h:61
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:188
void fill(const Name &name)
Fill the existing array with the given value.
bool isUniform() const
Definition: AttributeArrayString.h:146
Definition: AttributeArrayString.h:58
Write-able version of AttributeHandle.
Definition: AttributeArray.h:716
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:136
std::string Name
Definition: Name.h:44
void expand(bool fill=true)
If this array is uniform, replace it with an array of length size().
uint16_t Type
Definition: AttributeArrayString.h:59
Index size() const
Definition: AttributeArrayString.h:145
const MetaMap & mMetadata
Definition: AttributeArrayString.h:153
Definition: Exceptions.h:40
StringAttributeWriteHandle(AttributeArray &array, const MetaMap &metadata, const bool expand=true)
void set(Index n, const Name &name)
Set the value of the index to name.
typename attribute_traits::StringTypeTrait< Truncate >::Type Type
Definition: AttributeArrayString.h:69
void resetCache()
Reset the value cache from the metadata.
static Ptr create(AttributeArray &array, const MetaMap &metadata, const bool expand=true)