Ignition Plugin

API Reference

1.2.1

EnablePluginFromThis is an optional base class which can be inherited by Plugin classes. When a Plugin class inherits it and that Plugin class is instantiated using the Loader class, its instance will be able to access the PluginPtr that manages its lifecycle. This interface will also be available by calling instance->QueryInterface<EnablePluginFromThis>() More...

#include <EnablePluginFromThis.hh>

Public Member Functions

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

Protected Member Functions

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

EnablePluginFromThis is an optional base class which can be inherited by Plugin classes. When a Plugin class inherits it and that Plugin class is instantiated using the Loader class, its instance will be able to access the PluginPtr that manages its lifecycle. This interface will also be available by calling instance->QueryInterface<EnablePluginFromThis>()

Remarks
This class is analogous to std::enable_shared_from_this

Constructor & Destructor Documentation

◆ EnablePluginFromThis()

Default constructor.

◆ ~EnablePluginFromThis()

virtual ~EnablePluginFromThis ( )
virtual

Destructor.

Member Function Documentation

◆ PluginFromThis() [1/2]

PluginPtr PluginFromThis ( )

Get a copy of the PluginPtr that manages this object.

Returns
a copy of the PluginPtr that manages this object.

◆ PluginFromThis() [2/2]

ConstPluginPtr PluginFromThis ( ) const

Get a const-qualified copy of the PluginPtr that manages this object.

Returns
a const-qualified copy of the PluginPtr that manages this object.

◆ PluginInstancePtrFromThis()

std::shared_ptr<void> PluginInstancePtrFromThis ( ) const
protected

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.

This function is meant for advanced use-cases, such as creating Factory plugins, so we keep it protected. Only use this if you know what you are doing.

Returns
shared_ptr to the Plugin instance.

The documentation for this class was generated from the following file: