Ignition Plugin

API Reference

1.1.0
Factory< Interface, Args > Class Template Referenceabstract

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. More...
 
- Public Member Functions inherited from EnablePluginFromThis
 EnablePluginFromThis ()
 Default constructor. More...
 
virtual ~EnablePluginFromThis ()
 Destructor. More...
 
PluginPtr PluginFromThis ()
 Get a copy of the PluginPtr that manages this object. More...
 
ConstPluginPtr PluginFromThis () const
 Get a const-qualified copy of the PluginPtr that manages this object. More...
 

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. More...
 

Detailed Description

template<typename Interface, typename... Args>
class ignition::plugin::Factory< Interface, Args >

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:

using MyFactory = Factory<InterfaceClass, InputType1, InputType2>;

defines a factory that can produce a std::unique_ptr<InterfaceClass> given arguments of InputType1 and InputType2.

To register a factory, use the IGNITION_ADD_FACTORY macro, e.g.:

IGNITION_ADD_FACTORY(ImplementedClass, MyFactory)

where ImplementedClass is the name of the class that your plugin library has used to implement InterfaceClass.

Member Typedef Documentation

◆ ProductPtrType

using ProductPtrType = ProductPtr<Interface>

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]_argsThe 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: