Go to the documentation of this file.
31 #ifndef OPENVDB_METADATA_METAMAP_HAS_BEEN_INCLUDED
32 #define OPENVDB_METADATA_METAMAP_HAS_BEEN_INCLUDED
70 void readMeta(std::istream&);
72 void writeMeta(std::ostream&)
const;
85 void insertMeta(
const MetaMap&);
88 void removeMeta(
const Name&);
98 template<
typename T>
typename T::Ptr getMetadata(
const Name&);
101 template<
typename T>
typename T::ConstPtr getMetadata(
const Name&)
const;
107 template<
typename T> T& metaValue(
const Name&);
108 template<
typename T>
const T& metaValue(
const Name&)
const;
121 std::string str(
const std::string& indent =
"")
const;
139 std::ostream&
operator<<(std::ostream&,
const MetaMap&);
146 MetaMap::operator[](
const Name& name)
149 return (iter == mMeta.end() ?
Metadata::Ptr() : iter->second);
153 MetaMap::operator[](
const Name &name)
const
156 return (iter == mMeta.end() ?
Metadata::Ptr() : iter->second);
164 inline typename T::Ptr
165 MetaMap::getMetadata(
const Name &name)
168 if (iter == mMeta.end())
return typename T::Ptr{};
174 if (iter->second->typeName() == T::staticTypeName()) {
175 return StaticPtrCast<T, Metadata>(iter->second);
177 return typename T::Ptr{};
181 inline typename T::ConstPtr
182 MetaMap::getMetadata(
const Name &name)
const
185 if (iter == mMeta.end())
return typename T::ConstPtr{};
191 if (iter->second->typeName() == T::staticTypeName()) {
192 return StaticPtrCast<const T, const Metadata>(iter->second);
194 return typename T::ConstPtr{};
203 MetaMap::getValidTypedMetadata(
const Name &name)
const
205 ConstMetaIterator iter = mMeta.find(name);
214 m = StaticPtrCast<TypedMetadata<T>,
Metadata>(iter->second);
216 if (!m)
OPENVDB_THROW(TypeError,
"Invalid type for metadata " << name);
226 MetaMap::metaValue(
const Name &name)
235 MetaMap::metaValue(
const Name &name)
const
244 #endif // OPENVDB_METADATA_METAMAP_HAS_BEEN_INCLUDED
std::string Name
Definition: Name.h:44
Definition: Exceptions.h:87
std::shared_ptr< T > SharedPtr
Definition: Types.h:139
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:180
#define OPENVDB_VERSION_NAME
Definition: version.h:134
std::ostream & operator<<(std::ostream &, const MetaMap &)
Write a MetaMap to an output stream.
Definition: Exceptions.h:40
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:498
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:109