HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
openvdb::OPENVDB_VERSION_NAME::MetaMap Class Reference

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

#include <MetaMap.h>

+ Inheritance diagram for openvdb::OPENVDB_VERSION_NAME::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. More...
 
MetaMap::Ptr deepCopyMeta () const
 Return a deep copy of this map that shares no data with this map. More...
 
MetaMapoperator= (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...
 

Detailed Description

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

Definition at line 46 of file MetaMap.h.

Member Typedef Documentation

using openvdb::OPENVDB_VERSION_NAME::MetaMap::ConstMetaIterator = MetadataMap::const_iterator
Todo:
this should really iterate over a map of Metadata::ConstPtrs

Definition at line 55 of file MetaMap.h.

Definition at line 52 of file MetaMap.h.

Definition at line 53 of file MetaMap.h.

Constructor & Destructor Documentation

openvdb::OPENVDB_VERSION_NAME::MetaMap::MetaMap ( )
inline

Definition at line 57 of file MetaMap.h.

openvdb::OPENVDB_VERSION_NAME::MetaMap::MetaMap ( const MetaMap other)
virtual openvdb::OPENVDB_VERSION_NAME::MetaMap::~MetaMap ( )
inlinevirtual

Definition at line 59 of file MetaMap.h.

Member Function Documentation

MetaIterator openvdb::OPENVDB_VERSION_NAME::MetaMap::beginMeta ( )
inline

Definition at line 111 of file MetaMap.h.

ConstMetaIterator openvdb::OPENVDB_VERSION_NAME::MetaMap::beginMeta ( ) const
inline

Definition at line 113 of file MetaMap.h.

void openvdb::OPENVDB_VERSION_NAME::MetaMap::clearMetadata ( )
inline

Definition at line 116 of file MetaMap.h.

MetaMap::Ptr openvdb::OPENVDB_VERSION_NAME::MetaMap::copyMeta ( ) const

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

MetaMap::Ptr openvdb::OPENVDB_VERSION_NAME::MetaMap::deepCopyMeta ( ) const

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

MetaIterator openvdb::OPENVDB_VERSION_NAME::MetaMap::endMeta ( )
inline

Definition at line 112 of file MetaMap.h.

ConstMetaIterator openvdb::OPENVDB_VERSION_NAME::MetaMap::endMeta ( ) const
inline

Definition at line 114 of file MetaMap.h.

template<typename T >
T::Ptr openvdb::OPENVDB_VERSION_NAME::MetaMap::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.

Definition at line 165 of file MetaMap.h.

template<typename T >
T::ConstPtr openvdb::OPENVDB_VERSION_NAME::MetaMap::getMetadata ( const Name name) const
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.

Definition at line 182 of file MetaMap.h.

void openvdb::OPENVDB_VERSION_NAME::MetaMap::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
TypeErrorif a field with the given name already exists, but its value type is not the same as the new value's
ValueErrorif the given field name is empty.
void openvdb::OPENVDB_VERSION_NAME::MetaMap::insertMeta ( const MetaMap )

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

Exceptions
TypeErrorif any field in the given map has the same name as but a different value type than one of this map's fields.
size_t openvdb::OPENVDB_VERSION_NAME::MetaMap::metaCount ( ) const
inline

Definition at line 118 of file MetaMap.h.

template<typename T >
T & openvdb::OPENVDB_VERSION_NAME::MetaMap::metaValue ( const Name name)
inline

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

Exceptions
LookupErrorif no field with the given name exists.
TypeErrorif the given field is not of type T.

Definition at line 226 of file MetaMap.h.

template<typename T >
const T & openvdb::OPENVDB_VERSION_NAME::MetaMap::metaValue ( const Name name) const
inline

Definition at line 235 of file MetaMap.h.

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

Definition at line 126 of file MetaMap.h.

MetaMap& openvdb::OPENVDB_VERSION_NAME::MetaMap::operator= ( const MetaMap )

Assign a deep copy of another map to this map.

bool openvdb::OPENVDB_VERSION_NAME::MetaMap::operator== ( const MetaMap other) const

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

Metadata::Ptr openvdb::OPENVDB_VERSION_NAME::MetaMap::operator[] ( const Name name)
inline

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

Definition at line 146 of file MetaMap.h.

Metadata::ConstPtr openvdb::OPENVDB_VERSION_NAME::MetaMap::operator[] ( const Name name) const
inline

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

Definition at line 153 of file MetaMap.h.

void openvdb::OPENVDB_VERSION_NAME::MetaMap::readMeta ( std::istream &  )

Unserialize metadata from the given stream.

void openvdb::OPENVDB_VERSION_NAME::MetaMap::removeMeta ( const Name )

Remove the given metadata field if it exists.

std::string openvdb::OPENVDB_VERSION_NAME::MetaMap::str ( const std::string indent = "") const

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

void openvdb::OPENVDB_VERSION_NAME::MetaMap::writeMeta ( std::ostream &  ) const

Serialize metadata to the given stream.


The documentation for this class was generated from the following file: