Odyssey::Model Class Reference

#include <Model.h>

List of all members.

Public Types

typedef std::vector< Model * > ChildList
typedef ContainerIterator<
ChildList > 
ChildIterator
typedef ConstContainerIterator<
ChildList > 
ConstChildIterator
typedef std::set< ModelListener * > ListenerSet

Public Member Functions

 Model ()
 Constructs an empty, unnamed Model.
virtual ~Model ()
void setName (const String &name)
 Sets the name for this Model.
const String & getName () const
 Returns the name of the Model.
Model * getParent () const
 Returns the parent, or 0 if there is none.
void clearChanged ()
 Clear the Model of its changed status.
bool isChanged () const
 Returns true if the Model has been modified.
void linkModel (Model *model)
 Links the given Model's properties to this one's.
void linkModel (ModelPtr model)
 Links the given model's properties to this one's.
void unlinkModel (Model *model)
 Unlinks the given model's properties to this one's.
void unlinkModel (ModelPtr model)
 Unlinks the given model's properties to this one's.
String getPropertyName (PropertyBase *prop) const
 Does a lookup for the name of the given Property.
bool containsProperty (const String &name) const
 Returns true of the givened named property is a member of this model.
PropertyProxy getProperty (const String &name)
 Returns a proxy to the named property.
PropertyIterator getPropertyIterator () const
 Returns an iterator over the contained properties.
void linkProperty (const String &root, const PropertyProxy &leaf)
 Links two properties together so the second is always in sync with the first.
void linkProperty (const String &root, const String &leaf)
 Links two internal properties together so the second is always in sync with the first.
void linkProperty (const String &root, const PropertyProxy &leaf, PropertyLinkPtr link)
 Links two properties together so the second is always in sync with the first.
void linkProperty (const String &root, const String &leaf, PropertyLinkPtr link)
 Links two internal properties together so the second is always in sync with the first.
void unlinkProperty (const String &root, const PropertyProxy &leaf)
 Removes a link between two properties.
void unlinkProperty (const String &root, const String &leaf)
 Removes a link between two internal properties.
void clearLinkedProperties (const String &name)
 Removes all links held by the given root property.
ModelPtr createChild (const String &name)
 Create a new empty Model with the given name in the ModelManager.
ModelPtr createChild (const String &typeID, const String &name)
 Creates anew Model with the given typeid and the given name in the ModelManager.
size_t addChild (Model *model)
 Adds a new child model to this model.
size_t addChild (const String &name)
 Adds a new child with the given name.
size_t addChild (size_t index)
 Adds a new child at the given index.
void removeChild (Model *model)
 Removes the given child.
void removeChild (size_t index)
 Removes the given child.
bool containsChild (const String &name) const
 Returns true if this model has a child with the given name.
Model * getChild (size_t index) const
 Return a child at the given (internal) index.
void clearChildren ()
 Removes all children from this model.
size_t getChildCount () const
 Returns the number of children in this Model.
ChildIterator getChildIterator ()
 Returns an iterator over the Model's children.
ConstChildIterator getChildIterator () const
 Returns an iterator over the Model's children.
void addListener (ModelListener *listener)
void removeListener (ModelListener *listener)
void clearListeners ()
void notifyListeners ()
void notifyListeners (ModelListener *listener)
virtual bool onAdding (Manager< ModelPtr > &) const
virtual bool onRemoving (Manager< ModelPtr > &) const

Protected Types

typedef std::map< String,
PropertyBase * > 
PropertyMap

Protected Member Functions

void registerProperty (const String &name, PropertyBase &prop)
void incChangeState ()
void decChangeState ()

Protected Attributes

String _name
Model * _parent
PropertyMap _properties
ChildList _children
std::set< Model * > _set
ListenerSet _listeners

Friends

class ModelManager
class PropertyBase

Classes

class  PropertyIterator


Detailed Description

This class represents a collection of data in a logical grouping. It supports both runtime static and dynamic polymorphic property lookups.


Member Typedef Documentation

typedef ContainerIterator<ChildList> Odyssey::Model::ChildIterator
 

typedef std::vector<Model*> Odyssey::Model::ChildList
 

typedef ConstContainerIterator<ChildList> Odyssey::Model::ConstChildIterator
 

typedef std::set<ModelListener*> Odyssey::Model::ListenerSet
 

typedef std::map<String,PropertyBase*> Odyssey::Model::PropertyMap [protected]
 


Constructor & Destructor Documentation

Odyssey::Model::Model (   ) 
 

Constructs an empty, unnamed Model.

virtual Odyssey::Model::~Model (   )  [virtual]
 


Member Function Documentation

size_t Odyssey::Model::addChild (  size_t  index  ) 
 

Adds a new child at the given index.

This function uses the given index to look up the model in the ModelManager. This Model is then added to this models' children.

Parameters:
index the child model's index

size_t Odyssey::Model::addChild (  const String &  name  ) 
 

Adds a new child with the given name.

This function uses the given name to look up the model in the ModelManager. This Model is then added to this models' children.

Parameters:
name the child model's name

size_t Odyssey::Model::addChild (  Model *  model  ) 
 

Adds a new child model to this model.

void Odyssey::Model::addListener (  ModelListener *  listener  ) 
 

void Odyssey::Model::clearChanged (   ) 
 

Clear the Model of its changed status.

void Odyssey::Model::clearChildren (   ) 
 

Removes all children from this model.

void Odyssey::Model::clearLinkedProperties (  const String &  name  ) 
 

Removes all links held by the given root property.

void Odyssey::Model::clearListeners (   ) 
 

bool Odyssey::Model::containsChild (  const String &  name  )  const
 

Returns true if this model has a child with the given name.

bool Odyssey::Model::containsProperty (  const String &  name  )  const
 

Returns true of the givened named property is a member of this model.

ModelPtr Odyssey::Model::createChild (  const String &  typeID,
const String &  name
) 
 

Creates anew Model with the given typeid and the given name in the ModelManager.

ModelPtr Odyssey::Model::createChild (  const String &  name  ) 
 

Create a new empty Model with the given name in the ModelManager.

void Odyssey::Model::decChangeState (   )  [protected]
 

Model* Odyssey::Model::getChild (  size_t  index  )  const
 

Return a child at the given (internal) index.

size_t Odyssey::Model::getChildCount (   )  const
 

Returns the number of children in this Model.

ConstChildIterator Odyssey::Model::getChildIterator (   )  const
 

Returns an iterator over the Model's children.

ChildIterator Odyssey::Model::getChildIterator (   ) 
 

Returns an iterator over the Model's children.

const String& Odyssey::Model::getName (   )  const
 

Returns the name of the Model.

Model* Odyssey::Model::getParent (   )  const
 

Returns the parent, or 0 if there is none.

PropertyProxy Odyssey::Model::getProperty (  const String &  name  ) 
 

Returns a proxy to the named property.

PropertyIterator Odyssey::Model::getPropertyIterator (   )  const
 

Returns an iterator over the contained properties.

String Odyssey::Model::getPropertyName (  PropertyBase *  prop  )  const
 

Does a lookup for the name of the given Property.

void Odyssey::Model::incChangeState (   )  [protected]
 

bool Odyssey::Model::isChanged (   )  const [inline]
 

Returns true if the Model has been modified.

void Odyssey::Model::linkModel (  ModelPtr  model  ) 
 

Links the given model's properties to this one's.

void Odyssey::Model::linkModel (  Model *  model  ) 
 

Links the given Model's properties to this one's.

This function finds all the properties with the same names from the two Models and links them together.

Parameters:
Model the Model to link to this one

void Odyssey::Model::linkProperty (  const String &  root,
const String &  leaf,
PropertyLinkPtr  link
) 
 

Links two internal properties together so the second is always in sync with the first.

void Odyssey::Model::linkProperty (  const String &  root,
const PropertyProxy &  leaf,
PropertyLinkPtr  link
) 
 

Links two properties together so the second is always in sync with the first.

void Odyssey::Model::linkProperty (  const String &  root,
const String &  leaf
) 
 

Links two internal properties together so the second is always in sync with the first.

void Odyssey::Model::linkProperty (  const String &  root,
const PropertyProxy &  leaf
) 
 

Links two properties together so the second is always in sync with the first.

void Odyssey::Model::notifyListeners (  ModelListener *  listener  ) 
 

void Odyssey::Model::notifyListeners (   ) 
 

virtual bool Odyssey::Model::onAdding (  Manager< ModelPtr > &   )  const [virtual]
 

virtual bool Odyssey::Model::onRemoving (  Manager< ModelPtr > &   )  const [virtual]
 

void Odyssey::Model::registerProperty (  const String &  name,
PropertyBase &  prop
)  [protected]
 

void Odyssey::Model::removeChild (  size_t  index  ) 
 

Removes the given child.

void Odyssey::Model::removeChild (  Model *  model  ) 
 

Removes the given child.

void Odyssey::Model::removeListener (  ModelListener *  listener  ) 
 

void Odyssey::Model::setName (  const String &  name  ) 
 

Sets the name for this Model.

void Odyssey::Model::unlinkModel (  ModelPtr  model  ) 
 

Unlinks the given model's properties to this one's.

void Odyssey::Model::unlinkModel (  Model *  model  ) 
 

Unlinks the given model's properties to this one's.

void Odyssey::Model::unlinkProperty (  const String &  root,
const String &  leaf
) 
 

Removes a link between two internal properties.

void Odyssey::Model::unlinkProperty (  const String &  root,
const PropertyProxy &  leaf
) 
 

Removes a link between two properties.


Friends And Related Function Documentation

friend class ModelManager [friend]
 

friend class PropertyBase [friend]
 


Member Data Documentation

ChildList Odyssey::Model::_children [protected]
 

ListenerSet Odyssey::Model::_listeners [protected]
 

String Odyssey::Model::_name [protected]
 

Model* Odyssey::Model::_parent [protected]
 

PropertyMap Odyssey::Model::_properties [protected]
 

std::set<Model*> Odyssey::Model::_set [protected]
 


The documentation for this class was generated from the following file:
Generated on Sun Jan 7 01:18:53 2007 for Odyssey Meta-Engine by  doxygen 1.4.6-NO