Main Page | Modules | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

ContactFactory Class Reference

#include <ContactFactory.hh>

Inherited by ContactCreator< T >, and ContactCreator< DefaultContact >.

List of all members.


Detailed Description

Interface class for all contact factories.

The ContactFactory class defines the interface to all contact factories. Contact factories are entities that are responsible from manufacturing instances of particular contacts types. An important example is the family of ContactCreator classes, which are templated on derivatives of Contact and derived from this class, performing creation of appropriate types of contacts upon request.

This abstract base class provides facilities to keep track of a string "alias" and a set of parameters associated with each instance. Specified during construction, they can be used by the derived classes or queried externally. The string alias is useful for identifying particular instances of factories, which may be simply different parametrizations of the same contact primitive.

Finally, the productName() method specifies an interface for retrieving the name (or "type") or the contact primitive manufactured by derived classes. Together with the alias, it provides means of uniquely identifying each contact factory object with respect to the config file.


Public Member Functions

 ContactFactory (const char *alias, utils::ConfigFile *params)
virtual ~ContactFactory ()
virtual Contactestablish (DeContactEvent *event, Object *a, Object *b)=0
virtual const char * productName (void)=0
const char * getAlias (void)
utils::ConfigFile * getParams (void)

Protected Attributes

char * _alias
utils::ConfigFile * _params


Constructor & Destructor Documentation

ContactFactory::ContactFactory const char *  alias,
utils::ConfigFile *  params
[inline]
 

This constructor creates a contact factory base object with the specified alias and parameter set.

virtual ContactFactory::~ContactFactory  )  [inline, virtual]
 

This destructor cleans up internal objects and destroys the factory


Member Function Documentation

virtual Contact* ContactFactory::establish DeContactEvent *  event,
Object a,
Object b
[pure virtual]
 

Derived classes must implement this method to create the required type of contact (children of Contact) and return a pointer to it.

Implemented in ContactCreator< T >, and ContactCreator< DefaultContact >.

const char* ContactFactory::getAlias void   )  [inline]
 

This method returns the alias string for the factory object

utils::ConfigFile* ContactFactory::getParams void   )  [inline]
 

This method returns the parameter settings for the factory object

virtual const char* ContactFactory::productName void   )  [pure virtual]
 

Derived classes must implement this method to return the type name of the contact object to be manufactured. Mainly used for display and debugging purposes


SimLib Reference Documentation