Fawkes API  Fawkes Development Version
fawkes::Plugin Class Reference

Plugin interface class. More...

#include <>>

Inherited by AmclPlugin, BallPosLogPlugin, BlackBoardLoggerPlugin, BlackBoardLogReplayPlugin, BlackBoardSynchronizationPlugin, Bumblebee2Plugin, ClipsAgentPlugin, ClipsNavGraphPlugin, CLIPSPlugin, ClipsProtobufPlugin, ClipsROSPlugin, ClipsTFPlugin, ClipsWebviewPlugin, ColliPlugin, DynamixelPlugin, EclipseCLPPlugin, ExamplePlugin, FestivalPlugin, FlitePlugin, FvBasePlugin, FvFountainPlugin, FvRetrieverPlugin, FvSrSavePlugin, GazeboPlugin, GazsimCommPlugin, GazsimDepthcamPlugin, GazsimLaserPlugin, GazsimLocalizationPlugin, GazsimRobotinoPlugin, GazsimTimesourcePlugin, GazsimVisLocalizationPlugin, GazsimWebcamPlugin, GossipExampleReceiverPlugin, GossipExampleSenderPlugin, GossipPlugin, IMUPlugin, JacoPlugin, JoystickPlugin, JoystickTeleOpPlugin, KatanaPlugin, LaserClusterPlugin, LaserFilterPlugin, LaserLinesPlugin, LaserPlugin, LaserPointCloudPlugin, LuaAgentPlugin, MapLaserGenPlugin, MongoDBPlugin, MongoLogPlugin, MongoRRDPlugin, NaoQiButtonPlugin, NaoQiLedPlugin, NaoQiMotionPlugin, NaoQiPlugin, NaoQiSpeechSynthPlugin, NavGraphClustersPlugin, NavGraphGeneratorPlugin, NavGraphInteractivePlugin, NavGraphPlugin, NavGraphStaticConstraintsPlugin, OpenNiDataPlugin, OpenNiHandTrackerPlugin, OpenNiPclOnlyPlugin, OpenNiPlugin, OpenNiUserTrackerPlugin, OpenPRSAgentPlugin, OpenPRSExamplePlugin, OpenPRSPlugin, OpenRavePlugin, PanTiltPlugin, PlayerPlugin, PointCloudDBMergePlugin, PointCloudDBRetrievePlugin, PointCloudDBROSCommPlugin, PointCloudDBStorePlugin, ProcRRDPlugin, RefBoxCommPlugin, RobotinoIrPclPlugin, RobotinoPlugin, RobotinoRosJointsPlugin, RobotStatePublisherPlugin, RoombaJoystickPlugin, RoombaPlugin, RosClockPlugin, ROSCmdVelPlugin, RosImagesPlugin, RosJointPlugin, RosLaserScanPlugin, RosMoveBasePlugin, RosNavgraphBreakoutPlugin, RosNavigatorPlugin, ROSOdometryPlugin, ROSPlugin, RosPointCloudPlugin, RosPosition3DPlugin, ROSRobotDescriptionPlugin, RosSkillerPlugin, ROSTalkerPubPlugin, RosTfPlugin, ROSWebviewPlugin, RRDExamplePlugin, RRDPlugin, RRDWebPlugin, SkillerPlugin, StaticTransformsPlugin, TabletopObjectsPlugin, TestPlugin, TfExamplePlugin, TimeTrackerMainLoopPlugin, WebviewPlugin, WebviewPtzCamPlugin, XabslPlugin, and XmlRpcPlugin.

Public Member Functions

 Plugin (Configuration *config)
 Constructor. More...
 
virtual ~Plugin ()
 Virtual destructor. More...
 
void set_name (const char *name)
 Set plugin name. More...
 
const char * name () const
 Get the name of the plugin. More...
 
ThreadListthreads ()
 Get a list of threads. More...
 
virtual bool persistent ()
 Determines if the plugin can be unloaded. More...
 

Protected Attributes

ThreadList thread_list
 Thread list member. More...
 
Configurationconfig
 Fawkes configuration. More...
 

Related Functions

(Note that these are not member functions.)

typedef Plugin *(* PluginFactoryFunc) (fawkes::Configuration *)
 Plugin loader function for the shared library Do not use directly, rather use the EXPORT_PLUGIN macro. More...
 
typedef void(* PluginDestroyFunc) (Plugin *plugin)
 Plugin destructor function for the shared library. More...
 

Detailed Description

Plugin interface class.

Derive this class to create a new Fawkes plugin. There is not much that you have to do to get a basic plugin working. The base plugin will already handle all the important details.

To implement a plugin create a new class that inherits from Plugin. Call the Plugin constructor with the proper parameters in your derivate's constructor. Then in your constructor fill the thread_list member with the threads that your plugin needs. Instantiate all threads that your plugin may ever need during its lifetime, creating (blocked timing) threads during the life time of a plugin is not allowed. After the constructor the thread list has to be considered to be sealed. At the end of the file add a line like

EXPORT_PLUGIN(PluginClass)

where PluginClass is the class name of your plugin. This will create the proper glue code to make this class loadable as plugin by Fawkes.

See also
ThreadList
Author
Tim Niemueller

Definition at line 33 of file plugin.h.

Constructor & Destructor Documentation

◆ Plugin()

fawkes::Plugin::Plugin ( Configuration config)

Constructor.

Pass the name of your plugin to this ctor.

Parameters
configconfiguration

Definition at line 71 of file plugin.cpp.

References config.

◆ ~Plugin()

fawkes::Plugin::~Plugin ( )
virtual

Virtual destructor.

Definition at line 79 of file plugin.cpp.

References thread_list.

Member Function Documentation

◆ name()

const char * fawkes::Plugin::name ( ) const

Get the name of the plugin.

Returns
name of the plugin

Definition at line 142 of file plugin.cpp.

Referenced by ROSRobotDescriptionThread::init(), and GazsimCommThread::init().

◆ persistent()

bool fawkes::Plugin::persistent ( )
virtual

Determines if the plugin can be unloaded.

This method tells the plugin loader if this plugin can be unloaded. Use with care. No plugins but core plugins should return true. Only override this if needed. The default behaviour if not overridden is to return false.

Returns
true, if the plugin cannot be unloaded, false otherwise. The default implementation returns false.

Definition at line 96 of file plugin.cpp.

◆ set_name()

void fawkes::Plugin::set_name ( const char *  name)

Set plugin name.

Set the name of this plugin. This method should never be called from user code, but only from the plugin loding/initialization system.

Parameters
namenew name

Definition at line 122 of file plugin.cpp.

References fawkes::ThreadList::set_name(), and thread_list.

Referenced by fawkes::PluginLoader::get_module_manager().

◆ threads()

ThreadList & fawkes::Plugin::threads ( )

Get a list of threads.

This function shall return a list of threads. See the FawkesThreadManager for supported special types of threads. This method is called only once right after the plugin has been initialised. You may not change the list afterwards by adding or removing threads. Especially you may not delete the threads!

Returns
list of threads.

Definition at line 110 of file plugin.cpp.

References thread_list.

Referenced by LaserFilterPlugin::LaserFilterPlugin(), and fawkes::PluginManager::load().

Friends And Related Function Documentation

◆ PluginDestroyFunc

typedef void(* PluginDestroyFunc) (Plugin *plugin)
related

Plugin destructor function for the shared library.

Do not use directly, rather use the EXPORT_PLUGIN macro.

Parameters
pluginplugin to destroy

Definition at line 76 of file plugin.h.

◆ PluginFactoryFunc

typedef Plugin*(* PluginFactoryFunc) (fawkes::Configuration *)
related

Plugin loader function for the shared library Do not use directly, rather use the EXPORT_PLUGIN macro.

Definition at line 69 of file plugin.h.

Member Data Documentation

◆ config

Configuration* fawkes::Plugin::config
protected

Fawkes configuration.

You can use the configuration to add certain threads depending on the requested feature set. Use it only in your constructor.

Definition at line 58 of file plugin.h.

Referenced by ROSRobotDescriptionThread::init(), GazsimCommThread::init(), and Plugin().

◆ thread_list

ThreadList fawkes::Plugin::thread_list
protected

Thread list member.

Initialise this list with the threads that this plugin will use. These threads must exist for the whole life time of the thread. Use sleeping threads if you need to turn on and off threads dynamically. You may not add threads later to the list, as the list is shortly after the constructor sealed.

See also
ThreadList

Definition at line 53 of file plugin.h.

Referenced by BallPosLogPlugin::BallPosLogPlugin(), BlackBoardLoggerPlugin::BlackBoardLoggerPlugin(), BlackBoardLogReplayPlugin::BlackBoardLogReplayPlugin(), BlackBoardSynchronizationPlugin::BlackBoardSynchronizationPlugin(), EclipseCLPPlugin::EclipseCLPPlugin(), ExamplePlugin::ExamplePlugin(), FestivalPlugin::FestivalPlugin(), FlitePlugin::FlitePlugin(), FvBasePlugin::FvBasePlugin(), FvFountainPlugin::FvFountainPlugin(), FvRetrieverPlugin::FvRetrieverPlugin(), FvSrSavePlugin::FvSrSavePlugin(), GazeboPlugin::GazeboPlugin(), JacoPlugin::JacoPlugin(), JoystickPlugin::JoystickPlugin(), KatanaPlugin::KatanaPlugin(), LaserFilterPlugin::LaserFilterPlugin(), LaserPlugin::LaserPlugin(), LuaAgentPlugin::LuaAgentPlugin(), OpenRavePlugin::OpenRavePlugin(), PanTiltPlugin::PanTiltPlugin(), PlayerPlugin::PlayerPlugin(), RefBoxCommPlugin::RefBoxCommPlugin(), RoombaJoystickPlugin::RoombaJoystickPlugin(), RoombaPlugin::RoombaPlugin(), ROSPlugin::ROSPlugin(), ROSTalkerPubPlugin::ROSTalkerPubPlugin(), ROSWebviewPlugin::ROSWebviewPlugin(), RRDExamplePlugin::RRDExamplePlugin(), RRDPlugin::RRDPlugin(), RRDWebPlugin::RRDWebPlugin(), set_name(), SkillerPlugin::SkillerPlugin(), threads(), TimeTrackerMainLoopPlugin::TimeTrackerMainLoopPlugin(), WebviewPlugin::WebviewPlugin(), XabslPlugin::XabslPlugin(), XmlRpcPlugin::XmlRpcPlugin(), and ~Plugin().


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