bioformats  5.1.6
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
ome::xml::model::MapPairs Class Reference

MapPairs model object. More...

#include <ome/xml/model/MapPairs.h>

+ Inheritance diagram for ome::xml::model::MapPairs:
+ Collaboration diagram for ome::xml::model::MapPairs:

Public Types

typedef std::map< std::string, std::string > map_type
 Type of map stored internally.
 

Public Member Functions

 MapPairs ()
 Default constructor.
 
 MapPairs (const MapPairs &copy)
 Copy constructor. More...
 
 MapPairs (const map_type &map)
 Construct from a map. More...
 
 MapPairs (common::xml::dom::Element &element,::ome::xml::model::OMEModel &model)
 Construct a MapPairs recursively from an XML DOM tree. More...
 
virtual ~MapPairs ()
 Destructor.
 
const std::string & elementName () const
 Get the element name of this model object. More...
 
bool validElementName (const std::string &name) const
 Check if a given element name is valid for processing by this model object. More...
 
virtual void update (const common::xml::dom::Element &element,::ome::xml::model::OMEModel &model)
 Update the object hierarchy recursively from an XML DOM tree. More...
 
bool link (ome::compat::shared_ptr< Reference > &reference, ome::compat::shared_ptr< ::ome::xml::model::OMEModelObject > &object)
 Link a given OME model object to this model object. More...
 
map_typegetMap ()
 Get the key-value pair mappings. More...
 
const map_typegetMap () const
 Get the key-value pair mappings. More...
 
void setMap (const map_type &map)
 Set the key-value pair mappings. More...
 
virtual common::xml::dom::Element asXMLElement (common::xml::dom::Document &document) const
 Transform the object hierarchy rooted at this element to XML. More...
 
const std::string & getXMLNamespace () const
 Get the XML namespace for this model object. More...
 
- Public Member Functions inherited from ome::xml::model::detail::OMEModelObject
virtual ~OMEModelObject ()
 Destructor.
 
virtual bool link (ome::compat::shared_ptr< Reference > &reference, ome::compat::shared_ptr< ::ome::xml::model::OMEModelObject > &object)
 Link a given OME model object to this model object. More...
 
- Public Member Functions inherited from ome::xml::model::OMEModelObject
virtual void update (const common::xml::dom::Element &element, OMEModel &model)=0
 Update the object hierarchy recursively from an XML DOM tree. More...
 
virtual bool link (ome::compat::shared_ptr< Reference > &reference, ome::compat::shared_ptr< OMEModelObject > &object)=0
 Link a given OME model object to this model object. More...
 

Protected Member Functions

virtual common::xml::dom::Element asXMLElementInternal (common::xml::dom::Document &document, common::xml::dom::Element &element) const
 Transform the object hierarchy rooted at this element to XML. More...
 
- Protected Member Functions inherited from ome::xml::model::detail::OMEModelObject
 OMEModelObject (const std::string &objectType="OMEModelObject")
 Constructor.
 
 OMEModelObject (const OMEModelObject &copy)
 Copy constructor. More...
 
template<class C , typename T >
bool contains (const C &container, const ome::compat::shared_ptr< T > &element)
 Check if a container contains a particular element. More...
 
- Protected Member Functions inherited from ome::xml::model::OMEModelObject
 OMEModelObject ()
 Constructor.
 

Private Attributes

map_type map
 Key-value pair mappings.
 

Additional Inherited Members

- Static Public Member Functions inherited from ome::xml::model::detail::OMEModelObject
static std::vector< common::xml::dom::ElementgetChildrenByTagName (const common::xml::dom::Element &parent, const std::string &name)
 Retrieve all the children of an element that have a given tag name. More...
 
static std::string stripNamespacePrefix (const std::string &value)
 Strip the namespace prefix from a tag name. More...
 
- Protected Attributes inherited from ome::xml::model::detail::OMEModelObject
ome::common::Logger logger
 Message logger.
 

Detailed Description

MapPairs model object.

Constructor & Destructor Documentation

ome::xml::model::MapPairs::MapPairs ( const MapPairs copy)

Copy constructor.

Parameters
copythe object to copy.
ome::xml::model::MapPairs::MapPairs ( const map_type map)

Construct from a map.

The provided map will be copied into the MapPairs internal map.

Parameters
mapthe map to copy.

References ome::xml::model::detail::OMEModelObject::logger.

ome::xml::model::MapPairs::MapPairs ( common::xml::dom::Element element,
::ome::xml::model::OMEModel model 
)

Construct a MapPairs recursively from an XML DOM tree.

Parameters
elementroot of the XML DOM tree to from which to construct the model object graph.
modelhandler for the OME model used to track instances and references seen during the update.
Exceptions
EnumerationExceptionif there is an error instantiating an enumeration during model object creation.

References update().

Member Function Documentation

common::xml::dom::Element ome::xml::model::MapPairs::asXMLElement ( common::xml::dom::Document document) const
virtual

Transform the object hierarchy rooted at this element to XML.

Parameters
documentdocument for element creation
Returns
an XML DOM tree root element for this model object.

Implements ome::xml::model::OMEModelObject.

References asXMLElementInternal().

common::xml::dom::Element ome::xml::model::MapPairs::asXMLElementInternal ( common::xml::dom::Document document,
common::xml::dom::Element element 
) const
protectedvirtual

Transform the object hierarchy rooted at this element to XML.

This internal implementation of asXMLelement also requires an XML element, which must not be null, or may be instantiated and passed from superclasses.

Parameters
documentXML document for element creation.
elementXML element for setting model data.
Returns
an XML DOM tree root element for this model object.

Implements ome::xml::model::detail::OMEModelObject.

References ome::common::xml::dom::Node::appendChild(), ome::xml::model::detail::OMEModelObject::asXMLElementInternal(), ome::common::xml::dom::Document::createElementNS(), map, ome::common::xml::dom::Element::setAttribute(), and ome::common::xml::dom::Element::setTextContent().

Referenced by asXMLElement().

+ Here is the caller graph for this function:

const std::string & ome::xml::model::MapPairs::elementName ( ) const
virtual

Get the element name of this model object.

This will be the most-derived class name.

Returns
the element type.

Implements ome::xml::model::OMEModelObject.

MapPairs::map_type & ome::xml::model::MapPairs::getMap ( )

Get the key-value pair mappings.

Returns
the map.

References map.

const MapPairs::map_type & ome::xml::model::MapPairs::getMap ( ) const

Get the key-value pair mappings.

Returns
the map.

References map.

const std::string & ome::xml::model::MapPairs::getXMLNamespace ( ) const
virtual

Get the XML namespace for this model object.

Returns
the XML namespace.

Implements ome::xml::model::OMEModelObject.

References ome::xml::model::OME::getXMLNamespace().

bool ome::xml::model::MapPairs::link ( ome::compat::shared_ptr< Reference > &  reference,
ome::compat::shared_ptr< ::ome::xml::model::OMEModelObject > &  object 
)

Link a given OME model object to this model object.

Parameters
referencetype qualifier for the reference. This should be the corresponding reference type for object. If, for example, object is of type Image, reference must be of type ImageRef.
objectModel object to link to.
Returns
true if this model object was able to handle the reference, otherwise false.
Todo:
the use of reference to provide type information for the type of object is unconventional and quite possibly unnecessary–a simple string or type_info would suffice for what it's being used for, if it's needed at all. Is this true for all cases? The implementation also needs to do strict checking of the object type; it's not currently failing if it's of the wrong type. This applies to all generated model objects implementing this interface.

References ome::xml::model::detail::OMEModelObject::link(), and ome::xml::model::detail::OMEModelObject::logger.

void ome::xml::model::MapPairs::setMap ( const map_type map)

Set the key-value pair mappings.

Parameters
mapthe map to set.

References map.

void ome::xml::model::MapPairs::update ( const common::xml::dom::Element element,
::ome::xml::model::OMEModel model 
)
virtual

Update the object hierarchy recursively from an XML DOM tree.

Note
No properties are removed, only added or updated.
Parameters
elementroot of the XML DOM tree to from which to construct the model object graph.
modelhandler for the OME model used to track instances and references seen during the update.
Exceptions
EnumerationExceptionif there is an error instantiating an enumeration during model object creation, or ModelException if there are any consistency or validity errors found during processing.

Reimplemented from ome::xml::model::detail::OMEModelObject.

References ome::xml::model::detail::OMEModelObject::getChildrenByTagName(), ome::common::xml::dom::Element::getTagName(), ome::xml::model::detail::OMEModelObject::logger, map, and ome::xml::model::detail::OMEModelObject::update().

Referenced by MapPairs().

+ Here is the caller graph for this function:

bool ome::xml::model::MapPairs::validElementName ( const std::string &  name) const
virtual

Check if a given element name is valid for processing by this model object.

Used for processing nodes when interitance is involved.

Parameters
namethe element name to check.
Returns
true if valid, false if invalid.

Implements ome::xml::model::detail::OMEModelObject.

References ome::xml::model::detail::OMEModelObject::validElementName().


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