OpenVDB
12.0.0
|
Container that maps names (strings) to values of arbitrary types. More...
#include <openvdb/MetaMap.h>
Inherited by GridBase, and MultiResGrid< TreeType >.
Public Types | |
using | Ptr = SharedPtr< MetaMap > |
using | ConstPtr = SharedPtr< const MetaMap > |
using | MetadataMap = std::map< Name, Metadata::Ptr > |
using | MetaIterator = MetadataMap::iterator |
using | ConstMetaIterator = MetadataMap::const_iterator |
Public Member Functions | |
MetaMap () | |
MetaMap (const MetaMap &other) | |
virtual | ~MetaMap () |
MetaMap::Ptr | copyMeta () const |
Return a copy of this map whose fields are shared with this map. More... | |
MetaMap::Ptr | deepCopyMeta () const |
Return a deep copy of this map that shares no data with this map. More... | |
MetaMap & | operator= (const MetaMap &) |
Assign a deep copy of another map to this map. More... | |
void | readMeta (std::istream &) |
Unserialize metadata from the given stream. More... | |
void | writeMeta (std::ostream &) const |
Serialize metadata to the given stream. More... | |
void | insertMeta (const Name &, const Metadata &value) |
Insert a new metadata field or overwrite the value of an existing field. More... | |
void | insertMeta (const MetaMap &) |
Deep copy all of the metadata fields from the given map into this map. More... | |
void | removeMeta (const Name &) |
Remove the given metadata field if it exists. More... | |
template<typename T > | |
T & | metaValue (const Name &) |
Return a reference to the value of type T stored in the given metadata field. More... | |
template<typename T > | |
const T & | metaValue (const Name &) const |
MetaIterator | beginMeta () |
MetaIterator | endMeta () |
ConstMetaIterator | beginMeta () const |
ConstMetaIterator | endMeta () const |
void | clearMetadata () |
size_t | metaCount () const |
std::string | str (const std::string &indent="") const |
Return a string describing this metadata map. Prefix each line with indent. More... | |
bool | operator== (const MetaMap &other) const |
Return true if the given map is equivalent to this map. More... | |
bool | operator!= (const MetaMap &other) const |
Return true if the given map is different from this map. More... | |
Metadata::Ptr | operator[] (const Name &) |
Return a pointer to the metadata with the given name. If no such field exists, return a null pointer. More... | |
Metadata::ConstPtr | operator[] (const Name &) const |
Return a pointer to the metadata with the given name. If no such field exists, return a null pointer. More... | |
template<typename T > | |
T::Ptr | getMetadata (const Name &) |
Return a pointer to a TypedMetadata object of type T and with the given name. If no such field exists or if there is a type mismatch, return a null pointer. More... | |
template<typename T > | |
T::ConstPtr | getMetadata (const Name &) const |
Return a pointer to a TypedMetadata object of type T and with the given name. If no such field exists or if there is a type mismatch, return a null pointer. More... | |
Container that maps names (strings) to values of arbitrary types.
using ConstMetaIterator = MetadataMap::const_iterator |
using MetadataMap = std::map<Name, Metadata::Ptr> |
using MetaIterator = MetadataMap::iterator |
|
inline |
|
inlinevirtual |
|
inline |
|
inline |
|
inline |
MetaMap::Ptr copyMeta | ( | ) | const |
Return a copy of this map whose fields are shared with this map.
MetaMap::Ptr deepCopyMeta | ( | ) | const |
Return a deep copy of this map that shares no data with this map.
|
inline |
|
inline |
|
inline |
Return a pointer to a TypedMetadata object of type T
and with the given name. If no such field exists or if there is a type mismatch, return a null pointer.
|
inline |
Return a pointer to a TypedMetadata object of type T
and with the given name. If no such field exists or if there is a type mismatch, return a null pointer.
Insert a new metadata field or overwrite the value of an existing field.
If a field with the given name doesn't already exist, add a new field. Otherwise, if the new value's type is the same as the existing field's value type, overwrite the existing value with new value.
TypeError | if a field with the given name already exists, but its value type is not the same as the new value's |
ValueError | if the given field name is empty. |
void insertMeta | ( | const MetaMap & | ) |
Deep copy all of the metadata fields from the given map into this map.
TypeError | if any field in the given map has the same name as but a different value type than one of this map's fields. |
|
inline |
|
inline |
Return a reference to the value of type T
stored in the given metadata field.
LookupError | if no field with the given name exists. |
TypeError | if the given field is not of type T . |
|
inline |
|
inline |
Return true
if the given map is different from this map.
bool operator== | ( | const MetaMap & | other | ) | const |
Return true
if the given map is equivalent to this map.
|
inline |
Return a pointer to the metadata with the given name. If no such field exists, return a null pointer.
|
inline |
Return a pointer to the metadata with the given name. If no such field exists, return a null pointer.
void readMeta | ( | std::istream & | ) |
Unserialize metadata from the given stream.
void removeMeta | ( | const Name & | ) |
Remove the given metadata field if it exists.
std::string str | ( | const std::string & | indent = "" | ) | const |
Return a string describing this metadata map. Prefix each line with indent.
void writeMeta | ( | std::ostream & | ) | const |
Serialize metadata to the given stream.