PluginT< T > Class Template Reference

A class which all plugins must inherit from. More...

#include <common/common.hh>

Public Types

typedef boost::shared_ptr< T > TPtr
 plugin pointer type definition
 

Public Member Functions

 PluginT ()
 Constructor.
 
virtual ~PluginT ()
 Destructor.
 
std::string GetFilename () const
 Get the name of the handler.
 
std::string GetHandle () const
 Get the short name of the handler.
 
PluginType GetType () const
 Returns the type of the plugin.
 

Static Public Member Functions

static TPtr Create (const std::string &_filename, const std::string &_name)
 a class method that creates a plugin from a file name.
 

Protected Member Functions

template<typename V >
void LoadParam (const sdf::ElementPtr &_sdf, const std::string &_name, V &_target, V _defaultValue=V()) const
 Load parameter value from _sdf and store it to the given reference, using the supplied default value if the element in _sdf is not found.
 
void LoadParam (sdf::ElementPtr &_sdf, const std::string &_name, std::string &_target, const char *_defaultValue) const
 Load parameter value from _sdf and store it to the given reference, using the supplied default value if the element in _sdf is not found.
 

Protected Attributes

std::string filename
 Path to the shared library file.
 
std::string handleName
 Short name.
 
PluginType type
 Type of plugin.
 

Detailed Description

template<class T>
class gazebo::PluginT< T >

A class which all plugins must inherit from.

Member Typedef Documentation

◆ TPtr

template<class T >
typedef boost::shared_ptr<T> TPtr

plugin pointer type definition

Constructor & Destructor Documentation

◆ PluginT()

template<class T >
PluginT ( )
inline

Constructor.

◆ ~PluginT()

template<class T >
virtual ~PluginT ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ Create()

template<class T >
static TPtr Create ( const std::string & _filename,
const std::string & _name )
inlinestatic

a class method that creates a plugin from a file name.

It locates the shared library and loads it dynamically.

Parameters
[in]_filenamethe path to the shared library.
[in]_nameshort name of the plugin
Returns
Shared Pointer to this class type

References PluginT< T >::filename, gzerr, and SingletonT< SystemPaths >::Instance().

◆ GetFilename()

template<class T >
std::string GetFilename ( ) const
inline

Get the name of the handler.

References PluginT< T >::filename.

◆ GetHandle()

template<class T >
std::string GetHandle ( ) const
inline

Get the short name of the handler.

References PluginT< T >::handleName.

◆ GetType()

template<class T >
PluginType GetType ( ) const
inline

Returns the type of the plugin.

Returns
type of the plugin

References PluginT< T >::type.

◆ LoadParam() [1/2]

template<class T >
template<typename V >
void LoadParam ( const sdf::ElementPtr & _sdf,
const std::string & _name,
V & _target,
V _defaultValue = V() ) const
inlineprotected

Load parameter value from _sdf and store it to the given reference, using the supplied default value if the element in _sdf is not found.

A message is written using gzmsg reporting whether the default value was used or not.

Parameters
[in]_sdfThe SDF element of the plugin.
[in]_nameName of a tag inside the SDF.
[out]_targetThe reference to store the param value to.
[in]_defaultValueThe default value.

References gzmsg, and PluginT< T >::handleName.

◆ LoadParam() [2/2]

template<class T >
void LoadParam ( sdf::ElementPtr & _sdf,
const std::string & _name,
std::string & _target,
const char * _defaultValue ) const
inlineprotected

Load parameter value from _sdf and store it to the given reference, using the supplied default value if the element in _sdf is not found.

A message is written using gzmsg reporting whether the default value was used or not. String specialization to allow accepting const char* values for std::string parameters.

Parameters
[in]_sdfThe SDF element of the plugin.
[in]_nameName of a tag inside the SDF.
[out]_targetThe reference to store the param value to.
[in]_defaultValueThe default value.

Member Data Documentation

◆ filename

template<class T >
std::string filename
protected

Path to the shared library file.

Referenced by PluginT< T >::Create(), and PluginT< T >::GetFilename().

◆ handleName

template<class T >
std::string handleName
protected

Short name.

Referenced by PluginT< T >::GetHandle(), and PluginT< T >::LoadParam().

◆ type

template<class T >
PluginType type
protected

Type of plugin.

Referenced by PluginT< T >::GetType().


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