A default object factory functor for use with the s11n::s11n_traits type. More...
#include <classload.hpp>
Public Types | |
typedef InterfaceBase | base_type |
Same as InterfaceBase. | |
Public Member Functions | |
base_type * | operator() (const std::string &key) const |
The default implementation returns s11n::fac::factory<InterfaceBase>().create(key). |
A default object factory functor for use with the s11n::s11n_traits type.
Clients may specialize this to return objects from their own factories. By default it uses s11n::fac's mini-framework, and thus can load any type registered with that API.
Definition at line 56 of file classload.hpp.
typedef InterfaceBase s11n::cl::object_factory< InterfaceBase >::base_type |
Same as InterfaceBase.
Definition at line 59 of file classload.hpp.
base_type* s11n::cl::object_factory< InterfaceBase >::operator() | ( | const std::string & | key | ) | const |
The default implementation returns s11n::fac::factory<InterfaceBase>().create(key).
The caller owns the returned pointer, which may be 0.
If the underlying factory does not have the requested class and s11n is built with the s11n::plugin layer, then s11n::plugin::open(classname) is used to search for a DLL. Under the s11n classloader model, opening a plugin will register classes defined in the plugin back with the factory.
This function propagates exceptions if the underlying factory's create() feature throws.
a) s11n_exceptions are passed on as-is.
b) std::exceptions are translated to s11n::factory_exceptions, keeping the what() text.
c) Unknown exceptions (...) are translated to s11n::factory_exceptions with an unspecified non-empty what() text.