Gazebo Plugin

API Reference

3.0.0

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

Protected Member Functions

std::shared_ptr< voidPluginInstancePtrFromThis () 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

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()

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: