Loading...
Searching...
No Matches
MetaMap Class Reference

Container that maps names (strings) to values of arbitrary types. More...

`#include <openvdb/MetaMap.h>`

Inheritance diagram for MetaMap:

## 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.
MetaMap::Ptr | deepCopyMeta () const
| Return a deep copy of this map that shares no data with this map.
MetaMap & | operator= (const MetaMap &)
| Assign a deep copy of another map to this map.
void | readMeta (std::istream &)
| Unserialize metadata from the given stream.
void | writeMeta (std::ostream &) const
| Serialize metadata to the given stream.
void | insertMeta (const Name &, const Metadata &value)
| Insert a new metadata field or overwrite the value of an existing field.
void | insertMeta (const MetaMap &)
| Deep copy all of the metadata fields from the given map into this map.
void | removeMeta (const Name &)
| Remove the given metadata field if it exists.
Metadata::Ptr | operator[] (const Name &)
| Return a pointer to the metadata with the given name. If no such field exists, return a null pointer.
Metadata::ConstPtr | operator[] (const Name &) const
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.
template<typename T>
T::ConstPtr | getMetadata (const Name &) const
template<typename T>
T & | metaValue (const Name &)
| Return a reference to the value of type `T` stored in the given metadata field.
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.
bool | operator== (const MetaMap &other) const
| Return `true` if the given map is equivalent to this map.
bool | operator!= (const MetaMap &other) const
| Return `true` if the given map is different from this map.

## Detailed Description

Container that maps names (strings) to values of arbitrary types.

## Member Typedef Documentation

## ConstMetaIterator

using ConstMetaIterator = MetadataMap::const_iterator

## ConstPtr

using ConstPtr = SharedPtr<const MetaMap>

## MetadataMap

using MetadataMap = std::map<Name, Metadata::Ptr>

## MetaIterator

using MetaIterator = MetadataMap::iterator

## Ptr

using Ptr = SharedPtr<MetaMap>

## Constructor & Destructor Documentation

## MetaMap() [1/2]

MetaMap | ( |  | ) |

inline

## MetaMap() [2/2]

MetaMap | ( | const MetaMap & | other | ) |

## ~MetaMap()

virtual ~MetaMap | ( |  | ) |

inline virtual

## Member Function Documentation

## beginMeta() [1/2]

MetaIterator beginMeta | ( |  | ) |

inline

## beginMeta() [2/2]

ConstMetaIterator beginMeta | ( |  | ) | const

inline

## clearMetadata()

void clearMetadata | ( |  | ) |

inline

## copyMeta()

MetaMap::Ptr copyMeta | ( |  | ) | const

Return a copy of this map whose fields are shared with this map.

## deepCopyMeta()

MetaMap::Ptr deepCopyMeta | ( |  | ) | const

Return a deep copy of this map that shares no data with this map.

## endMeta() [1/2]

MetaIterator endMeta | ( |  | ) |

inline

## endMeta() [2/2]

ConstMetaIterator endMeta | ( |  | ) | const

inline

## getMetadata() [1/2]

template<typename T>

T::Ptr getMetadata | ( | const Name & | name | ) |

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.

## getMetadata() [2/2]

template<typename T>

T::ConstPtr getMetadata | ( | const Name & | name | ) | const

inline

## insertMeta() [1/2]

void insertMeta | ( | const MetaMap & |  | ) |

Deep copy all of the metadata fields from the given map into this map.

Exceptions

  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.

## insertMeta() [2/2]

void insertMeta | ( | const Name & | ,
|  | const Metadata & | value )

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.

Exceptions

  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.

## metaCount()

size_t metaCount | ( |  | ) | const

inline

## metaValue() [1/2]

template<typename T>

T & metaValue | ( | const Name & | name | ) |

inline

Return a reference to the value of type `T` stored in the given metadata field.

Exceptions

  LookupError | if no field with the given name exists.
  TypeError | if the given field is not of type `T`.

## metaValue() [2/2]

template<typename T>

const T & metaValue | ( | const Name & | name | ) | const

inline

## operator!=()

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

inline

Return `true` if the given map is different from this map.

## operator=()

MetaMap & operator= | ( | const MetaMap & |  | ) |

Assign a deep copy of another map to this map.

## operator==()

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

Return `true` if the given map is equivalent to this map.

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

Metadata::Ptr operator[] | ( | const Name & | name | ) |

inline

Return a pointer to the metadata with the given name. If no such field exists, return a null pointer.

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

Metadata::ConstPtr operator[] | ( | const Name & | name | ) | const

inline

## readMeta()

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

Unserialize metadata from the given stream.

## removeMeta()

void removeMeta | ( | const Name & |  | ) |

Remove the given metadata field if it exists.

## str()

std::string str | ( | const std::string & | indent = "" | ) | const

Return a string describing this metadata map. Prefix each line with indent.

## writeMeta()

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

Serialize metadata to the given stream.