Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

OMF::Model Class Reference

#include <Model.hpp>

List of all members.


Detailed Description

In the OMF, the Model class is central to the entire implementation of the OMG modeling stack. It is the outermost container of all model objects created during modeling activities.


Public Types

enum  Mode { ReadOnly, ReadWrite }

Public Member Functions

 Model ()
 ~Model ()
const std::string & fileName () const
void setFileName (const std::string &fname)
const std::string & path () const
void setPath (const std::string &path)
Mode mode () const
void setMode (Mode mode)
bool read (const char *filename)
bool write (const char *filename)
const std::list< ModelObject * > & elements () const
void addElement (ModelObject *elem)
void removeElement (ModelObject *elem)
void identifyElement (ModelObject *elem)
ModelObjectfindElement (const std::string &id)
void enableIdentification (bool id)
std::string generateId ()
void nextId ()
unsigned currentId () const
const std::set< Package * > metamodels () const
void addMetamodel (Package *pkg)


Member Enumeration Documentation

enum OMF::Model::Mode
 

Defines the mode in which the file is opened. By default, the mode is ReadWrite, but if the permissions on a file are read only, the mode is set to read only.

Enumeration values:
ReadOnly 
ReadWrite 


Constructor & Destructor Documentation

OMF::Model::Model  ) 
 

OMF::Model::~Model  ) 
 


Member Function Documentation

void OMF::Model::addElement ModelObject elem  ) 
 

Add a new top level element to the model. This method ensures that all subordinate elements (in the containment tree) have their owning model set to this and their ids are allocated appropriately.

void OMF::Model::addMetamodel Package pkg  ) 
 

Add a new metamodel for this model.

unsigned OMF::Model::currentId  )  const
 

Pretty much just used for debugging. Returns the current id allocator value.

const std::list<ModelObject *>& OMF::Model::elements  )  const
 

Return the list of all top level elements.

void OMF::Model::enableIdentification bool  id  ) 
 

This method is called to disable or enable the generation of ids during XMI parsing.

const std::string& OMF::Model::fileName  )  const
 

Return the filename of the model.

ModelObject* OMF::Model::findElement const std::string &  id  ) 
 

The findElement method is used to find an element by a requested id. As elements are added to the model (either directly or indirectly), they are all added to this mapping.

std::string OMF::Model::generateId  ) 
 

This method generates monotonically increasing ids for elements assigned into this model. The id is basically an integer value that is unique to the context of this model.

void OMF::Model::identifyElement ModelObject elem  ) 
 

This method is used to control the setting of identification and it's mapping into the identity map.

const std::set<Package *> OMF::Model::metamodels  )  const
 

Return the set of metamodels used by this model.

Mode OMF::Model::mode  )  const
 

Return the mode that the model was created/opened in.

void OMF::Model::nextId  ) 
 

Move to the next id.

const std::string& OMF::Model::path  )  const
 

Return the path of the model.

bool OMF::Model::read const char *  filename  ) 
 

Read a model from a file.

void OMF::Model::removeElement ModelObject elem  ) 
 

Remove a top-level model element from the model. This method recursively iterates through the removed element and resets the model pointer for all contained elements.

void OMF::Model::setFileName const std::string &  fname  ) 
 

Set the filename.

void OMF::Model::setMode Mode  mode  ) 
 

Set the mode of the model.

void OMF::Model::setPath const std::string &  path  ) 
 

Set the path to the file.

bool OMF::Model::write const char *  filename  ) 
 

Write a model to the file.


The documentation for this class was generated from the following file:
Generated on Fri Sep 10 13:07:38 2004 for OpenModelingFramework by doxygen 1.3.8