Alembic Version 1.1
Loading...
Searching...
No Matches
Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData Class Reference

#include <MetaData.h>

Public Types

typedef Alembic::Util::TokenMap token_map_type
 
typedef token_map_type::key_type key_type
 
typedef token_map_type::data_type data_type
 
typedef token_map_type::value_type value_type
 
typedef token_map_type::const_reference const_reference
 
typedef token_map_type::const_iterator const_iterator
 
typedef token_map_type::const_reverse_iterator const_reverse_iterator
 

Public Member Functions

 MetaData ()
 
 MetaData (const MetaData &iCopy)
 
MetaDataoperator= (const MetaData &iCopy)
 
void deserialize (const std::string &iFrom)
 
std::string serialize () const
 
size_t size () const
 
const_iterator begin () const
 
const_iterator end () const
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
void set (const std::string &iKey, const std::string &iData)
 
void setUnique (const std::string &iKey, const std::string &iData)
 
std::string get (const std::string &iKey) const
 
std::string getRequired (const std::string &iKey) const
 
void append (const MetaData &iMetaData)
 
void appendOnlyUnique (const MetaData &iMetaData)
 
void appendUnique (const MetaData &iMetaData)
 
bool matches (const MetaData &iMetaData) const
 
bool matchesOverlap (const MetaData &iMetaData) const
 
bool matchesExactly (const MetaData &iMetaData) const
 

Detailed Description

The MetaData class lies at the core of Alembic's notion of "Object and Property Identity". It is a refinement of the idea of Protocol (for Objects) and Interpretation (for Properties) in OpenGTO. It is, essentially, an UNORDERED, UNIQUE DICTIONARY of strings. It turns itself into a regular string for serialization and deserialization. This is not a virtual class, nor is it intended to be used as a base for derivation. It is explicitly declared and implemented as part of the AbcCoreAbstract library. It is composed (not inherited) from Alembic::Util::TokenMap. In order to not have duplicated (and possibly conflicting) policy implementation, we present this class here as a MOSTLY-WRITE-ONCE interface, with selective exception throwing behavior for failed writes.

Definition at line 59 of file MetaData.h.

Member Typedef Documentation

◆ const_iterator

const_iterator typedef this dereferences to a const value_type reference.

Definition at line 89 of file MetaData.h.

◆ const_reference

Const reference type This is what the iterators dereference to.

Definition at line 85 of file MetaData.h.

◆ const_reverse_iterator

const_reverse_iterator typedef this dereferences to a const value_type instance.

Definition at line 93 of file MetaData.h.

◆ data_type

Data type. Data is associated with a key, with each key being unique.

Definition at line 76 of file MetaData.h.

◆ key_type

Key type. Keys are unique within each MetaData instance.

Definition at line 72 of file MetaData.h.

◆ token_map_type

Our internals are handled by a TokenMap, which we expose through these typedefs.

Definition at line 68 of file MetaData.h.

◆ value_type

Value-type This is what the MetaData class "contains", when viewed as a standard container.

Definition at line 81 of file MetaData.h.

Constructor & Destructor Documentation

◆ MetaData() [1/2]

Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::MetaData ( )
inline

Default constructor creates an empty dictionary. ...

Definition at line 101 of file MetaData.h.

◆ MetaData() [2/2]

Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::MetaData ( const MetaData iCopy)
inline

Copy constructor copies another MetaData. ...

Definition at line 105 of file MetaData.h.

Member Function Documentation

◆ append()

void Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::append ( const MetaData iMetaData)
inline

append appends the given MetaData to this class. Duplicates are overwritten.

Definition at line 211 of file MetaData.h.

References begin(), end(), and set().

+ Here is the call graph for this function:

◆ appendOnlyUnique()

void Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::appendOnlyUnique ( const MetaData iMetaData)
inline

append appends the given MetaData to this class. Duplicate keys are ignored, and the original value remains untouched

Definition at line 222 of file MetaData.h.

References begin(), end(), set(), and Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::tokenExists().

+ Here is the call graph for this function:

◆ appendUnique()

void Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::appendUnique ( const MetaData iMetaData)
inline

append appends the given MetaData to this class. Duplicate values will cause an exception to be thrown.

Definition at line 236 of file MetaData.h.

References begin(), end(), and setUnique().

+ Here is the call graph for this function:

◆ begin()

const_iterator Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::begin ( ) const
inline

Returns a const_iterator corresponding to the beginning of the MetaData or the end of the MetaData if empty.

Definition at line 148 of file MetaData.h.

References Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::begin().

Referenced by append(), appendOnlyUnique(), appendUnique(), matches(), and matchesOverlap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deserialize()

void Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::deserialize ( const std::string &  iFrom)
inline

Deserialization will replace the contents of this class with the parsed contents of a string. It will just clear the contents first. It will throw an exception if the string is mal-formed.

Definition at line 123 of file MetaData.h.

References Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::clear(), and Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::setUnique().

+ Here is the call graph for this function:

◆ end()

const_iterator Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::end ( ) const
inline

Returns a const_iterator corresponding to the end of the MetaData.

Definition at line 152 of file MetaData.h.

References Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::end().

Referenced by append(), appendOnlyUnique(), appendUnique(), matches(), and matchesOverlap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get()

std::string Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::get ( const std::string &  iKey) const
inline

get returns the value, or an empty string if it is not set. ...

Definition at line 192 of file MetaData.h.

References Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::value().

Referenced by Alembic::Abc::ALEMBIC_VERSION_NS::ISchema< INFO >::ISchema(), Alembic::Abc::ALEMBIC_VERSION_NS::ISchemaObject< SCHEMA >::ISchemaObject(), Alembic::Abc::ALEMBIC_VERSION_NS::ISchemaObject< SCHEMA >::ISchemaObject(), Alembic::Abc::ALEMBIC_VERSION_NS::ISchemaObject< SCHEMA >::ISchemaObject(), Alembic::Abc::ALEMBIC_VERSION_NS::ITypedArrayProperty< TRAITS >::ITypedArrayProperty(), Alembic::Abc::ALEMBIC_VERSION_NS::ITypedArrayProperty< TRAITS >::ITypedArrayProperty(), Alembic::Abc::ALEMBIC_VERSION_NS::ITypedScalarProperty< TRAITS >::ITypedScalarProperty(), Alembic::Abc::ALEMBIC_VERSION_NS::ITypedScalarProperty< TRAITS >::ITypedScalarProperty(), Alembic::Abc::ALEMBIC_VERSION_NS::OTypedScalarProperty< TRAITS >::OTypedScalarProperty(), Alembic::AbcGeom::ALEMBIC_VERSION_NS::ITypedGeomParam< TRAITS >::getArrayExtent(), Alembic::AbcGeom::ALEMBIC_VERSION_NS::GetGeometryScope(), Alembic::AbcGeom::ALEMBIC_VERSION_NS::IsGeomParam(), Alembic::Abc::ALEMBIC_VERSION_NS::ISchema< INFO >::matches(), Alembic::Abc::ALEMBIC_VERSION_NS::ISchemaObject< SCHEMA >::matches(), Alembic::Abc::ALEMBIC_VERSION_NS::ITypedArrayProperty< TRAITS >::matches(), Alembic::Abc::ALEMBIC_VERSION_NS::ITypedScalarProperty< TRAITS >::matches(), Alembic::Abc::ALEMBIC_VERSION_NS::OSchema< INFO >::matches(), Alembic::Abc::ALEMBIC_VERSION_NS::OSchemaObject< SCHEMA >::matches(), Alembic::Abc::ALEMBIC_VERSION_NS::OTypedArrayProperty< TRAITS >::matches(), Alembic::Abc::ALEMBIC_VERSION_NS::OTypedScalarProperty< TRAITS >::matches(), Alembic::AbcGeom::ALEMBIC_VERSION_NS::IGeomBase::matches(), Alembic::AbcGeom::ALEMBIC_VERSION_NS::ITypedGeomParam< TRAITS >::matches(), Alembic::AbcGeom::ALEMBIC_VERSION_NS::OTypedGeomParam< TRAITS >::matches(), matches(), and matchesOverlap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRequired()

std::string Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::getRequired ( const std::string &  iKey) const
inline

getRequired returns the value, and throws an exception if it is not found.

Definition at line 199 of file MetaData.h.

References ABCA_THROW, and Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::value().

+ Here is the call graph for this function:

◆ matches()

bool Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::matches ( const MetaData iMetaData) const
inline

The matches function returns true if each of the fields in the passed iMetaData are found in this instance and have the same values. it returns false otherwise. This is not the same as "equals", because this MetaData may contain fields that are not included in the passed iMetaData. This should be the default "matching" function.

Definition at line 256 of file MetaData.h.

References begin(), end(), and get().

+ Here is the call graph for this function:

◆ matchesExactly()

bool Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::matchesExactly ( const MetaData iMetaData) const
inline

the matchesExactly function returns true if we're exactly equal in every field. This is a rarely useful concept with MetaData. It is for this reason that we explicitly do not overload the == operator.

Definition at line 288 of file MetaData.h.

References Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::exactMatch().

+ Here is the call graph for this function:

◆ matchesOverlap()

bool Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::matchesOverlap ( const MetaData iMetaData) const
inline

The matchesExisting function returns true if, for each of the fields in the passed iMetaData, we have either no entry, or the same entry.

Definition at line 271 of file MetaData.h.

References begin(), end(), and get().

+ Here is the call graph for this function:

◆ operator=()

MetaData & Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::operator= ( const MetaData iCopy)
inline

Assignment operator copies the contents of another MetaData instance.

Definition at line 109 of file MetaData.h.

◆ rbegin()

const_reverse_iterator Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::rbegin ( ) const
inline

Returns a const_reverse_iterator corresponding to the beginning of the MetaData or the end of the MetaData if empty.

Definition at line 156 of file MetaData.h.

References Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::rbegin().

+ Here is the call graph for this function:

◆ rend()

const_reverse_iterator Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::rend ( ) const
inline

Returns an const_reverse_iterator corresponding to the end of the MetaData.

Definition at line 160 of file MetaData.h.

References Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::rend().

+ Here is the call graph for this function:

◆ serialize()

std::string Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::serialize ( ) const
inline

Serialization will convert the contents of this MetaData into a single string.

Definition at line 132 of file MetaData.h.

References Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::get().

+ Here is the call graph for this function:

◆ set()

void Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::set ( const std::string &  iKey,
const std::string &  iData 
)
inline

set lets you set a key/data pair. This will silently overwrite an existing value.

Definition at line 168 of file MetaData.h.

References Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::setValue().

Referenced by Alembic::Abc::ALEMBIC_VERSION_NS::OSchemaObject< SCHEMA >::OSchemaObject(), Alembic::AbcGeom::ALEMBIC_VERSION_NS::OTypedGeomParam< TRAITS >::OTypedGeomParam(), append(), appendOnlyUnique(), Alembic::Abc::ALEMBIC_VERSION_NS::CreateArchiveWithInfo(), and Alembic::AbcGeom::ALEMBIC_VERSION_NS::SetGeometryScope().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUnique()

void Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::setUnique ( const std::string &  iKey,
const std::string &  iData 
)
inline

setUnique lets you set a key/data pair, but throws an exception if you attempt to change the value of an existing field. It is fine if you set the same value.

Remarks
Not the most efficient implementation at the moment.

Definition at line 177 of file MetaData.h.

References ABCA_THROW, Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::setValue(), and Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::value().

Referenced by appendUnique().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ size()

size_t Alembic::AbcCoreAbstract::ALEMBIC_VERSION_NS::MetaData::size ( ) const
inline

Definition at line 140 of file MetaData.h.

References Alembic::Util::ALEMBIC_VERSION_NS::TokenMap::size().

+ Here is the call graph for this function:

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