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

OMF::BasicClass< Type, Factory > Class Template Reference

#include <Class.hpp>

Inheritance diagram for OMF::BasicClass< Type, Factory >:

OMF::Class List of all members.

Detailed Description

template<class Type, class Factory = Concrete>
class OMF::BasicClass< Type, Factory >

The GenericClass template is used for boilerplate code generation. Essentially, this class encapsulates a singleton instance of a class proxy. A class proxy acts as both a factory and an extent for classes of model elements. Note that model element classes are not required to use this class. It is provided for convenience, but custom class proxies could also be constructed.


Public Member Functions

virtual ~BasicClass ()
Type * create ()
void destroy (Object *instance)
virtual ObjectcreateInstance ()
virtual void destroyInstance (Object *instance)
const std::string & name () const
const OMF::SetallOfClass () const
const OMF::SetallOfType () const
void addType (Object *type)
void removeType (Object *type)

Static Public Member Functions

Selfinstance (const std::string &name="")

Protected Member Functions

 BasicClass ()
Classinit (const std::string &name)

Protected Attributes

OMF::Set _ofClass
OMF::Set _ofType


Constructor & Destructor Documentation

template<class Type, class Factory = Concrete>
OMF::BasicClass< Type, Factory >::BasicClass  )  [protected]
 

template<class Type, class Factory = Concrete>
virtual OMF::BasicClass< Type, Factory >::~BasicClass  )  [virtual]
 


Member Function Documentation

void OMF::Class::addType Object type  )  [inherited]
 

The addType() method is used to register a new type instance with the class proxy. It should be called in the constructor of every interface class.

const OMF::Set& OMF::Class::allOfClass  )  const [inherited]
 

Return all instances of this class (no subtypes).

const OMF::Set& OMF::Class::allOfType  )  const [inherited]
 

Return all instances of this type (with subtypes).

template<class Type, class Factory = Concrete>
Type* OMF::BasicClass< Type, Factory >::create  ) 
 

This is the type specific factory method. If the class is not abstract, it will return a new instance of the type. This method also adds the object to the set of actual instances.

template<class Type, class Factory = Concrete>
virtual Object* OMF::BasicClass< Type, Factory >::createInstance  )  [virtual]
 

This method is the derived implementation from the Class class. It simply calls create() to return a new instance or 0.

Reimplemented from OMF::Class.

template<class Type, class Factory = Concrete>
void OMF::BasicClass< Type, Factory >::destroy Object instance  ) 
 

Ideally, this method is the "anti-factory". When a class is officially deleted, this method needs to be called to remove the class from the instance extent. Note that it doesn't actually delete the class.

template<class Type, class Factory = Concrete>
virtual void OMF::BasicClass< Type, Factory >::destroyInstance Object instance  )  [virtual]
 

The destroyInstance() method essentially just removes the object reference from the instance set. It is only called from the decRef() method of ModelObject before the destructor chain is called.

Reimplemented from OMF::Class.

Class& OMF::Class::init const std::string &  name  )  [protected, inherited]
 

Used for construction.

template<class Type, class Factory = Concrete>
Self& OMF::BasicClass< Type, Factory >::instance const std::string &  name = ""  )  [static]
 

The instance() method returns the singleton instance of the class proxy specific to the templated type. Note the oddness with the name parameter. The first initialization of this method must pass the name of the class to the constructor.

const std::string& OMF::Class::name  )  const [inherited]
 

Return the name of the class as the type code.

void OMF::Class::removeType Object type  )  [inherited]
 

The removeType() method is used to remove a type instance from the class proxy. It should be called in the destructor of every interface class.


Member Data Documentation

OMF::Set OMF::Class::_ofClass [protected, inherited]
 

OMF::Set OMF::Class::_ofType [protected, inherited]
 


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