HDK
|
Ordered collection of uniquely-named attribute arrays. More...
#include <AttributeSet.h>
Classes | |
struct | Inserter |
Utility method to construct a NameAndType sequence. More... | |
struct | Util |
Public Types | |
enum | AttributePositionLabel : size_t { INVALID_POS = std::numeric_limits<size_t>::max() } |
using | Ptr = std::shared_ptr< AttributeSet > |
using | ConstPtr = std::shared_ptr< const AttributeSet > |
using | UniquePtr = std::unique_ptr< AttributeSet > |
using | DescriptorPtr = std::shared_ptr< Descriptor > |
using | DescriptorConstPtr = std::shared_ptr< const Descriptor > |
using | Ptr = std::shared_ptr< Descriptor > |
using | NameAndType = Util::NameAndType |
using | NameAndTypeVec = Util::NameAndTypeVec |
using | GroupIndex = Util::GroupIndex |
using | NameToPosMap = Util::NameToPosMap |
using | ConstIterator = NameToPosMap::const_iterator |
Public Member Functions | |
AttributeSet () | |
AttributeSet (const AttributeSet &attributeSet, Index arrayLength, const AttributeArray::ScopedRegistryLock *lock=nullptr) | |
AttributeSet (const DescriptorPtr &descriptor, Index arrayLength=1, const AttributeArray::ScopedRegistryLock *lock=nullptr) | |
AttributeSet (const AttributeSet &) | |
Shallow copy constructor, the descriptor and attribute arrays will be shared. More... | |
AttributeSet & | operator= (const AttributeSet &)=delete |
Disallow copy assignment, since it wouldn't be obvious whether the copy is deep or shallow. More... | |
DescriptorPtr | descriptorPtr () const |
Return a pointer to this attribute set's descriptor, which might be shared with other sets. More... | |
size_t | size () const |
Return the number of attributes in this set. More... | |
size_t | memUsage () const |
Return the number of bytes of memory used by this attribute set. More... | |
size_t | find (const std::string &name) const |
Return the position of the attribute array whose name is name, or INVALID_POS if no match is found. More... | |
size_t | replace (const std::string &name, const AttributeArray::Ptr &) |
Replace the attribute array whose name is name. More... | |
size_t | replace (size_t pos, const AttributeArray::Ptr &) |
Replace the attribute array stored at position pos in this container. More... | |
Util::GroupIndex | groupIndex (const Name &groupName) const |
Return the group index from the name of the group. More... | |
Util::GroupIndex | groupIndex (const size_t offset) const |
std::vector< size_t > | groupAttributeIndices () const |
Return the indices of the attribute arrays which are group attribute arrays. More... | |
bool | isShared (size_t pos) const |
Return true if the attribute array stored at position pos is shared. More... | |
void | makeUnique (size_t pos) |
If the attribute array stored at position pos is shared, replace the array with a deep copy of itself that is not shared with anyone else. More... | |
AttributeArray::Ptr | appendAttribute (const Name &name, const NamePair &type, const Index strideOrTotalSize=1, const bool constantStride=true, const Metadata *defaultValue=nullptr) |
Append attribute attribute (simple method) More... | |
AttributeArray::Ptr | appendAttribute (const Descriptor &expected, DescriptorPtr &replacement, const size_t pos, const Index strideOrTotalSize=1, const bool constantStride=true, const Metadata *defaultValue=nullptr, const AttributeArray::ScopedRegistryLock *lock=nullptr) |
AttributeArray::Ptr | removeAttribute (const Name &name) |
Remove and return an attribute array by name. More... | |
AttributeArray::Ptr | removeAttribute (const size_t pos) |
Remove and return an attribute array by index. More... | |
AttributeArray::Ptr | removeAttributeUnsafe (const size_t pos) |
Remove and return an attribute array by index (unsafe method) More... | |
void | dropAttributes (const std::vector< size_t > &pos) |
void | dropAttributes (const std::vector< size_t > &pos, const Descriptor &expected, DescriptorPtr &replacement) |
void | renameAttributes (const Descriptor &expected, const DescriptorPtr &replacement) |
void | reorderAttributes (const DescriptorPtr &replacement) |
void | resetDescriptor (const DescriptorPtr &replacement, const bool allowMismatchingDescriptors=false) |
void | read (std::istream &) |
Read the entire set from a stream. More... | |
void | write (std::ostream &, bool outputTransient=false) const |
void | readDescriptor (std::istream &) |
This will read the attribute descriptor from a stream. More... | |
void | writeDescriptor (std::ostream &, bool outputTransient=false) const |
void | readMetadata (std::istream &) |
This will read the attribute metadata from a stream. More... | |
void | writeMetadata (std::ostream &, bool outputTransient=false, bool paged=false) const |
void | readAttributes (std::istream &) |
This will read the attribute data from a stream. More... | |
void | writeAttributes (std::ostream &, bool outputTransient=false) const |
bool | operator== (const AttributeSet &other) const |
bool | operator!= (const AttributeSet &other) const |
Descriptor () | |
Descriptor (const Descriptor &) | |
Copy constructor. More... | |
Ptr | duplicateAppend (const Name &name, const NamePair &type) const |
Create a new descriptor as a duplicate with a new attribute appended. More... | |
Ptr | duplicateDrop (const std::vector< size_t > &pos) const |
Create a new descriptor as a duplicate with existing attributes dropped. More... | |
size_t | size () const |
Return the number of attributes in this descriptor. More... | |
size_t | count (const NamePair &type) const |
Return the number of attributes with this attribute type. More... | |
size_t | memUsage () const |
Return the number of bytes of memory used by this attribute set. More... | |
size_t | find (const std::string &name) const |
Return the position of the attribute array whose name is name, or INVALID_POS if no match is found. More... | |
size_t | rename (const std::string &fromName, const std::string &toName) |
Rename an attribute array. More... | |
const Name & | valueType (size_t pos) const |
Return the name of the attribute array's type. More... | |
const NamePair & | type (size_t pos) const |
Return the name of the attribute array's type. More... | |
MetaMap & | getMetadata () |
Retrieve metadata map. More... | |
const MetaMap & | getMetadata () const |
bool | hasDefaultValue (const Name &name) const |
Return true if the attribute has a default value. More... | |
template<typename ValueType > | |
ValueType | getDefaultValue (const Name &name) const |
Get a default value for an existing attribute. More... | |
void | setDefaultValue (const Name &name, const Metadata &defaultValue) |
Set a default value for an existing attribute. More... | |
void | removeDefaultValue (const Name &name) |
void | pruneUnusedDefaultValues () |
bool | operator== (const Descriptor &) const |
Return true if this descriptor is equal to the given one. More... | |
bool | operator!= (const Descriptor &rhs) const |
Return true if this descriptor is not equal to the given one. More... | |
bool | hasSameAttributes (const Descriptor &rhs) const |
const NameToPosMap & | map () const |
Return a reference to the name-to-position map. More... | |
const NameToPosMap & | groupMap () const |
Return a reference to the name-to-position group map. More... | |
bool | hasGroup (const Name &group) const |
Return true if group exists. More... | |
void | setGroup (const Name &group, const size_t offset, const bool checkValidOffset=false) |
Define a group name to offset mapping. More... | |
void | dropGroup (const Name &group) |
Drop any mapping keyed by group name. More... | |
void | clearGroups () |
Clear all groups. More... | |
size_t | renameGroup (const std::string &fromName, const std::string &toName) |
Rename a group. More... | |
const Name | uniqueGroupName (const Name &name) const |
Return a unique name for a group based on given name. More... | |
GroupIndex | groupIndex (const Name &groupName) const |
Return the group index from the name of the group. More... | |
GroupIndex | groupIndex (const size_t offset) const |
size_t | availableGroups () const |
size_t | unusedGroups () const |
bool | canCompactGroups () const |
Return true if there are sufficient empty slots to allow compacting. More... | |
size_t | unusedGroupOffset (size_t hint=std::numeric_limits< size_t >::max()) const |
Return a group offset that is not in use. More... | |
bool | requiresGroupMove (Name &sourceName, size_t &sourceOffset, size_t &targetOffset) const |
Determine if a move is required to efficiently compact the data and store the source name, offset and the target offset in the input parameters. More... | |
bool | groupIndexCollision (const Descriptor &rhs) const |
Test if there are any group names shared by both descriptors which have a different index. More... | |
const Name | uniqueName (const Name &name) const |
Return a unique name for an attribute array based on given name. More... | |
void | write (std::ostream &) const |
Serialize this descriptor to the given stream. More... | |
void | read (std::istream &) |
Unserialize this transform from the given stream. More... | |
Descriptor & | descriptor () |
Return a reference to this attribute set's descriptor, which might be shared with other sets. More... | |
const Descriptor & | descriptor () const |
Return a reference to this attribute set's descriptor, which might be shared with other sets. More... | |
const AttributeArray * | getConst (const std::string &name) const |
Return a pointer to the attribute array whose name is name or a null pointer if no match is found. More... | |
const AttributeArray * | get (const std::string &name) const |
Return a pointer to the attribute array whose name is name or a null pointer if no match is found. More... | |
AttributeArray * | get (const std::string &name) |
Return a pointer to the attribute array whose name is name or a null pointer if no match is found. More... | |
const AttributeArray * | getConst (size_t pos) const |
Return a pointer to the attribute array stored at position pos in this set. More... | |
const AttributeArray * | get (size_t pos) const |
Return a pointer to the attribute array stored at position pos in this set. More... | |
AttributeArray * | get (size_t pos) |
Return a pointer to the attribute array stored at position pos in this set. More... | |
size_t | groupOffset (const Name &groupName) const |
Return the group offset from the name or index of the group A group attribute array is a single byte (8-bit), each bit of which can denote a group. The group offset is the position of the bit that denotes the requested group if all group attribute arrays in the set (and only attribute arrays marked as group) were to be laid out linearly according to their order in the set. More... | |
size_t | groupOffset (const Util::GroupIndex &index) const |
Return the group offset from the name or index of the group A group attribute array is a single byte (8-bit), each bit of which can denote a group. The group offset is the position of the bit that denotes the requested group if all group attribute arrays in the set (and only attribute arrays marked as group) were to be laid out linearly according to their order in the set. More... | |
size_t | groupOffset (const Name &groupName) const |
Return the group offset from the name or index of the group A group attribute array is a single byte (8-bit), each bit of which can denote a group. The group offset is the position of the bit that denotes the requested group if all group attribute arrays in the set (and only attribute arrays marked as group) were to be laid out linearly according to their order in the set. More... | |
size_t | groupOffset (const GroupIndex &index) const |
Return the group offset from the name or index of the group A group attribute array is a single byte (8-bit), each bit of which can denote a group. The group offset is the position of the bit that denotes the requested group if all group attribute arrays in the set (and only attribute arrays marked as group) were to be laid out linearly according to their order in the set. More... | |
Static Public Member Functions | |
static Ptr | create (const NamePair &) |
Create a new descriptor from a position attribute type and assumes "P" (for convenience). More... | |
static size_t | groupBits () |
Return number of bits occupied by a group attribute array. More... | |
static bool | validName (const Name &name) |
Return true if the name is valid. More... | |
static void | parseNames (std::vector< std::string > &includeNames, std::vector< std::string > &excludeNames, bool &includeAll, const std::string &nameStr) |
Extract each name from nameStr into includeNames, or into excludeNames if the name is prefixed with a caret. More... | |
static void | parseNames (std::vector< std::string > &includeNames, std::vector< std::string > &excludeNames, const std::string &nameStr) |
Extract each name from nameStr into includeNames, or into excludeNames if the name is prefixed with a caret. More... | |
Protected Member Functions | |
void | appendTo (NameAndTypeVec &attrs) const |
Append to a vector of names and types from this Descriptor in position order. More... | |
size_t | insert (const std::string &name, const NamePair &typeName) |
Static Protected Member Functions | |
static Ptr | create (const NameAndTypeVec &, const NameToPosMap &, const MetaMap &) |
Friends | |
class | ::TestAttributeSet |
Ordered collection of uniquely-named attribute arrays.
An immutable object that stores name, type and AttributeSet position for a constant collection of attribute arrays.
Definition at line 38 of file AttributeSet.h.
using openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::ConstIterator = NameToPosMap::const_iterator |
Definition at line 320 of file AttributeSet.h.
using openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::ConstPtr = std::shared_ptr<const AttributeSet> |
Definition at line 44 of file AttributeSet.h.
using openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::DescriptorConstPtr = std::shared_ptr<const Descriptor> |
Definition at line 50 of file AttributeSet.h.
using openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::DescriptorPtr = std::shared_ptr<Descriptor> |
Definition at line 49 of file AttributeSet.h.
using openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::GroupIndex = Util::GroupIndex |
Definition at line 318 of file AttributeSet.h.
using openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::NameAndType = Util::NameAndType |
Definition at line 316 of file AttributeSet.h.
using openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::NameAndTypeVec = Util::NameAndTypeVec |
Definition at line 317 of file AttributeSet.h.
using openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::NameToPosMap = Util::NameToPosMap |
Definition at line 319 of file AttributeSet.h.
using openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::Ptr = std::shared_ptr<AttributeSet> |
Definition at line 43 of file AttributeSet.h.
using openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::Ptr = std::shared_ptr<Descriptor> |
Definition at line 314 of file AttributeSet.h.
using openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::UniquePtr = std::unique_ptr<AttributeSet> |
Definition at line 45 of file AttributeSet.h.
enum openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::AttributePositionLabel : size_t |
Enumerator | |
---|---|
INVALID_POS |
Definition at line 41 of file AttributeSet.h.
openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::AttributeSet | ( | ) |
openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::AttributeSet | ( | const AttributeSet & | attributeSet, |
Index | arrayLength, | ||
const AttributeArray::ScopedRegistryLock * | lock = nullptr |
||
) |
Construct a new AttributeSet from the given AttributeSet.
attributeSet | the old attribute set |
arrayLength | the desired length of the arrays in the new AttributeSet |
lock | an optional scoped registry lock to avoid contention |
openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::AttributeSet | ( | const DescriptorPtr & | descriptor, |
Index | arrayLength = 1 , |
||
const AttributeArray::ScopedRegistryLock * | lock = nullptr |
||
) |
Construct a new AttributeSet from the given Descriptor.
descriptor | stored in the new AttributeSet and used in construction |
arrayLength | the desired length of the arrays in the new AttributeSet |
lock | an optional scoped registry lock to avoid contention |
openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::AttributeSet | ( | const AttributeSet & | ) |
Shallow copy constructor, the descriptor and attribute arrays will be shared.
AttributeArray::Ptr openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::appendAttribute | ( | const Name & | name, |
const NamePair & | type, | ||
const Index | strideOrTotalSize = 1 , |
||
const bool | constantStride = true , |
||
const Metadata * | defaultValue = nullptr |
||
) |
Append attribute attribute (simple method)
AttributeArray::Ptr openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::appendAttribute | ( | const Descriptor & | expected, |
DescriptorPtr & | replacement, | ||
const size_t | pos, | ||
const Index | strideOrTotalSize = 1 , |
||
const bool | constantStride = true , |
||
const Metadata * | defaultValue = nullptr , |
||
const AttributeArray::ScopedRegistryLock * | lock = nullptr |
||
) |
Append attribute attribute (descriptor-sharing) Requires current descriptor to match expected On append, current descriptor is replaced with replacement Provide a lock object to avoid contention from appending in parallel
|
protected |
Append to a vector of names and types from this Descriptor in position order.
size_t openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::availableGroups | ( | ) | const |
Return the total number of available groups (group bits * number of group attributes)
bool openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::canCompactGroups | ( | ) | const |
Return true
if there are sufficient empty slots to allow compacting.
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::clearGroups | ( | ) |
Clear all groups.
size_t openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::count | ( | const NamePair & | type | ) | const |
Return the number of attributes with this attribute type.
Create a new descriptor from a position attribute type and assumes "P" (for convenience).
|
staticprotected |
Create a new descriptor from the given attribute and type name pairs and copy the group maps and metamap.
|
inline |
Return a reference to this attribute set's descriptor, which might be shared with other sets.
Definition at line 102 of file AttributeSet.h.
|
inline |
Return a reference to this attribute set's descriptor, which might be shared with other sets.
Definition at line 103 of file AttributeSet.h.
openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::Descriptor | ( | ) |
openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::Descriptor | ( | const Descriptor & | ) |
Copy constructor.
|
inline |
Return a pointer to this attribute set's descriptor, which might be shared with other sets.
Definition at line 108 of file AttributeSet.h.
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::dropAttributes | ( | const std::vector< size_t > & | pos | ) |
Drop attributes with pos indices (simple method) Creates a new descriptor for this attribute set
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::dropAttributes | ( | const std::vector< size_t > & | pos, |
const Descriptor & | expected, | ||
DescriptorPtr & | replacement | ||
) |
Drop attributes with pos indices (descriptor-sharing method) Requires current descriptor to match expected On drop, current descriptor is replaced with replacement
Drop any mapping keyed by group name.
Ptr openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::duplicateAppend | ( | const Name & | name, |
const NamePair & | type | ||
) | const |
Create a new descriptor as a duplicate with a new attribute appended.
Ptr openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::duplicateDrop | ( | const std::vector< size_t > & | pos | ) | const |
Create a new descriptor as a duplicate with existing attributes dropped.
size_t openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::find | ( | const std::string & | name | ) | const |
Return the position of the attribute array whose name is name, or INVALID_POS
if no match is found.
size_t openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::find | ( | const std::string & | name | ) | const |
Return the position of the attribute array whose name is name, or INVALID_POS
if no match is found.
const AttributeArray* openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::get | ( | const std::string & | name | ) | const |
Return a pointer to the attribute array whose name is name or a null pointer if no match is found.
AttributeArray* openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::get | ( | const std::string & | name | ) |
Return a pointer to the attribute array whose name is name or a null pointer if no match is found.
const AttributeArray* openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::get | ( | size_t | pos | ) | const |
Return a pointer to the attribute array stored at position pos in this set.
AttributeArray* openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::get | ( | size_t | pos | ) |
Return a pointer to the attribute array stored at position pos in this set.
const AttributeArray* openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::getConst | ( | const std::string & | name | ) | const |
Return a pointer to the attribute array whose name is name or a null pointer if no match is found.
const AttributeArray* openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::getConst | ( | size_t | pos | ) | const |
Return a pointer to the attribute array stored at position pos in this set.
|
inline |
Get a default value for an existing attribute.
Definition at line 384 of file AttributeSet.h.
MetaMap& openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::getMetadata | ( | ) |
Retrieve metadata map.
const MetaMap& openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::getMetadata | ( | ) | const |
std::vector<size_t> openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::groupAttributeIndices | ( | ) | const |
Return the indices of the attribute arrays which are group attribute arrays.
|
inlinestatic |
Return number of bits occupied by a group attribute array.
Definition at line 455 of file AttributeSet.h.
Util::GroupIndex openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::groupIndex | ( | const Name & | groupName | ) | const |
Return the group index from the name of the group.
Util::GroupIndex openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::groupIndex | ( | const size_t | offset | ) | const |
Return the group index from the offset of the group
GroupIndex openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::groupIndex | ( | const Name & | groupName | ) | const |
Return the group index from the name of the group.
GroupIndex openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::groupIndex | ( | const size_t | offset | ) | const |
Return the group index from the offset of the group
bool openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::groupIndexCollision | ( | const Descriptor & | rhs | ) | const |
Test if there are any group names shared by both descriptors which have a different index.
rhs | the descriptor to compare with |
true
if an index collision exists
|
inline |
Return a reference to the name-to-position group map.
Definition at line 418 of file AttributeSet.h.
size_t openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::groupOffset | ( | const Name & | groupName | ) | const |
Return the group offset from the name or index of the group A group attribute array is a single byte (8-bit), each bit of which can denote a group. The group offset is the position of the bit that denotes the requested group if all group attribute arrays in the set (and only attribute arrays marked as group) were to be laid out linearly according to their order in the set.
size_t openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::groupOffset | ( | const Util::GroupIndex & | index | ) | const |
Return the group offset from the name or index of the group A group attribute array is a single byte (8-bit), each bit of which can denote a group. The group offset is the position of the bit that denotes the requested group if all group attribute arrays in the set (and only attribute arrays marked as group) were to be laid out linearly according to their order in the set.
size_t openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::groupOffset | ( | const Name & | groupName | ) | const |
Return the group offset from the name or index of the group A group attribute array is a single byte (8-bit), each bit of which can denote a group. The group offset is the position of the bit that denotes the requested group if all group attribute arrays in the set (and only attribute arrays marked as group) were to be laid out linearly according to their order in the set.
size_t openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::groupOffset | ( | const GroupIndex & | index | ) | const |
Return the group offset from the name or index of the group A group attribute array is a single byte (8-bit), each bit of which can denote a group. The group offset is the position of the bit that denotes the requested group if all group attribute arrays in the set (and only attribute arrays marked as group) were to be laid out linearly according to their order in the set.
bool openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::hasDefaultValue | ( | const Name & | name | ) | const |
Return true if the attribute has a default value.
bool openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::hasGroup | ( | const Name & | group | ) | const |
Return true
if group exists.
bool openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::hasSameAttributes | ( | const Descriptor & | rhs | ) | const |
Return true if this descriptor contains the same attributes as the given descriptor, ignoring attribute order
|
protected |
bool openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::isShared | ( | size_t | pos | ) | const |
Return true if the attribute array stored at position pos is shared.
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::makeUnique | ( | size_t | pos | ) |
If the attribute array stored at position pos is shared, replace the array with a deep copy of itself that is not shared with anyone else.
|
inline |
Return a reference to the name-to-position map.
Definition at line 416 of file AttributeSet.h.
size_t openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::memUsage | ( | ) | const |
Return the number of bytes of memory used by this attribute set.
size_t openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::memUsage | ( | ) | const |
Return the number of bytes of memory used by this attribute set.
|
inline |
Definition at line 282 of file AttributeSet.h.
|
inline |
Return true if this descriptor is not equal to the given one.
Definition at line 410 of file AttributeSet.h.
|
delete |
Disallow copy assignment, since it wouldn't be obvious whether the copy is deep or shallow.
bool openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::operator== | ( | const AttributeSet & | other | ) | const |
Compare the descriptors and attribute arrays on the attribute sets Exit early if the descriptors do not match
bool openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::operator== | ( | const Descriptor & | ) | const |
Return true if this descriptor is equal to the given one.
|
static |
Extract each name from nameStr into includeNames, or into excludeNames if the name is prefixed with a caret.
nameStr | the input string of names |
includeNames | on exit, the list of names that are not prefixed with a caret |
excludeNames | on exit, the list of names that are prefixed with a caret |
includeAll | on exit, true if a "*" wildcard is present in the includeNames |
|
static |
Extract each name from nameStr into includeNames, or into excludeNames if the name is prefixed with a caret.
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::pruneUnusedDefaultValues | ( | ) |
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::read | ( | std::istream & | ) |
Read the entire set from a stream.
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::read | ( | std::istream & | ) |
Unserialize this transform from the given stream.
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::readAttributes | ( | std::istream & | ) |
This will read the attribute data from a stream.
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::readDescriptor | ( | std::istream & | ) |
This will read the attribute descriptor from a stream.
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::readMetadata | ( | std::istream & | ) |
This will read the attribute metadata from a stream.
AttributeArray::Ptr openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::removeAttribute | ( | const Name & | name | ) |
Remove and return an attribute array by name.
name | the name of the attribute array to release |
Detaches the attribute array from this attribute set and returns it, if name is invalid, returns an empty shared pointer. This also updates the descriptor to remove the reference to the attribute array.
AttributeArray::Ptr openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::removeAttribute | ( | const size_t | pos | ) |
Remove and return an attribute array by index.
pos | the position index of the attribute to release |
Detaches the attribute array from this attribute set and returns it, if pos is invalid, returns an empty shared pointer. This also updates the descriptor to remove the reference to the attribute array.
AttributeArray::Ptr openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::removeAttributeUnsafe | ( | const size_t | pos | ) |
Remove and return an attribute array by index (unsafe method)
pos | the position index of the attribute to release |
Detaches the attribute array from this attribute set and returns it, if pos is invalid, returns an empty shared pointer. In cases where the AttributeSet is due to be destroyed, a small performance advantage can be gained by leaving the attribute array as a nullptr and not updating the descriptor. However, this leaves the AttributeSet in an invalid state making it unsafe to call any methods that implicitly derefence the attribute array.
size_t openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::rename | ( | const std::string & | fromName, |
const std::string & | toName | ||
) |
Rename an attribute array.
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::renameAttributes | ( | const Descriptor & | expected, |
const DescriptorPtr & | replacement | ||
) |
Re-name attributes in set to match a provided descriptor Replaces own descriptor with replacement
size_t openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::renameGroup | ( | const std::string & | fromName, |
const std::string & | toName | ||
) |
Rename a group.
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::reorderAttributes | ( | const DescriptorPtr & | replacement | ) |
Re order attribute set to match a provided descriptor Replaces own descriptor with replacement
size_t openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::replace | ( | const std::string & | name, |
const AttributeArray::Ptr & | |||
) |
Replace the attribute array whose name is name.
INVALID_POS
if the given name does not exist or if the replacement failed because the new array type does not comply with the descriptor. size_t openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::replace | ( | size_t | pos, |
const AttributeArray::Ptr & | |||
) |
Replace the attribute array stored at position pos in this container.
INVALID_POS
if replacement failed because the new array type does not comply with the descriptor. bool openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::requiresGroupMove | ( | Name & | sourceName, |
size_t & | sourceOffset, | ||
size_t & | targetOffset | ||
) | const |
Determine if a move is required to efficiently compact the data and store the source name, offset and the target offset in the input parameters.
sourceName | source name |
sourceOffset | source offset |
targetOffset | target offset |
true
if move is required to compact the data void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::resetDescriptor | ( | const DescriptorPtr & | replacement, |
const bool | allowMismatchingDescriptors = false |
||
) |
Replace the current descriptor with a replacement Note the provided Descriptor must be identical to the replacement unless allowMismatchingDescriptors is true (default is false)
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::setDefaultValue | ( | const Name & | name, |
const Metadata & | defaultValue | ||
) |
Set a default value for an existing attribute.
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::setGroup | ( | const Name & | group, |
const size_t | offset, | ||
const bool | checkValidOffset = false |
||
) |
Define a group name to offset mapping.
group | group name |
offset | group offset |
checkValidOffset | throws if offset out-of-range or in-use |
|
inline |
Return the number of attributes in this set.
Definition at line 111 of file AttributeSet.h.
|
inline |
Return the number of attributes in this descriptor.
Definition at line 356 of file AttributeSet.h.
const NamePair& openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::type | ( | size_t | pos | ) | const |
Return the name of the attribute array's type.
const Name openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::uniqueGroupName | ( | const Name & | name | ) | const |
Return a unique name for a group based on given name.
const Name openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::uniqueName | ( | const Name & | name | ) | const |
Return a unique name for an attribute array based on given name.
size_t openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::unusedGroupOffset | ( | size_t | hint = std::numeric_limits< size_t >::max() | ) | const |
Return a group offset that is not in use.
hint | if provided, request a specific offset as a hint |
size_t openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::unusedGroups | ( | ) | const |
Return the number of empty group slots which correlates to the number of groups that can be stored without increasing the number of group attribute arrays
|
static |
Return true if the name is valid.
const Name& openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::valueType | ( | size_t | pos | ) | const |
Return the name of the attribute array's type.
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::write | ( | std::ostream & | , |
bool | outputTransient = false |
||
) | const |
Write the entire set to a stream.
outputTransient | if true, write out transient attributes |
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::write | ( | std::ostream & | ) | const |
Serialize this descriptor to the given stream.
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::writeAttributes | ( | std::ostream & | , |
bool | outputTransient = false |
||
) | const |
This will write the attribute data to a stream.
outputTransient | if true, write out transient attributes |
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::writeDescriptor | ( | std::ostream & | , |
bool | outputTransient = false |
||
) | const |
This will write the attribute descriptor to a stream.
outputTransient | if true, write out transient attributes |
void openvdb::OPENVDB_VERSION_NAME::points::AttributeSet::writeMetadata | ( | std::ostream & | , |
bool | outputTransient = false , |
||
bool | paged = false |
||
) | const |
This will write the attribute metadata to a stream.
outputTransient | if true, write out transient attributes |
paged | if true, data is written out in pages |
|
friend |
Definition at line 526 of file AttributeSet.h.