|
static UserPlugin & | instance () |
| Member function instance returns the instance of the registry, cast as a UserPlugin registry.. More...
|
|
static void | registerCreator (const std::string &derived_name, Signature function) |
| Member function registerCreator registers the base class name and specified derived class name with the specified creator function. More...
|
|
static Signature | create (const std::string &derived_name) |
| Member function create returns the createInstance() function associated with the specified base class and derived_name. More...
|
|
static Signature | create (int derived_id) |
| Member function create returns the createInstance() function associated with the specified base class and derived_name. More...
|
|
static bool | exists (const std::string &derived_name) |
| Member function exists returns true if class of the type specified by derived_name exists in BaseClass. More...
|
|
static std::vector< std::string > | getDerivedNames () |
|
template<class Creator, typename S = Creator *(*)()>
class sierra::Plugin::UserPlugin< Creator, S >
Template class UserPlugin is a template used for the association of base and derived classed to be registered and created via the UserPlugin mechanism. The template traits enforces the signature matching of the base class constructor, derived class constructor, derived class creator static function and the usage of the creator static function.
The registration requires a unique base class name for each base class type. And, since typeid is not reliable for that implementation, each base class is required to implement a traits class with a Base typedef which specifies the base class, a Signature typedef which specifies the signature of the create function and a static function named getUserPluginCreatorName() which returns a const std::string reference to the base classes name. This name must be unique across users of the registry. There is no way to enforce this programatically, so it is recommended that a application prefix be attached to the base class name.
Definition at line 331 of file UserPlugin.hpp.
template<class Creator , typename S = Creator *(*)()>
Member function registerCreator registers the base class name and specified derived class name with the specified creator function.
The base class name is determined by the BaseTraits template argument's getUserPluginCreatorName() static member function. The signature is defined by the BaseTraits template argument's Signature typedef.
- Parameters
-
derived_name | a std::string const reference to the derived class name. |
function | a signature function pointer to the creator function. |
Definition at line 368 of file UserPlugin.hpp.