DD::Image::MetaData::Bundle Class Reference

Public Types

typedef Foundry::Property::Base * PropertyPtr
 
typedef std::map< std::string, PropertyPtr, CompareKey > data_t
 all the metadata contained in the bundle
 
typedef data_t::iterator iterator
 iterator over all the metadata
 
typedef data_t::const_iterator const_iterator
 iterator over all the metadata
 

Public Member Functions

 Bundle ()
 create an empty bundle
 
 Bundle (const MetaData::Bundle &otherBundle)
 
void operator= (const MetaData::Bundle &otherBundle)
 
bool operator== (const MetaData::Bundle &otherBundle) const
 compare two bundles. Returns true if they are identical.
 
size_t size () const
 how many metadata elements there are in this bundle
 
iterator begin ()
 get iterator to the first piece of metadata
 
iterator end ()
 get iterator pointing past the last piece of metadata
 
const_iterator begin () const
 get iterator to the first piece of metadata
 
const_iterator end () const
 get iterator pointing past the last piece of metadata
 
iterator find (const char *key)
 find a particular piece of metadata by key. returns end() if not present.
 
iterator find (const std::string &key)
 find a particular piece of metadata by key. returns end() if not present.
 
const_iterator find (const char *key) const
 find a particular piece of metadata by key. returns end() if not present.
 
const_iterator find (const std::string &key) const
 find a particular piece of metadata by key. returns end() if not present.
 
void erase (iterator it)
 remove a particular piece of metadata, without deleting the object
 
void erase (const char *key)
 remove a particular piece of metadata, without deleting the object
 
void erase (const std::string &key)
 remove a particular piece of metadata, without deleting the object
 
const data_tmeta () const
 return the underlying std::map for the metadata
 
PropertyPtr getData (const char *key) const
 return the pointer to the named metadata element
 
PropertyPtr getData (const std::string &key) const
 return the pointer to the named metadata element
 
double getDouble (const char *key) const
 return the named metadata element as a double. this will convert strings to numbers. XXX: need to convert rationals as well.
 
unsigned char getUnsignedChar (const char *key) const
 return the named metadata element as an unsigned int. this will convert strings to numbers. XXX: need to convert rationals as well.
 
std::string getString (const char *key) const
 return the named metadata as a string. this involves converting ints and doubles to strings, and formatting arrays by inserting commas
 
void setDataCopy (const std::string &key, const PropertyPtr &property)
 set the given key to point at a copy of the given object
 
void setDataIfNotNan (const std::string &key, double number)
 set the given key to the given number, if and only if number is not NAN
 
void setDataIfNotEmpty (const std::string &key, const std::string &data)
 set the given key to the given string, if and only if data is not empty
 
void setData (const std::string &key, float data)
 set the given key to the given data
 
void setData (const std::string &key, const float *data, unsigned count)
 set the given key to the given data
 
void setData (const std::string &key, double data)
 set the given key to the given data
 
void setData (const std::string &key, const double *data, unsigned count)
 set the given key to the given data
 
void setData (const std::string &key, int data)
 set the given key to the given data
 
void setData (const std::string &key, const int *data, unsigned count)
 set the given key to the given data
 
template<class T >
void setData (const std::string &key, const std::vector< T > &data)
 set the given key to the given data
 
void setData (const std::string &key, unsigned int data)
 set the given key to the given data
 
void setData (const std::string &key, const std::string &data)
 set the given key to the given data
 
void setData (const std::string &key, const char *data)
 set the given key to the given data
 
void setTimeStamp (const std::string &key, const std::string &timestamp)
 

Protected Member Functions

void setData (const std::string &key, const PropertyPtr &property)
 

Detailed Description

a group of metadata, associated with keys to values. values consist of Doubles, Ints, or Strings, or arrays of same

Member Typedef Documentation

typedef Foundry::Property::Base* DD::Image::MetaData::Bundle::PropertyPtr

opaque data type for the metadata properties themselves. use helper functions isPropertyInt etc to access these

Constructor & Destructor Documentation

DD::Image::MetaData::Bundle::Bundle ( const MetaData::Bundle otherBundle)

create a new bundle based upon other bundles. this will be a deep copy, all the properties will be copied as well.

Member Function Documentation

void DD::Image::MetaData::Bundle::operator= ( const MetaData::Bundle otherBundle)

assign this bundle based upon another bundle. this will be a deep copy, all the properties will be copied as well

void DD::Image::MetaData::Bundle::setData ( const std::string &  key,
const PropertyPtr property 
)
protected

set the given key to point at the given object, which the bundle now takes ownership of

Referenced by setDataIfNotNan().

void DD::Image::MetaData::Bundle::setTimeStamp ( const std::string &  key,
const std::string &  timestamp 
)

set the given key to the given, which is in the format of the timestamp this will reformat 'YYYY:MM:DD HH:MM:SS', 'YYYY:MM:DD:HH:MM:SS', and 'YYYY-MM-DD HH-MM:SS' as the ISO 8601-compliant 'YYYY-MM-DD HH:MM:SS'



©2021 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.thefoundry.co.uk