Loading...
Searching...
No Matches
AttributeSet Class Reference

Ordered collection of uniquely-named attribute arrays. More...

`#include <openvdb/points/AttributeSet.h>`

Inheritance diagram for AttributeSet:

## 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.
AttributeSet & | operator= (const AttributeSet &)=delete
| Disallow copy assignment, since it wouldn't be obvious whether the copy is deep or shallow.
Descriptor & | descriptor ()
| Return a reference to this attribute set's descriptor, which might be shared with other sets.
const Descriptor & | descriptor () const
DescriptorPtr | descriptorPtr () const
| Return a pointer to this attribute set's descriptor, which might be shared with other sets.
size_t | size () const
| Return the number of attributes in this set.
size_t | memUsage () const
| Return the number of bytes of memory used by this attribute set.
size_t | memUsageIfLoaded () const
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.
size_t | replace (const std::string &name, const AttributeArray::Ptr &)
| Replace the attribute array whose name is name.
size_t | replace (size_t pos, const AttributeArray::Ptr &)
| Replace the attribute array stored at position pos in this container.
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.
const AttributeArray * | get (const std::string &name) const
AttributeArray * | get (const std::string &name)
const AttributeArray * | getConst (size_t pos) const
| Return a pointer to the attribute array stored at position pos in this set.
const AttributeArray * | get (size_t pos) const
AttributeArray * | get (size_t pos)
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.
size_t | groupOffset (const Util::GroupIndex &index) const
Util::GroupIndex | groupIndex (const Name &groupName) const
| Return the group index from the name of the group.
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.
bool | isShared (size_t pos) const
| Return true if the attribute array stored at position pos is shared.
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.
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)
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.
AttributeArray::Ptr | removeAttribute (const size_t pos)
| Remove and return an attribute array by index.
AttributeArray::Ptr | removeAttributeUnsafe (const size_t pos)
| Remove and return an attribute array by index (unsafe method)
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.
void | write (std::ostream &, bool outputTransient=false) const
void | readDescriptor (std::istream &)
| This will read the attribute descriptor from a stream.
void | writeDescriptor (std::ostream &, bool outputTransient=false) const
void | readMetadata (std::istream &)
| This will read the attribute metadata from a stream.
void | writeMetadata (std::ostream &, bool outputTransient=false, bool paged=false) const
void | readAttributes (std::istream &)
| This will read the attribute data from a stream.
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.
Ptr | duplicateAppend (const Name &name, const NamePair &type) const
| Create a new descriptor as a duplicate with a new attribute appended.
Ptr | duplicateDrop (const std::vector< size_t > &pos) const
| Create a new descriptor as a duplicate with existing attributes dropped.
size_t | size () const
| Return the number of attributes in this descriptor.
size_t | count (const NamePair &type) const
| Return the number of attributes with this attribute type.
size_t | memUsage () const
| Return the number of bytes of memory used by this attribute set.
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.
size_t | rename (const std::string &fromName, const std::string &toName)
| Rename an attribute array.
const Name & | valueType (size_t pos) const
| Return the name of the attribute array's type.
const NamePair & | type (size_t pos) const
| Return the name of the attribute array's type.
MetaMap & | getMetadata ()
| Retrieve metadata map.
const MetaMap & | getMetadata () const
bool | hasDefaultValue (const Name &name) const
| Return true if the attribute has a default value.
template<typename ValueType >
ValueType | getDefaultValue (const Name &name) const
| Get a default value for an existing attribute.
void | setDefaultValue (const Name &name, const Metadata &defaultValue)
| Set a default value for an existing attribute.
void | removeDefaultValue (const Name &name)
void | pruneUnusedDefaultValues ()
bool | operator== (const Descriptor &) const
| Return true if this descriptor is equal to the given one.
bool | operator!= (const Descriptor &rhs) const
| Return true if this descriptor is not equal to the given one.
bool | hasSameAttributes (const Descriptor &rhs) const
const NameToPosMap & | map () const
| Return a reference to the name-to-position map.
const NameToPosMap & | groupMap () const
| Return a reference to the name-to-position group map.
bool | hasGroup (const Name &group) const
| Return `true` if group exists.
void | setGroup (const Name &group, const size_t offset, const bool checkValidOffset=false)
| Define a group name to offset mapping.
void | dropGroup (const Name &group)
| Drop any mapping keyed by group name.
void | clearGroups ()
| Clear all groups.
size_t | renameGroup (const std::string &fromName, const std::string &toName)
| Rename a group.
const Name | uniqueGroupName (const Name &name) const
| Return a unique name for a group based on given name.
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.
size_t | groupOffset (const GroupIndex &index) const
GroupIndex | groupIndex (const Name &groupName) const
| Return the group index from the name of the group.
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.
size_t | unusedGroupOffset (size_t hint=std::numeric_limits< size_t >::max()) const
| Return a group offset that is not in use.
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.
bool | groupIndexCollision (const Descriptor &rhs) const
| Test if there are any group names shared by both descriptors which have a different index.
const Name | uniqueName (const Name &name) const
| Return a unique name for an attribute array based on given name.
void | write (std::ostream &) const
| Serialize this descriptor to the given stream.
void | read (std::istream &)
| Unserialize this transform from the given stream.

## Static Public Member Functions

static Ptr | create (const NamePair &)
| Create a new descriptor from a position attribute type and assumes "P" (for convenience).
static size_t | groupBits ()
| Return number of bits occupied by a group attribute array.
static bool | validName (const Name &name)
| Return true if the name is valid.
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.
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.

## Protected Member Functions

void | appendTo (NameAndTypeVec &attrs) const
| Append to a vector of names and types from this Descriptor in position order.
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

## Detailed Description

Ordered collection of uniquely-named attribute arrays.

An immutable object that stores name, type and AttributeSet position for a constant collection of attribute arrays.

Note
  The attribute name is actually mutable, but the attribute type and position can not be changed after creation.

## Member Typedef Documentation

## ConstIterator

using ConstIterator = NameToPosMap::const_iterator

## ConstPtr

using ConstPtr = std::shared_ptr<const AttributeSet>

## DescriptorConstPtr

using DescriptorConstPtr = std::shared_ptr<const Descriptor>

## DescriptorPtr

using DescriptorPtr = std::shared_ptr<Descriptor>

## GroupIndex

using GroupIndex = Util::GroupIndex

## NameAndType

using NameAndType = Util::NameAndType

## NameAndTypeVec

using NameAndTypeVec = Util::NameAndTypeVec

## NameToPosMap

using NameToPosMap = Util::NameToPosMap

## Ptr [1/2]

using Ptr = std::shared_ptr<AttributeSet>

## Ptr [2/2]

using Ptr = std::shared_ptr<Descriptor>

## UniquePtr

using UniquePtr = std::unique_ptr<AttributeSet>

## Member Enumeration Documentation

## AttributePositionLabel

enum AttributePositionLabel : size_t

Enumerator
INVALID_POS |

## Constructor & Destructor Documentation

## AttributeSet() [1/4]

AttributeSet | ( |  | ) |

## AttributeSet() [2/4]

AttributeSet | ( | const AttributeSet & | attributeSet,
|  | Index | arrayLength,
|  | const AttributeArray::ScopedRegistryLock * | lock = `nullptr`
| ) |  |

Construct a new AttributeSet from the given AttributeSet.

Parameters

  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

Note
  This constructor is typically used to resize an existing AttributeSet as it transfers attribute metadata such as hidden and transient flags

## AttributeSet() [3/4]

AttributeSet | ( | const DescriptorPtr & | descriptor,
|  | Index | arrayLength = `1`,
|  | const AttributeArray::ScopedRegistryLock * | lock = `nullptr`
| ) |  |

Construct a new AttributeSet from the given Descriptor.

Parameters

  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

Note
  Descriptors do not store attribute metadata such as hidden and transient flags which live on the AttributeArrays, so for constructing from an existing AttributeSet use the AttributeSet(const AttributeSet&, Index) constructor instead

## AttributeSet() [4/4]

AttributeSet | ( | const AttributeSet & |  | ) |

Shallow copy constructor, the descriptor and attribute arrays will be shared.

## Member Function Documentation

## appendAttribute() [1/2]

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`
| ) |  |

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

## appendAttribute() [2/2]

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)

## appendTo()

void appendTo | ( | NameAndTypeVec & | attrs | ) | const

protected

Append to a vector of names and types from this Descriptor in position order.

## availableGroups()

size_t availableGroups | ( |  | ) | const

Return the total number of available groups (group bits * number of group attributes)

## canCompactGroups()

bool canCompactGroups | ( |  | ) | const

Return `true` if there are sufficient empty slots to allow compacting.

## clearGroups()

void clearGroups | ( |  | ) |

Clear all groups.

## count()

size_t count | ( | const NamePair & | type | ) | const

Return the number of attributes with this attribute type.

## create() [1/2]

static Ptr create | ( | const NameAndTypeVec & | ,
|  | const NameToPosMap & | ,
|  | const MetaMap & |
| ) |  |

staticprotected

Create a new descriptor from the given attribute and type name pairs and copy the group maps and metamap.

## create() [2/2]

static Ptr create | ( | const NamePair & |  | ) |

static

Create a new descriptor from a position attribute type and assumes "P" (for convenience).

## descriptor() [1/2]

Descriptor & descriptor | ( |  | ) |

inline

Return a reference to this attribute set's descriptor, which might be shared with other sets.

## Descriptor() [1/2]

Descriptor | ( |  | ) |

## descriptor() [2/2]

const Descriptor & descriptor | ( |  | ) | const

inline

## Descriptor() [2/2]

Descriptor | ( | const Descriptor & |  | ) |

Copy constructor.

## descriptorPtr()

DescriptorPtr descriptorPtr | ( |  | ) | const

inline

Return a pointer to this attribute set's descriptor, which might be shared with other sets.

## dropAttributes() [1/2]

void dropAttributes | ( | const std::vector< size_t > & | pos | ) |

Drop attributes with pos indices (simple method) Creates a new descriptor for this attribute set

## dropAttributes() [2/2]

void 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

## dropGroup()

void dropGroup | ( | const Name & | group | ) |

Drop any mapping keyed by group name.

## duplicateAppend()

Ptr duplicateAppend | ( | const Name & | name,
|  | const NamePair & | type
| ) |  | const

Create a new descriptor as a duplicate with a new attribute appended.

## duplicateDrop()

Ptr duplicateDrop | ( | const std::vector< size_t > & | pos | ) | const

Create a new descriptor as a duplicate with existing attributes dropped.

## find() [1/2]

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.

## find() [2/2]

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.

## get() [1/4]

AttributeArray * get | ( | const std::string & | name | ) |

## get() [2/4]

const AttributeArray * get | ( | const std::string & | name | ) | const

## get() [3/4]

AttributeArray * get | ( | size_t | pos | ) |

## get() [4/4]

const AttributeArray * get | ( | size_t | pos | ) | const

## getConst() [1/2]

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.

## getConst() [2/2]

const AttributeArray * getConst | ( | size_t | pos | ) | const

Return a pointer to the attribute array stored at position pos in this set.

## getDefaultValue()

template<typename ValueType >

ValueType getDefaultValue | ( | const Name & | name | ) | const

inline

Get a default value for an existing attribute.

## getMetadata() [1/2]

MetaMap & getMetadata | ( |  | ) |

Retrieve metadata map.

## getMetadata() [2/2]

const MetaMap & getMetadata | ( |  | ) | const

## groupAttributeIndices()

std::vector< size_t > groupAttributeIndices | ( |  | ) | const

Return the indices of the attribute arrays which are group attribute arrays.

## groupBits()

static size_t groupBits | ( |  | ) |

inlinestatic

Return number of bits occupied by a group attribute array.

## groupIndex() [1/4]

Util::GroupIndex groupIndex | ( | const Name & | groupName | ) | const

Return the group index from the name of the group.

## groupIndex() [2/4]

GroupIndex groupIndex | ( | const Name & | groupName | ) | const

Return the group index from the name of the group.

## groupIndex() [3/4]

Util::GroupIndex groupIndex | ( | const size_t | offset | ) | const

Return the group index from the offset of the group

Note
  see offset description for groupOffset()

## groupIndex() [4/4]

GroupIndex groupIndex | ( | const size_t | offset | ) | const

Return the group index from the offset of the group

Note
  see offset description for groupOffset()

## groupIndexCollision()

bool groupIndexCollision | ( | const Descriptor & | rhs | ) | const

Test if there are any group names shared by both descriptors which have a different index.

Parameters

  rhs | the descriptor to compare with

Returns
  `true` if an index collision exists

## groupMap()

const NameToPosMap & groupMap | ( |  | ) | const

inline

Return a reference to the name-to-position group map.

## groupOffset() [1/4]

size_t groupOffset | ( | const GroupIndex & | index | ) | const

## groupOffset() [2/4]

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.

## groupOffset() [3/4]

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.

## groupOffset() [4/4]

size_t groupOffset | ( | const Util::GroupIndex & | index | ) | const

## hasDefaultValue()

bool hasDefaultValue | ( | const Name & | name | ) | const

Return true if the attribute has a default value.

## hasGroup()

bool hasGroup | ( | const Name & | group | ) | const

Return `true` if group exists.

## hasSameAttributes()

bool hasSameAttributes | ( | const Descriptor & | rhs | ) | const

Return true if this descriptor contains the same attributes as the given descriptor, ignoring attribute order

## insert()

size_t insert | ( | const std::string & | name,
|  | const NamePair & | typeName
| ) |  |

protected

## isShared()

bool isShared | ( | size_t | pos | ) | const

Return true if the attribute array stored at position pos is shared.

## makeUnique()

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.

## map()

const NameToPosMap & map | ( |  | ) | const

inline

Return a reference to the name-to-position map.

## memUsage() [1/2]

size_t memUsage | ( |  | ) | const

Return the number of bytes of memory used by this attribute set.

## memUsage() [2/2]

size_t memUsage | ( |  | ) | const

Return the number of bytes of memory used by this attribute set.

## memUsageIfLoaded()

size_t memUsageIfLoaded | ( |  | ) | const

Return the number of bytes of memory used by this attribute set once it has been deserialized (this may be different to memUsage() if delay-loading is in use).

## operator!=() [1/2]

bool operator!= | ( | const AttributeSet & | other | ) | const

inline

## operator!=() [2/2]

bool operator!= | ( | const Descriptor & | rhs | ) | const

inline

Return true if this descriptor is not equal to the given one.

## operator=()

AttributeSet & operator= | ( | const AttributeSet & |  | ) |

delete

Disallow copy assignment, since it wouldn't be obvious whether the copy is deep or shallow.

## operator==() [1/2]

bool operator== | ( | const AttributeSet & | other | ) | const

Compare the descriptors and attribute arrays on the attribute sets Exit early if the descriptors do not match

## operator==() [2/2]

bool operator== | ( | const Descriptor & |  | ) | const

Return true if this descriptor is equal to the given one.

## parseNames() [1/2]

static void parseNames | ( | std::vector< std::string > & | includeNames,
|  | std::vector< std::string > & | excludeNames,
|  | bool & | includeAll,
|  | const std::string & | nameStr
| ) |  |

static

Extract each name from nameStr into includeNames, or into excludeNames if the name is prefixed with a caret.

Parameters

  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

## parseNames() [2/2]

static void parseNames | ( | std::vector< std::string > & | includeNames,
|  | std::vector< std::string > & | excludeNames,
|  | const std::string & | nameStr
| ) |  |

static

Extract each name from nameStr into includeNames, or into excludeNames if the name is prefixed with a caret.

## pruneUnusedDefaultValues()

void pruneUnusedDefaultValues | ( |  | ) |

## read() [1/2]

void read | ( | std::istream & |  | ) |

Read the entire set from a stream.

## read() [2/2]

void read | ( | std::istream & |  | ) |

Unserialize this transform from the given stream.

## readAttributes()

void readAttributes | ( | std::istream & |  | ) |

This will read the attribute data from a stream.

## readDescriptor()

void readDescriptor | ( | std::istream & |  | ) |

This will read the attribute descriptor from a stream.

## readMetadata()

void readMetadata | ( | std::istream & |  | ) |

This will read the attribute metadata from a stream.

## removeAttribute() [1/2]

AttributeArray::Ptr removeAttribute | ( | const Name & | name | ) |

Remove and return an attribute array by name.

Parameters

  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.

Note
  AttributeArrays are stored as shared pointers, so they are not guaranteed to be unique. Check the reference count before blindly re-using in a new AttributeSet.

## removeAttribute() [2/2]

AttributeArray::Ptr removeAttribute | ( | const size_t | pos | ) |

Remove and return an attribute array by index.

Parameters

  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.

Note
  AttributeArrays are stored as shared pointers, so they are not guaranteed to be unique. Check the reference count before blindly re-using in a new AttributeSet.

## removeAttributeUnsafe()

AttributeArray::Ptr removeAttributeUnsafe | ( | const size_t | pos | ) |

Remove and return an attribute array by index (unsafe method)

Parameters

  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.

Note
  AttributeArrays are stored as shared pointers, so they are not guaranteed to be unique. Check the reference count before blindly re-using in a new AttributeSet.

Warning
  Only use this method if you're an expert and know the risks of not updating the array of attributes or the descriptor.

## removeDefaultValue()

void removeDefaultValue | ( | const Name & | name | ) |

## rename()

size_t rename | ( | const std::string & | fromName,
|  | const std::string & | toName
| ) |  |

Rename an attribute array.

## renameAttributes()

void renameAttributes | ( | const Descriptor & | expected,
|  | const DescriptorPtr & | replacement
| ) |  |

Re-name attributes in set to match a provided descriptor Replaces own descriptor with replacement

## renameGroup()

size_t renameGroup | ( | const std::string & | fromName,
|  | const std::string & | toName
| ) |  |

Rename a group.

## reorderAttributes()

void reorderAttributes | ( | const DescriptorPtr & | replacement | ) |

Re order attribute set to match a provided descriptor Replaces own descriptor with replacement

## replace() [1/2]

size_t replace | ( | const std::string & | name,
|  | const AttributeArray::Ptr & |
| ) |  |

Replace the attribute array whose name is name.

Returns
  The position of the updated attribute array or `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.

## replace() [2/2]

size_t replace | ( | size_t | pos,
|  | const AttributeArray::Ptr & |
| ) |  |

Replace the attribute array stored at position pos in this container.

Returns
  The position of the updated attribute array or `INVALID_POS` if replacement failed because the new array type does not comply with the descriptor.

## requiresGroupMove()

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.

Parameters

  sourceName | source name
  sourceOffset | source offset
  targetOffset | target offset

Returns
  `true` if move is required to compact the data

## resetDescriptor()

void 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)

## setDefaultValue()

void setDefaultValue | ( | const Name & | name,
|  | const Metadata & | defaultValue
| ) |  |

Set a default value for an existing attribute.

## setGroup()

void setGroup | ( | const Name & | group,
|  | const size_t | offset,
|  | const bool | checkValidOffset = `false`
| ) |  |

Define a group name to offset mapping.

Parameters

  group | group name
  offset | group offset
  checkValidOffset | throws if offset out-of-range or in-use

## size() [1/2]

size_t size | ( |  | ) | const

inline

Return the number of attributes in this set.

## size() [2/2]

size_t size | ( |  | ) | const

inline

Return the number of attributes in this descriptor.

## type()

const NamePair & type | ( | size_t | pos | ) | const

Return the name of the attribute array's type.

## uniqueGroupName()

const Name uniqueGroupName | ( | const Name & | name | ) | const

Return a unique name for a group based on given name.

## uniqueName()

const Name uniqueName | ( | const Name & | name | ) | const

Return a unique name for an attribute array based on given name.

## unusedGroupOffset()

size_t unusedGroupOffset | ( | size_t | hint = `std::numeric_limits< size_t >::max()` | ) | const

Return a group offset that is not in use.

Parameters

  hint | if provided, request a specific offset as a hint

Returns
  index of an offset or size_t max if no available group offsets

## unusedGroups()

size_t 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

## validName()

static bool validName | ( | const Name & | name | ) |

static

Return true if the name is valid.

## valueType()

const Name & valueType | ( | size_t | pos | ) | const

Return the name of the attribute array's type.

## write() [1/2]

void write | ( | std::ostream & |  | ) | const

Serialize this descriptor to the given stream.

## write() [2/2]

void write | ( | std::ostream & | ,
|  | bool | outputTransient = `false`
| ) |  | const

Write the entire set to a stream.

Parameters

  outputTransient | if true, write out transient attributes

## writeAttributes()

void writeAttributes | ( | std::ostream & | ,
|  | bool | outputTransient = `false`
| ) |  | const

This will write the attribute data to a stream.

Parameters

  outputTransient | if true, write out transient attributes

## writeDescriptor()

void writeDescriptor | ( | std::ostream & | ,
|  | bool | outputTransient = `false`
| ) |  | const

This will write the attribute descriptor to a stream.

Parameters

  outputTransient | if true, write out transient attributes

## writeMetadata()

void writeMetadata | ( | std::ostream & | ,
|  | bool | outputTransient = `false`,
|  | bool | paged = `false`
| ) |  | const

This will write the attribute metadata to a stream.

Parameters

  outputTransient | if true, write out transient attributes
  paged | if true, data is written out in pages

## Friends And Related Symbol Documentation

## ::TestAttributeSet

friend class ::TestAttributeSet

friend