commore  1.0.6-SNAPSHOT
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
commore::RefFactory Class Reference

#include <RefObject.h>

+ Inheritance diagram for commore::RefFactory:

Public Member Functions

 RefFactory ()
 
virtual ~RefFactory ()
 
virtual const ACharfactory_name () const
 
virtual AutoRefBase create (const AChar *s) const
 
virtual AutoRefBase bind (const AChar *s) const
 

Static Public Member Functions

static AutoRefBase lookup_create (const AChar *factory_name, const AChar *s, const AutoRefBase &def)
 
static AutoRefBase lookup_bind (const AChar *factory_name, const AChar *s, const AutoRefBase &def)
 

Detailed Description

General purpose factory for RefObject. Create or Bind to a real object, based on a string specification. A RefFactory must be instantiated once : it is usually done with a single static declaration in the source file, as the factory constructor is responsible for adding itself to a global list of factories (factory_list_ in AutoRef.cpp).

Todo:
is bind method really useful

Constructor & Destructor Documentation

RefFactory::RefFactory ( )
RefFactory::~RefFactory ( )
virtual

Member Function Documentation

AutoRefBase RefFactory::bind ( const AChar s) const
virtual

Bind to an existing object, from a string spec. Must return NULL if the spec is not handled by this factory.

Todo:
is this method useful
AutoRefBase RefFactory::create ( const AChar s) const
virtual

Create an object from a string specification. If this specific factory is not intended to handle instantiation for this spec, it must return NULL.

Parameters
soptional creation parameter
Returns
an autoref to a created object

Reimplemented in SenderFactoryTCPIP, ListenerFactoryTCPIP, SenderFactorySHM, and ListenerFactorySHM.

const AChar * RefFactory::factory_name ( ) const
virtual

Name of the type this factory claims to be able to instanciate. This factory is a pretender for the creation of RefObjects which have the same factory_name.

Returns
factory name

Reimplemented in SenderFactoryTCPIP, ListenerFactoryTCPIP, SenderFactorySHM, and ListenerFactorySHM.

AutoRefBase RefFactory::lookup_bind ( const AChar factory_name,
const AChar s,
const AutoRefBase def 
)
static

Same as lookup_create, but for binding.

Todo:
is useful
AutoRefBase RefFactory::lookup_create ( const AChar factory_name,
const AChar s,
const AutoRefBase def 
)
static

Check all the factories in the global list, to instantiate an object of type 'factory_name', with spec 's'. Return the instantiated object, or 'def' (the given default object) if no factory was able to create the object.

Returns
an autoref to a created object
Parameters
factory_namename of a factory
soptional creation parameter
defdefault value

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