Classes | |
struct | object_factory |
A default object factory functor for use with the s11n::s11n_traits type. More... | |
Namespaces | |
namespace | Detail |
Functions | |
template<typename InterfaceBase> | |
InterfaceBase * | classload (const std::string key) |
Returns object_factory<InterfaceBase>()(key). | |
template<typename InterfaceBase> | |
void | classloader_register (const std::string &classname, InterfaceBase *(*factory_func)()) |
Registers a factory with InterfaceBase's classloader. | |
template<typename InterfaceBase, typename SubType> | |
void | classloader_register_subtype (const std::string &classname) |
Registers a default factory which returns a SubType object. | |
template<typename InterfaceBase> | |
void | classloader_register_base (const std::string &classname) |
Registers InterfaceBase with its own classloader using a default factory. | |
template<typename InterfaceBase> | |
void | classloader_register_abstract (const std::string &classname) |
Registers InterfaceBase as an abstract type. | |
template<typename InterfaceBase> | |
void | classloader_alias (const std::string &_alias, const std::string &classname) |
Aliases the given classname with the underlying factory layer, such that classload<InterfaceBase>(_alias) will return the same as classload<InterfaceBase>(classname). |
Note that the registration functions in this namespace register with the s11n::fac family of classes. Clients wishing to use their own factories should:
This layer is used for classloading anything which s11n needs to dynamically load, including:
It supports loading types via DLLs if the optional s11n::plugin layer is enabled.
Changes from 1.0.x to 1.1.x:
|
Returns object_factory<InterfaceBase>()(key).
|
|
Aliases the given classname with the underlying factory layer, such that classload<InterfaceBase>(_alias) will return the same as classload<InterfaceBase>(classname). Added in 1.1.0. Maintenance reminder: this function relies directly on the s11n::fac API, which isn't "really" public. That functionality is commonly useful which hand-registering types, thus we have a public-API wrapper around this fac-layer-specific feature. Definition at line 216 of file classload.hpp. |
|
Registers a factory with InterfaceBase's classloader. Trivia: 'register' is a reserved word in C++, inherited from C, so this function has an unduly long name. register() was the first choice. |
|
Registers InterfaceBase as an abstract type. That is, it assigns it a factory which always returns 0. If types you register with classloader_register() (and friends) have an abstract InterfaceBase then that InterfaceBase should be registered via this function (or equivalent). Note that this is also suitable for registering abstract subtypes of an abstract type, but InterfaceBase MUST be the type passed here, or the registrations will go to the subtype's classloader, which isn't what you want to do. Definition at line 196 of file classload.hpp. |
|
Registers InterfaceBase with its own classloader using a default factory. InterfaceBase must be creatable with 'new', or the default factory implementation must be specialized to accomodate the abstract class. Definition at line 168 of file classload.hpp. |
|
Registers a default factory which returns a SubType object. SubType must be a public subtype of InterfaceBase, or must be InterfaceBase, and must not be abstract. Definition at line 154 of file classload.hpp. References s11n::fac::create(). |