Public Types | Public Member Functions

jmitie::CjVisitorFactoryEntry< VisitorType_t > Class Template Reference

Represents a sub-factory entry in CjVisitorFactory.
An instance of this class contains the function pointers to the factory methods used when creating, destroying and getting information about objects in the sub-factory. CjVisitorFactoryEntry can be initialised with pointers to the factory methods (for static linking), or a filename to a DLL which is to be loaded. More...

#include <CjVisitorFactory.hh>

Collaboration diagram for jmitie::CjVisitorFactoryEntry< VisitorType_t >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef VisitorType_t VisitorType
 The type of object created by the sub-factory.
typedef VisitorType *(* f_create_t )(const std::string &type_name, const std::string &args, const typename VisitorType::ctor_va_t &var_arg)
 The create function prototype of the sub-factory.
typedef std::vector
< std::string >(* 
f_getNames_t )()
 The prototype of the sub-factory function that returns the names of all the objects that the create function of the sub-factory can create.
typedef void(* f_destroy_t )(VisitorType *)
 The function prototype of the function that destroys the objects which were created by the create function of the sub-factory.
typedef std::string(* f_getProperty_t )(const std::string &type_name, const std::string &prop_name)
 The function prototype of the sub-factory function which returns information about a given object.

Public Member Functions

std::string fname () const
 Accessor: returns the filename of the DLL from which the factory was loaded or "static" if the sub-factory is statically linked.
f_create_t c () const
 Accessor: returns the function pointer to the create function of the sub-factory.
f_destroy_t d () const
 Accessor: returns the function pointer to the destroy function of the sub-factory.
f_getNames_t n () const
 Accessor: returns the function pointer to the name listing function of the sub-factory.
f_getProperty_t p () const
 Accessor: returns the function pointer to the class property accessing function of the sub-factory.
 CjVisitorFactoryEntry (f_create_t c, f_destroy_t d, f_getNames_t n, f_getProperty_t p)
 Creates a CjVisitorFactoryEntry that represents calls to the provided statically linked sub-factory functions.
 CjVisitorFactoryEntry (const char *fname, const char *create_name, const char *destroy_name, const char *getnames_name, const char *getproperty_name)
 Creates a CjVisitorFactoryEntry object and loads the sub-factory functions from a DLL.
 ~CjVisitorFactoryEntry ()
 The destructor - the DLL will be closed if necessary.

Detailed Description

template<class VisitorType_t>
class jmitie::CjVisitorFactoryEntry< VisitorType_t >

Represents a sub-factory entry in CjVisitorFactory.
An instance of this class contains the function pointers to the factory methods used when creating, destroying and getting information about objects in the sub-factory. CjVisitorFactoryEntry can be initialised with pointers to the factory methods (for static linking), or a filename to a DLL which is to be loaded.

Template Parameters:
<VisitorType_t> { The class or super-class of the objects that can be created by this factory entry. }

Constructor & Destructor Documentation

template<class VisitorType_t >
jmitie::CjVisitorFactoryEntry< VisitorType_t >::CjVisitorFactoryEntry ( f_create_t  c,
f_destroy_t  d,
f_getNames_t  n,
f_getProperty_t  p 
) [inline]

Creates a CjVisitorFactoryEntry that represents calls to the provided statically linked sub-factory functions.

Parameters:
c A function pointer to the static create function
d A function pointer to the static destroy function
n A function pointer to the static function that returns the names that can be created by this sub-factory
p A function pointer to the static function that returns properties of the objects that can be created by this sub-factory
template<class VisitorType_t >
jmitie::CjVisitorFactoryEntry< VisitorType_t >::CjVisitorFactoryEntry ( const char *  fname,
const char *  create_name,
const char *  destroy_name,
const char *  getnames_name,
const char *  getproperty_name 
) [inline]

Creates a CjVisitorFactoryEntry object and loads the sub-factory functions from a DLL.

The names of the sub-factory functions are specified as arguments so a single DLL can contain sub-factories for multiple class types.

Parameters:
fname The filename of the DLL
create_name The name of the create function in the DLL
destroy_name The name of the destroy function in the DLL
getnames_name The name of the function in the DLL that returns a list of classes that it can create
getproperty_name The name of the function in the DLL that returns allows for the interrogation of class properties in the sub-factory in the DLL
Exceptions:
Cj_DLLException If there are problems loading the DLL
Cj_SymbolMissingException If any of the functions named in the arguments are missing from the DLL

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator