The Factory class defines a plugin factory that can be used by the Loader class to produce products that implement an interface. More...
#include <Factory.hh>
Classes | |
| class | Producing |
Public Types | |
| using | ProductPtrType = ProductPtr< Interface > |
Public Member Functions | |
| ProductPtrType | Construct (Args &&... _args) |
| This function is called by Loader to construct the class that implements the InterfacePtr interface. | |
Public Member Functions inherited from EnablePluginFromThis | |
| EnablePluginFromThis () | |
| Default constructor. | |
| virtual | ~EnablePluginFromThis () |
| Destructor. | |
| PluginPtr | PluginFromThis () |
| Get a copy of the PluginPtr that manages this object. | |
| ConstPluginPtr | PluginFromThis () const |
| Get a const-qualified copy of the PluginPtr that manages this object. | |
Additional Inherited Members | |
Protected Member Functions inherited from EnablePluginFromThis | |
| std::shared_ptr< void > | PluginInstancePtrFromThis () const |
| This is an abstract shared_ptr to the Plugin instance. This shared_ptr will maintain a reference count on the shared library that provides the plugin so that the shared library does not get unloaded while this shared_ptr is still alive. | |
Detailed Description
The Factory class defines a plugin factory that can be used by the Loader class to produce products that implement an interface.
To define the inputs and outputs of a factory, set the template arguments, for example:
defines a factory that can produce a std::unique_ptr<InterfaceClass> given arguments of InputType1 and InputType2.
To register a factory, use the GZ_ADD_FACTORY macro, e.g.:
where ImplementedClass is the name of the class that your plugin library has used to implement InterfaceClass.
Member Typedef Documentation
◆ ProductPtrType
Member Function Documentation
◆ Construct()
| ProductPtrType Construct | ( | Args &&... | _args | ) |
This function is called by Loader to construct the class that implements the InterfacePtr interface.
- Parameters
-
[in] _args The arguments as defined by the template parameters.
- Returns
- an RAII-managed reference to the interface type as defined by the template parameters.
The documentation for this class was generated from the following file:
Public Member Functions inherited from