maliput
MaliputPlugin Class Reference

Detailed Description

MaliputPlugin loads a dynamic library.

After construction, the id and type of the plugin are provided. Via MaliputPlugin::ExecuteSymbol() functions can be run from the library. It is thought to be the entry point of the plugin. Specific plugin implementations would specialize the template invocation with the necessary types so the functionality for the plugin can be achieved.

To be considered a maliput plugin, the following two functions must be defined:

extern "C" char* GetMaliputPluginId();
extern "C" MaliputPluginType GetMaliputPluginType();
Note
When shared library and executable are compiled using ubsan(undefined behavior sanitizer) the property ENABLE_EXPORTS should be enabled on the executable target in order to instruct the linker to add all symbols to the dynamic symbol table. For further information see next link.

#include <include/maliput/plugin/maliput_plugin.h>

Public Types

using Id = api::TypeSpecificIdentifier< class MaliputPlugin >
 Persistent identifier for a MaliputPlugin element. More...
 

Public Member Functions

 MALIPUT_NO_COPY_NO_MOVE_NO_ASSIGN (MaliputPlugin)
 
 MaliputPlugin (const std::string &path_to_lib)
 Constructs a MaliputPlugin. More...
 
 MaliputPlugin ()=delete
 
std::string GetId () const
 
MaliputPluginType GetType () const
 
template<typename ReturnType , typename... Args>
ReturnType ExecuteSymbol (const std::string &sym_name, Args &&... args) const
 Finds and executes a symbol loaded by the plugin library. More...
 

Member Typedef Documentation

◆ Id

Persistent identifier for a MaliputPlugin element.

Constructor & Destructor Documentation

◆ MaliputPlugin() [1/2]

MaliputPlugin ( const std::string &  path_to_lib)

Constructs a MaliputPlugin.

Parameters
path_to_libPath to the library.
Exceptions
maliput::common::assertion_errorWhen path_to_lib is empty.

◆ MaliputPlugin() [2/2]

MaliputPlugin ( )
delete

Member Function Documentation

◆ ExecuteSymbol()

ReturnType ExecuteSymbol ( const std::string &  sym_name,
Args &&...  args 
) const

Finds and executes a symbol loaded by the plugin library.

Template Parameters
ReturnTypeThe return type of the symbol that is executed.
ArgsTypes of the argument list.
Parameters
sym_nameName of the symbol to execute.
argsArgument list for the symbol call.
Returns
An object returned by the executed symbol.
Exceptions
maliput::common::assertion_errorWhen sym_name is not found.

◆ GetId()

std::string GetId ( ) const
Returns
The Id of the plugin.

◆ GetType()

MaliputPluginType GetType ( ) const
Returns
The MaliputPluginType of the plugin.

◆ MALIPUT_NO_COPY_NO_MOVE_NO_ASSIGN()

MALIPUT_NO_COPY_NO_MOVE_NO_ASSIGN ( MaliputPlugin  )

The documentation for this class was generated from the following files:
maliput::plugin::MaliputPluginType
MaliputPluginType
Types of maliput plugin.
Definition: maliput_plugin_type.h:39