User Manual, Developers Guide and API Documentation

StaticFactory.hpp File Reference

#include <WNS/Exception.hpp>
#include <WNS/TypeInfo.hpp>
#include <sstream>
#include <string>
#include <map>
#include <vector>

Include dependency graph for StaticFactory.hpp:

Go to the source code of this file.

Namespaces

namespace  wns

Classes

class  wns::Creator< T, KIND >
 Factory method interface to use as creator for StaticFactory. More...
class  wns::wns::Creator< KIND, KIND >
class  wns::StaticFactory< CREATOR >
 Monostate class keeping a registry of creators for interface-implementations. More...
class  wns::StaticFactoryRegister< T, KIND, CREATOR >
 Provide creator interface and register at a StaticFactory. More...

Defines

#define STATIC_FACTORY_DEFINE(INTERFACE, CREATOR)
#define STATIC_FACTORY_DO_JOIN(SYMBOL1, SYMBOL2)   STATIC_FACTORY_DO_JOIN2(SYMBOL1, SYMBOL2)
#define STATIC_FACTORY_DO_JOIN2(SYMBOL1, SYMBOL2)   SYMBOL1##SYMBOL2
#define STATIC_FACTORY_JOIN(SYMBOL1, SYMBOL2)   STATIC_FACTORY_DO_JOIN(SYMBOL1, SYMBOL2)
#define STATIC_FACTORY_NEW_INSTANCE(INTERFACE, CREATOR, VIEW, ARGS...)   wns::StaticFactory< CREATOR<INTERFACE> >::creator(VIEW.get<std::string>("nameInStaticFactory"))->create(ARGS)
#define STATIC_FACTORY_REGISTER(CLASS, INTERFACE, NAME)
 Register a class at a static factory.
#define STATIC_FACTORY_REGISTER_WITH_CREATOR(CLASS, INTERFACE, NAME, CREATOR)
 Register a class at a static factory using a non-default creator.
#define STATIC_FACTORY_UNIQUE_NAME(PREFIX)   STATIC_FACTORY_JOIN(PREFIX,__LINE__)


Define Documentation

#define STATIC_FACTORY_DEFINE ( INTERFACE,
CREATOR   ) 

Value:

typedef CREATOR<INTERFACE> INTERFACE ## Creator;\
    typedef wns::StaticFactory<INTERFACE ## Creator> INTERFACE ## Factory;

Definition at line 342 of file StaticFactory.hpp.

#define STATIC_FACTORY_DO_JOIN ( SYMBOL1,
SYMBOL2   )     STATIC_FACTORY_DO_JOIN2(SYMBOL1, SYMBOL2)

Definition at line 296 of file StaticFactory.hpp.

#define STATIC_FACTORY_DO_JOIN2 ( SYMBOL1,
SYMBOL2   )     SYMBOL1##SYMBOL2

Definition at line 297 of file StaticFactory.hpp.

#define STATIC_FACTORY_JOIN ( SYMBOL1,
SYMBOL2   )     STATIC_FACTORY_DO_JOIN(SYMBOL1, SYMBOL2)

Definition at line 295 of file StaticFactory.hpp.

#define STATIC_FACTORY_NEW_INSTANCE ( INTERFACE,
CREATOR,
VIEW,
ARGS...   )     wns::StaticFactory< CREATOR<INTERFACE> >::creator(VIEW.get<std::string>("nameInStaticFactory"))->create(ARGS)

Definition at line 346 of file StaticFactory.hpp.

#define STATIC_FACTORY_REGISTER ( CLASS,
INTERFACE,
NAME   ) 

Value:

namespace { \
    static wns::StaticFactoryRegister<CLASS, INTERFACE> STATIC_FACTORY_UNIQUE_NAME(_)(NAME); \
    } \
    class StaticFactoryRegisterDummy
Register CLASS at the static factory for INTERFACE. INTERFACE must be a super class of CLASS. CLASS will be registered using the name NAME.

The default constructor will be used to create instances. Thus, CLASS must have an implementation for the default constructor. To register a CLASS at a static factory with non default constructor signature, use STATIC_FACTORY_REGISTER_WITH_CREATOR instead.

Definition at line 315 of file StaticFactory.hpp.

#define STATIC_FACTORY_REGISTER_WITH_CREATOR ( CLASS,
INTERFACE,
NAME,
CREATOR   ) 

Value:

namespace { \
    static wns::StaticFactoryRegister<CLASS, INTERFACE, CREATOR> STATIC_FACTORY_UNIQUE_NAME(_)(NAME); \
    } \
    class StaticFactoryRegisterDummy
Register CLASS at the static factory for INTERFACE. INTERFACE must be a super class of CLASS. CLASS will be registered using the name NAME.

The constructor used to instantiate CLASS depends on the type of CREATOR. To register a CLASS at a static factory with the default constructor signature, use STATIC_FACTORY_REGISTER instead. Note that CREATOR is a property of a static factory. Using different CREATORs results in distinct static factory instances.

Definition at line 333 of file StaticFactory.hpp.

#define STATIC_FACTORY_UNIQUE_NAME ( PREFIX   )     STATIC_FACTORY_JOIN(PREFIX,__LINE__)

Definition at line 299 of file StaticFactory.hpp.


Generated on Sat May 26 03:32:19 2012 for openWNS by  doxygen 1.5.5