![]() |
RobWorkProject
23.9.11-
|
Template class form which to inherit when creating a factory for a plugin. More...
#include <PluginFactory.hpp>
Inherits PluginFactoryBase.
Public Types | |
typedef rw::core::Ptr< PluginFactory< T > > | Ptr |
Smart pointer type for PluginFactory. | |
![]() | |
typedef rw::core::Ptr< PluginFactoryBase > | Ptr |
smart pointer for this class | |
Public Member Functions | |
PluginFactory (const std::string &identifier) | |
Constructs a PluginFactory. More... | |
virtual rw::core::Ptr< T > | make () |
Creates plugin of type T by calling default constructor. More... | |
virtual rw::core::Ptr< T > | make (const std::string &) |
Creates plugin of type T by calling constructor with std::string. More... | |
![]() | |
PluginFactoryBase (const std::string &identifier) | |
Constructor. More... | |
virtual | ~PluginFactoryBase (void) |
Destructor. | |
virtual std::string | identifier () const |
Returns identifier associated with the PluginFactory. More... | |
Template class form which to inherit when creating a factory for a plugin.
Example: If we wish to create a new type of rw::models::Device the following steps are needed. 1) Implement you device "MyDevice" which should inherit from rw::models::Device.
2) Create a Factory (lets call it MyDeviceFactory) which inherits from PluginFactory<T> and specifies T=rw::models::Device. It is important to specify T=rw::models::Device and NOT MyDevice as the PluginRepository can otherwise not identify it as a factory for creating a device.
3) Override the relevant "make" methods from PluginFactory<T> to provide a way of creating instances of MyDevice. Which methods to override depends on how and where you wish to use your plugin. See the documentation of the different methods.
4) Call DLL_FACTORY_METHOD(MyDeviceFactory) to create a proper entry in the dynamic library. Make sure that MyDeviceFactory has a default constructor.
|
inline |
Constructs a PluginFactory.
identifier | [in] Identifiers of the PluginFactory |
|
inlinevirtual |
Creates plugin of type T by calling default constructor.
If method is not overridden an exception is thrown.
|
inlinevirtual |
Creates plugin of type T by calling constructor with std::string.
If method is not overridden an exception is thrown.