|
Sierra Toolkit
Version of the Day
|
#include <UserPlugin.hpp>
Classes | |
| class | Register |
| Class template Register registers the createInstance() function with the derived_name on object creation. More... | |
Public Types | |
| typedef S | Signature |
| Creator signature. | |
Static Public Member Functions | |
| static UserPlugin & | instance () |
| Member function instance returns the instance of the registry, cast as a UserPlugin registry.. | |
| 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. | |
| static Signature | create (const std::string &derived_name) |
| Member function create returns the createInstance() function associated with the specified base class and derived_name. | |
| static Signature | create (int derived_id) |
| Member function create returns the createInstance() function associated with the specified base class and derived_name. | |
| 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. | |
| static std::vector< std::string > | getDerivedNames () |
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.
| static UserPlugin& sierra::Plugin::UserPlugin< Creator, S >::instance | ( | ) | [inline, static] |
Member function instance returns the instance of the registry, cast as a UserPlugin registry..
Definition at line 349 of file UserPlugin.hpp.
| static void sierra::Plugin::UserPlugin< Creator, S >::registerCreator | ( | const std::string & | derived_name, |
| Signature | function | ||
| ) | [inline, static] |
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.
| 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.
| static Signature sierra::Plugin::UserPlugin< Creator, S >::create | ( | const std::string & | derived_name | ) | [inline, static] |
Member function create returns the createInstance() function associated with the specified base class and derived_name.
| derived_name | a std::string const reference to the derived classes name. |
| a | std::invalid_argument exception is thrown if there is no instance creation function registered for the specified name of the base class. |
Definition at line 386 of file UserPlugin.hpp.
| static Signature sierra::Plugin::UserPlugin< Creator, S >::create | ( | int | derived_id | ) | [inline, static] |
Member function create returns the createInstance() function associated with the specified base class and derived_name.
| derived_name | a std::string const reference to the derived classes name. |
| a | std::invalid_argument exception is thrown if there is no instance creation function registered for the specified name of the base class. |
Definition at line 406 of file UserPlugin.hpp.
| static bool sierra::Plugin::UserPlugin< Creator, S >::exists | ( | const std::string & | derived_name | ) | [inline, static] |
Member function exists returns true if class of the type specified by derived_name exists in BaseClass.
| derived_name | a std::string const reference to the derived classes name. |
Definition at line 419 of file UserPlugin.hpp.