Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

factory.hpp File Reference

#include <string>
#include <map>
#include <functional>
#include <s11n.net/s11n/export.hpp>
#include <s11n.net/s11n/phoenix.hpp>

Go to the source code of this file.

Namespaces

namespace  s11n
namespace  s11n::sharing
namespace  s11n::fac
namespace  s11n::fac::Detail

Defines

#define s11n_net_s11n_FACTORY_H_INCLUDED   1

Functions

template<typename InterfaceT>
factory_mgr< InterfaceT, std::string > & factory ()
 Returns factory_mgr<InterfaceT, std::string>::instance().
template<typename InterfaceT>
void register_factory (const std::string &classname, InterfaceT *(*factory_function)())
 Registers classname with InterfaceT using the given factory.
template<typename InterfaceT>
void register_factory (const std::string &classname)
 Registers classname with InterfaceT using a default factory: create_hook<InterfaceT,ImplT>::create().
template<typename InterfaceT, typename ImplT>
void register_subtype (const std::string &classname)
 Registers a factory creating ImplT objects with the InterfaceT classloader using a default factory.
template<typename T>
T * null_factory ()
 Always returns 0.
template<typename InterfaceT>
void register_abstract (const std::string &classname)
 Registers a no-op factory for the given name and InterfaceT.
template<typename InterfaceT>
InterfaceT * create (const std::string &classname)
 Returns the same as factory<InterfaceT>().create( classname ).


Define Documentation

#define s11n_net_s11n_FACTORY_H_INCLUDED   1
 

Definition at line 2 of file factory.hpp.


Function Documentation

template<typename InterfaceT>
InterfaceT* create const std::string &  classname  )  [inline]
 

Returns the same as factory<InterfaceT>().create( classname ).

Definition at line 588 of file factory.hpp.

Referenced by s11n::node_traits< NodeT >::create(), s11n::fac::factory_mgr< InterfaceT, KeyType >::operator()(), s11n::fac::create_hook< T, SubT >::operator()(), s11n::fac::register_factory(), and s11n::fac::register_subtype().

template<typename InterfaceT>
factory_mgr<InterfaceT, std::string>& factory  )  [inline]
 

Returns factory_mgr<InterfaceT, std::string>::instance().

All s11n-internal factory_mgr operations operate on one of these objects.

Definition at line 515 of file factory.hpp.

template<typename T>
T* null_factory  )  [inline]
 

Always returns 0.

Intended for use as a factory for abstract types.

Definition at line 565 of file factory.hpp.

template<typename InterfaceT>
void register_abstract const std::string &  classname  ) 
 

Registers a no-op factory for the given name and InterfaceT.

The factory will always return 0.

Definition at line 576 of file factory.hpp.

template<typename InterfaceT>
void register_factory const std::string &  classname  )  [inline]
 

Registers classname with InterfaceT using a default factory: create_hook<InterfaceT,ImplT>::create().

If ImplT is abstract then this function will fail unless create_hook is specialized to not create an object.

Definition at line 540 of file factory.hpp.

References s11n::fac::create().

template<typename InterfaceT>
void register_factory const std::string &  classname,
InterfaceT *(*)()  factory_function
[inline]
 

Registers classname with InterfaceT using the given factory.

Definition at line 526 of file factory.hpp.

template<typename InterfaceT, typename ImplT>
void register_subtype const std::string &  classname  )  [inline]
 

Registers a factory creating ImplT objects with the InterfaceT classloader using a default factory.

ImplT may not be abstract unless create_hook<InterfaceT,ImplT> is specialized such that it's create() function simply returns 0 (or otherwise does not call: new ImplT).

Definition at line 554 of file factory.hpp.

References s11n::fac::create().


Generated on Thu Sep 29 20:01:15 2005 for libs11n-1.1.3-dev by  doxygen 1.4.1