10 #ifndef OPENVDB_POINTS_ATTRIBUTE_ARRAY_STRING_HAS_BEEN_INCLUDED 11 #define OPENVDB_POINTS_ATTRIBUTE_ARRAY_STRING_HAS_BEEN_INCLUDED 16 #include <unordered_map> 28 namespace attribute_traits
35 template <
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(); }
71 void reset(
const MetaMap& metadata);
74 void insert(
const Name& key,
Index index);
91 using UniquePtr = std::unique_ptr<StringMetaInserter>;
96 bool hasKey(
const Name& key)
const;
98 bool hasIndex(
Index index)
const;
112 using IndexPairArray = std::deque<std::pair<Index, Index>>;
115 IndexPairArray mIdBlocks;
123 template <
bool Truncate>
124 template<
typename StorageType>
132 template <
bool Truncate>
133 template<
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);
200 void expand(
bool fill =
true);
206 void collapse(
const Name& name);
213 void fill(
const Name& name);
227 bool contains(
const Name& name)
const;
246 #endif // OPENVDB_POINTS_ATTRIBUTE_ARRAY_STRING_HAS_BEEN_INCLUDED
Index ValueType
Definition: AttributeArrayString.h:38
Type Truncate(Type x, unsigned int digits)
Return x truncated to the given number of decimal digits.
Definition: Math.h:870
Definition: AttributeArrayString.h:41
Definition: AttributeArrayString.h:30
uint16_t Type
Definition: AttributeArrayString.h:31
Attribute Array storage templated on type and compression codec.
Definition: AttributeArrayString.h:36
bool isType() const
Return true if this attribute is of the same type as the template parameter.
Definition: AttributeArray.h:215
Definition: AttributeArray.h:763
std::unique_ptr< StringAttributeHandle > UniquePtr
Definition: AttributeArrayString.h:157
bool isString(const AttributeArray &array)
Definition: AttributeArrayString.h:144
Index32 Index
Definition: Types.h:54
bool isUniform() const
Definition: AttributeArrayString.h:168
const MetaMap & mMetadata
Definition: AttributeArrayString.h:179
typename attribute_traits::StringTypeTrait< Truncate >::Type Type
Definition: AttributeArrayString.h:41
Definition: AttributeArrayString.h:153
std::shared_ptr< StringAttributeHandle > Ptr
Definition: AttributeArrayString.h:156
Write-able version of AttributeHandle.
Definition: AttributeArray.h:834
Definition: Exceptions.h:13
Index size() const
Definition: AttributeArrayString.h:166
Index Type
Definition: AttributeArrayString.h:30
AttributeHandle< Index, StringCodec< false > > mHandle
Definition: AttributeArrayString.h:178
Index stride() const
Definition: AttributeArrayString.h:165
Definition: AttributeArrayString.h:186
static const char * name()
Definition: AttributeArrayString.h:45
std::string Name
Definition: Name.h:19
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:121
Typed class for storing attribute data.
Definition: AttributeArray.h:511
bool hasConstantStride() const
Definition: AttributeArrayString.h:169
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:218
Base class for storing attribute data.
Definition: AttributeArray.h:93