Loading...
Searching...
No Matches
Metadata Class Referenceabstract

Base class for storing metadata information in a grid. More...

`#include <openvdb/Metadata.h>`

Inheritance diagram for Metadata:

## Public Types

using | Ptr = SharedPtr<Metadata>
using | ConstPtr = SharedPtr<const Metadata>

## Public Member Functions

| Metadata ()
virtual | ~Metadata ()
| Metadata (const Metadata &)=delete
Metadata & | operator= (const Metadata &)=delete
virtual Name | typeName () const =0
| Return the type name of the metadata.
virtual Metadata::Ptr | copy () const =0
| Return a copy of the metadata.
virtual void | copy (const Metadata &other)=0
| Copy the given metadata into this metadata.
virtual std::string | str () const =0
| Return a textual representation of this metadata.
virtual bool | asBool () const =0
bool | operator== (const Metadata &other) const
| Return `true` if the given metadata is equivalent to this metadata.
bool | operator!= (const Metadata &other) const
| Return `true` if the given metadata is different from this metadata.
virtual Index32 | size () const =0
| Return the size of this metadata in bytes.
void | read (std::istream &)
| Unserialize this metadata from a stream.
void | write (std::ostream &) const
| Serialize this metadata to a stream.

## Static Public Member Functions

static Metadata::Ptr | createMetadata (const Name &typeName)
| Create new metadata of the given type.
static bool | isRegisteredType (const Name &typeName)
| Return `true` if the given type is known by the metadata type registry.
static void | clearRegistry ()
| Clear out the metadata registry.
static void | registerType (const Name &typeName, Metadata::Ptr(*createMetadata)())
| Register the given metadata type along with a factory function.
static void | unregisterType (const Name &typeName)

## Protected Member Functions

void | writeSize (std::ostream &) const
| Write the size of the metadata to a stream.
virtual void | readValue (std::istream &, Index32 numBytes)=0
| Read the metadata from a stream.
virtual void | writeValue (std::ostream &) const =0
| Write the metadata to a stream.

## Static Protected Member Functions

static Index32 | readSize (std::istream &)
| Read the size of the metadata from a stream.

## Detailed Description

Base class for storing metadata information in a grid.

## Member Typedef Documentation

## ConstPtr

using ConstPtr = SharedPtr<const Metadata>

## Ptr

using Ptr = SharedPtr<Metadata>

## Constructor & Destructor Documentation

## Metadata() [1/2]

Metadata | ( |  | ) |

inline

## ~Metadata()

virtual ~Metadata | ( |  | ) |

inline virtual

## Metadata() [2/2]

Metadata | ( | const Metadata & |  | ) |

delete

## Member Function Documentation

## asBool()

virtual bool asBool | ( |  | ) | const

pure virtual

Return the boolean representation of this metadata (empty strings and zeroVals evaluate to false; most other values evaluate to true).

Implemented in DelayedLoadMetadata, TypedMetadata< T >, TypedMetadata< bool >, TypedMetadata< double >, TypedMetadata< float >, TypedMetadata< int32_t >, TypedMetadata< int64_t >, TypedMetadata< Mat4d >, TypedMetadata< Mat4s >, TypedMetadata< std::string >, TypedMetadata< Vec2d >, TypedMetadata< Vec2i >, TypedMetadata< Vec2s >, TypedMetadata< Vec3d >, TypedMetadata< Vec3i >, TypedMetadata< Vec3s >, TypedMetadata< Vec4d >, TypedMetadata< Vec4i >, TypedMetadata< Vec4s >, and UnknownMetadata.

## clearRegistry()

void clearRegistry | ( |  | ) |

static

Clear out the metadata registry.

## copy() [1/2]

virtual Metadata::Ptr copy | ( |  | ) | const

pure virtual

Return a copy of the metadata.

Implemented in DelayedLoadMetadata, TypedMetadata< T >, TypedMetadata< bool >, TypedMetadata< double >, TypedMetadata< float >, TypedMetadata< int32_t >, TypedMetadata< int64_t >, TypedMetadata< Mat4d >, TypedMetadata< Mat4s >, TypedMetadata< std::string >, TypedMetadata< Vec2d >, TypedMetadata< Vec2i >, TypedMetadata< Vec2s >, TypedMetadata< Vec3d >, TypedMetadata< Vec3i >, TypedMetadata< Vec3s >, TypedMetadata< Vec4d >, TypedMetadata< Vec4i >, TypedMetadata< Vec4s >, and UnknownMetadata.

## copy() [2/2]

virtual void copy | ( | const Metadata & | other | ) |

pure virtual

Copy the given metadata into this metadata.

Implemented in DelayedLoadMetadata, TypedMetadata< T >, TypedMetadata< bool >, TypedMetadata< double >, TypedMetadata< float >, TypedMetadata< int32_t >, TypedMetadata< int64_t >, TypedMetadata< Mat4d >, TypedMetadata< Mat4s >, TypedMetadata< std::string >, TypedMetadata< Vec2d >, TypedMetadata< Vec2i >, TypedMetadata< Vec2s >, TypedMetadata< Vec3d >, TypedMetadata< Vec3i >, TypedMetadata< Vec3s >, TypedMetadata< Vec4d >, TypedMetadata< Vec4i >, TypedMetadata< Vec4s >, and UnknownMetadata.

## createMetadata()

Metadata::Ptr createMetadata | ( | const Name & | typeName | ) |

static

Create new metadata of the given type.

## isRegisteredType()

bool isRegisteredType | ( | const Name & | typeName | ) |

static

Return `true` if the given type is known by the metadata type registry.

## operator!=()

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

inline

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

## operator=()

Metadata & operator= | ( | const Metadata & |  | ) |

delete

## operator==()

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

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

## read()

void read | ( | std::istream & | is | ) |

inline

Unserialize this metadata from a stream.

## readSize()

Index32 readSize | ( | std::istream & | is | ) |

inline static protected

Read the size of the metadata from a stream.

## readValue()

virtual void readValue | ( | std::istream & | ,
|  | Index32 | numBytes )

protected pure virtual

Read the metadata from a stream.

Implemented in DelayedLoadMetadata, TypedMetadata< T >, TypedMetadata< bool >, TypedMetadata< double >, TypedMetadata< float >, TypedMetadata< int32_t >, TypedMetadata< int64_t >, TypedMetadata< Mat4d >, TypedMetadata< Mat4s >, TypedMetadata< std::string >, TypedMetadata< Vec2d >, TypedMetadata< Vec2i >, TypedMetadata< Vec2s >, TypedMetadata< Vec3d >, TypedMetadata< Vec3i >, TypedMetadata< Vec3s >, TypedMetadata< Vec4d >, TypedMetadata< Vec4i >, TypedMetadata< Vec4s >, and UnknownMetadata.

## registerType()

void registerType | ( | const Name & | typeName,
|  | Metadata::Ptr(* | createMetadata )() )

static

Register the given metadata type along with a factory function.

## size()

virtual Index32 size | ( |  | ) | const

pure virtual

Return the size of this metadata in bytes.

Implemented in DelayedLoadMetadata, TypedMetadata< T >, TypedMetadata< bool >, TypedMetadata< double >, TypedMetadata< float >, TypedMetadata< int32_t >, TypedMetadata< int64_t >, TypedMetadata< Mat4d >, TypedMetadata< Mat4s >, TypedMetadata< std::string >, TypedMetadata< Vec2d >, TypedMetadata< Vec2i >, TypedMetadata< Vec2s >, TypedMetadata< Vec3d >, TypedMetadata< Vec3i >, TypedMetadata< Vec3s >, TypedMetadata< Vec4d >, TypedMetadata< Vec4i >, TypedMetadata< Vec4s >, and UnknownMetadata.

## str()

virtual std::string str | ( |  | ) | const

pure virtual

Return a textual representation of this metadata.

Implemented in DelayedLoadMetadata, TypedMetadata< T >, TypedMetadata< T >, TypedMetadata< bool >, TypedMetadata< bool >, TypedMetadata< double >, TypedMetadata< double >, TypedMetadata< float >, TypedMetadata< float >, TypedMetadata< int32_t >, TypedMetadata< int32_t >, TypedMetadata< int64_t >, TypedMetadata< int64_t >, TypedMetadata< Mat4d >, TypedMetadata< Mat4d >, TypedMetadata< Mat4s >, TypedMetadata< Mat4s >, TypedMetadata< std::string >, TypedMetadata< std::string >, TypedMetadata< Vec2d >, TypedMetadata< Vec2d >, TypedMetadata< Vec2i >, TypedMetadata< Vec2i >, TypedMetadata< Vec2s >, TypedMetadata< Vec2s >, TypedMetadata< Vec3d >, TypedMetadata< Vec3d >, TypedMetadata< Vec3i >, TypedMetadata< Vec3i >, TypedMetadata< Vec3s >, TypedMetadata< Vec3s >, TypedMetadata< Vec4d >, TypedMetadata< Vec4d >, TypedMetadata< Vec4i >, TypedMetadata< Vec4i >, TypedMetadata< Vec4s >, TypedMetadata< Vec4s >, and UnknownMetadata.

## typeName()

virtual Name typeName | ( |  | ) | const

pure virtual

Return the type name of the metadata.

Implemented in DelayedLoadMetadata, TypedMetadata< T >, TypedMetadata< bool >, TypedMetadata< double >, TypedMetadata< float >, TypedMetadata< int32_t >, TypedMetadata< int64_t >, TypedMetadata< Mat4d >, TypedMetadata< Mat4s >, TypedMetadata< std::string >, TypedMetadata< Vec2d >, TypedMetadata< Vec2i >, TypedMetadata< Vec2s >, TypedMetadata< Vec3d >, TypedMetadata< Vec3i >, TypedMetadata< Vec3s >, TypedMetadata< Vec4d >, TypedMetadata< Vec4i >, TypedMetadata< Vec4s >, and UnknownMetadata.

## unregisterType()

void unregisterType | ( | const Name & | typeName | ) |

static

## write()

void write | ( | std::ostream & | os | ) | const

inline

Serialize this metadata to a stream.

## writeSize()

void writeSize | ( | std::ostream & | os | ) | const

inline protected

Write the size of the metadata to a stream.

## writeValue()

virtual void writeValue | ( | std::ostream & |  | ) | const

protected pure virtual

Write the metadata to a stream.

Implemented in DelayedLoadMetadata, TypedMetadata< T >, TypedMetadata< bool >, TypedMetadata< double >, TypedMetadata< float >, TypedMetadata< int32_t >, TypedMetadata< int64_t >, TypedMetadata< Mat4d >, TypedMetadata< Mat4s >, TypedMetadata< std::string >, TypedMetadata< Vec2d >, TypedMetadata< Vec2i >, TypedMetadata< Vec2s >, TypedMetadata< Vec3d >, TypedMetadata< Vec3i >, TypedMetadata< Vec3s >, TypedMetadata< Vec4d >, TypedMetadata< Vec4i >, TypedMetadata< Vec4s >, and UnknownMetadata.