Ignition Plugin

API Reference

1.1.0
SpecializedPlugin< SpecInterface > Class Template Reference

This class allows Plugin instances to have high-speed access to interfaces that can be anticipated at compile time. The plugin does not have to actually offer the specialized interface in order to get this performance improvement. This template is variadic, so it can support arbitrarily many interfaces. More...

#include <SpecializedPlugin.hh>

Public Member Functions

template<class Interface >
bool HasInterface () const
 
template<class Interface >
Interface * QueryInterface ()
 
template<class Interface >
const Interface * QueryInterface () const
 
template<class Interface >
std::shared_ptr< Interface > QueryInterfaceSharedPtr ()
 
template<class Interface >
std::shared_ptr< const Interface > QueryInterfaceSharedPtr () const
 
- Public Member Functions inherited from Plugin
virtual ~Plugin ()
 Virtual destructor. More...
 
template<class Interface >
bool HasInterface () const
 Checks if this Plugin has the specified type of interface. More...
 
bool HasInterface (const std::string &_interfaceName, const bool _demangled=true) const
 Checks if this Plugin has the specified type of interface. More...
 
const std::stringName () const
 Gets the name of this Plugin. More...
 
template<class Interface >
Interface * QueryInterface ()
 Get an interface of the specified type, if it is provided by this plugin. More...
 
template<class Interface >
const Interface * QueryInterface () const
 const-qualified version of QueryInterface<Interface>() More...
 
template<class Interface >
Interface * QueryInterface (const std::string &)
 This function has been deprecated in favor of the version of QueryInterface which does not take a std::string argument. More...
 
template<class Interface >
const Interface * QueryInterface (const std::string &) const
 const-qualified version of QueryInterface<Interface>(std::string) More...
 
template<class Interface >
std::shared_ptr< Interface > QueryInterfaceSharedPtr ()
 Get the requested interface as a std::shared_ptr. The template argument Interface must exactly match the underlying type associated with _interfaceName, or else the behavior of this function is undefined. More...
 
template<class Interface >
std::shared_ptr< const Interface > QueryInterfaceSharedPtr () const
 Same as QueryInterfaceSharedPtr<Interface>(), but it returns a std::shared_ptr to a const-qualified Interface. More...
 
template<class Interface >
std::shared_ptr< Interface > QueryInterfaceSharedPtr (const std::string &)
 This version of QueryInterfaceSharedPtr has been deprecated in favor of the version that does not take a std::string argument. More...
 
template<class Interface >
std::shared_ptr< const Interface > QueryInterfaceSharedPtr (const std::string &) const
 Same as QueryInterfaceSharedPtr<Interface>(std::string), but it returns a std::shared_ptr to a const-qualified Interface. More...
 

Protected Member Functions

 SpecializedPlugin ()
 Default constructor. More...
 
- Protected Member Functions inherited from Plugin
 Plugin ()
 Default constructor. This is kept protected to discourage users from instantiating them directly. They should instead only be retrieved as a PluginPtr from the plugin Loader. More...
 

Additional Inherited Members

- Public Types inherited from Plugin
using InterfaceMap = std::map< std::string, void * >
 The InterfaceMap type needs to get used in several places, like Plugin::Implementation and SpecializedPlugin<T>. We make the typedef public so that those other classes can use it without needing to be friends of Plugin. End-users should not have any need for this typedef. More...
 

Detailed Description

template<class SpecInterface>
class ignition::plugin::SpecializedPlugin< SpecInterface >

This class allows Plugin instances to have high-speed access to interfaces that can be anticipated at compile time. The plugin does not have to actually offer the specialized interface in order to get this performance improvement. This template is variadic, so it can support arbitrarily many interfaces.

Usage example:

using MySpecialPluginPtr = SpecializedPluginPtr<
MyInterface1, FooInterface, MyInterface2, BarInterface>;
MySpecialPluginPtr plugin = loader->Instantiate(pluginName);

Then, calling the function

plugin->QueryInterface<FooInterface>();

will have extremely high-speed associated with it. It will provide direct access to the the FooInterface* of plugin. If plugin does not actually offer FooInterface, then it will return a nullptr, still at extremely high speed.

Constructor & Destructor Documentation

◆ SpecializedPlugin()

SpecializedPlugin ( )
protected

Default constructor.

Member Function Documentation

◆ HasInterface()

bool HasInterface ( ) const

◆ QueryInterface() [1/2]

Interface* QueryInterface ( )

◆ QueryInterface() [2/2]

const Interface* QueryInterface ( ) const

◆ QueryInterfaceSharedPtr() [1/2]

std::shared_ptr<Interface> QueryInterfaceSharedPtr ( )

◆ QueryInterfaceSharedPtr() [2/2]

std::shared_ptr<const Interface> QueryInterfaceSharedPtr ( ) const

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