bioformats  5.1.3
Public Member Functions | Private Attributes | List of all members
ome::xml::model::detail::OMEModel Class Reference

OME model (concrete implementation). More...

#include <ome/xml/model/detail/OMEModel.h>

+ Inheritance diagram for ome::xml::model::detail::OMEModel:
+ Collaboration diagram for ome::xml::model::detail::OMEModel:

Public Member Functions

 OMEModel ()
 Constructor.
 
 ~OMEModel ()
 Destructor.
 
ome::compat::shared_ptr< ::ome::xml::model::OMEModelObjectaddModelObject (const std::string &id, ome::compat::shared_ptr< ::ome::xml::model::OMEModelObject > &object)
 Add a model object to the model. More...
 
ome::compat::shared_ptr< ::ome::xml::model::OMEModelObjectremoveModelObject (const std::string &id)
 Remove a model object from the model. More...
 
ome::compat::shared_ptr< ::ome::xml::model::OMEModelObjectgetModelObject (const std::string &id) const
 Retrieve a model object from the model. More...
 
const object_map_typegetModelObjects () const
 Retrieve all model objects from the model. More...
 
bool addReference (ome::compat::shared_ptr< ::ome::xml::model::OMEModelObject > &a, ome::compat::shared_ptr< Reference > &b)
 Add a reference to a model object. More...
 
const reference_map_typegetReferences () const
 Retrieve all references from the model. More...
 
size_type resolveReferences ()
 Resolve all references. More...
 
- Public Member Functions inherited from ome::xml::model::OMEModel
virtual ome::compat::shared_ptr< OMEModelObjectaddModelObject (const std::string &id, ome::compat::shared_ptr< OMEModelObject > &object)=0
 Add a model object to the model. More...
 
virtual bool addReference (ome::compat::shared_ptr< OMEModelObject > &a, ome::compat::shared_ptr< Reference > &b)=0
 Add a reference to a model object. More...
 

Private Attributes

ome::common::Logger logger
 Message logger.
 
object_map_type modelObjects
 Mapping of id to model object.
 
reference_map_type references
 Mapping of model object to reference.
 

Additional Inherited Members

- Public Types inherited from ome::xml::model::OMEModel
typedef std::vector< ome::compat::shared_ptr< Reference > > reference_list_type
 A list of Reference objects.
 
typedef std::map< std::string, ome::compat::shared_ptr< OMEModelObject > > object_map_type
 A map of string model object identifiers to model objects.
 
typedef std::map< ome::compat::shared_ptr< OMEModelObject >, reference_list_typereference_map_type
 A map of model objects to list of Reference objects.
 
typedef reference_map_type::size_type size_type
 Size type for reference map.
 
- Protected Member Functions inherited from ome::xml::model::OMEModel
 OMEModel ()
 Constructor.
 

Detailed Description

OME model (concrete implementation).

Member Function Documentation

ome::compat::shared_ptr<::ome::xml::model::OMEModelObject > ome::xml::model::detail::OMEModel::addModelObject ( const std::string &  id,
ome::compat::shared_ptr< ::ome::xml::model::OMEModelObject > &  object 
)

Add a model object to the model.

Note that the concrete implementation will not add types derived from Reference.

Parameters
idthe model object identifier.
objectthe model object to add.
Returns
the model object.
Todo:
What is the point of returning the object? The object is returned under all conditions, even when adding the object failed (e.g. if the object was a Reference). Should it be possible to insert null objects?

References modelObjects.

bool ome::xml::model::detail::OMEModel::addReference ( ome::compat::shared_ptr< ::ome::xml::model::OMEModelObject > &  a,
ome::compat::shared_ptr< Reference > &  b 
)

Add a reference to a model object.

Parameters
athe model object to reference.
bthe reference to add.
Returns
true
Todo:
There is no validation of whether the model object was valid for this model (as for the java implementation). The return type is an artifact of the java map implementation. Consider removing the return type and throwing if the model object is not already present in the object map; or adding the object to the object map implicitly and not throwing.

References references.

ome::compat::shared_ptr<::ome::xml::model::OMEModelObject > ome::xml::model::detail::OMEModel::getModelObject ( const std::string &  id) const
virtual

Retrieve a model object from the model.

Parameters
idthe model object identifier of the model object to retrieve.
Returns
the model object or null if the identifier does not exist.
Todo:
: Would a const reference be better for the return?

Implements ome::xml::model::OMEModel.

References modelObjects.

Referenced by resolveReferences().

+ Here is the caller graph for this function:

const OMEModel::object_map_type & ome::xml::model::detail::OMEModel::getModelObjects ( ) const
virtual

Retrieve all model objects from the model.

Returns
a reference to the object model map.

Implements ome::xml::model::OMEModel.

References modelObjects.

const OMEModel::reference_map_type & ome::xml::model::detail::OMEModel::getReferences ( ) const
virtual

Retrieve all references from the model.

Returns
a reference to the reference map.

Implements ome::xml::model::OMEModel.

References references.

ome::compat::shared_ptr<::ome::xml::model::OMEModelObject > ome::xml::model::detail::OMEModel::removeModelObject ( const std::string &  id)
virtual

Remove a model object from the model.

Parameters
idthe model object identifier of the model object to remove.
Returns
the model object or null if the identifier does not exist.

Implements ome::xml::model::OMEModel.

References modelObjects.

OMEModel::size_type ome::xml::model::detail::OMEModel::resolveReferences ( )
virtual

Resolve all references.

Check for invalid references and null model objects.

Returns
the number of unhandled references.
Todo:
This method is a bit of a wart in the design. The model should not allow invalid references or insertion of null model objects to begin with.

Implements ome::xml::model::OMEModel.

References getModelObject(), logger, and references.


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