Fawkes API  Fawkes Development Version
fawkes::Plugin Class Reference

#include <>>

Inherited by AmclPlugin, ASPPlugin, BallPosLogPlugin, BlackBoardLoggerPlugin, BlackBoardLogReplayPlugin, BlackBoardSynchronizationPlugin, Bumblebee2Plugin, CedarPlugin, ClipsAgentPlugin, ClipsExecutivePlugin, ClipsExecutiveRestApiPlugin, ClipsNavGraphPlugin, ClipsPddlParserPlugin, CLIPSPlugin, ClipsProtobufPlugin, ClipsRestApiPlugin, ClipsRobotMemoryPlugin, ClipsROSPlugin, ClipsTFPlugin, ColliPlugin, DynamixelPlugin, EclipseCLPPlugin, ExamplePlugin, FestivalPlugin, FlitePlugin, FvBasePlugin, FvFountainPlugin, FvRetrieverPlugin, GazeboPlugin, GazsimCommPlugin, GazsimDepthcamPlugin, GazsimLaserPlugin, GazsimLocalizationPlugin, GazsimRobotinoPlugin, GazsimTimesourcePlugin, GazsimVisLocalizationPlugin, GazsimWebcamPlugin, GossipExampleReceiverPlugin, GossipExampleSenderPlugin, GossipPlugin, IMUPlugin, JacoPlugin, JoystickPlugin, JoystickTeleOpPlugin, KatanaPlugin, LaserClusterPlugin, LaserFilterPlugin, LaserLinesPlugin, LaserPlugin, LaserPointCloudPlugin, LuaAgentPlugin, MapLaserGenPlugin, MetricsPlugin, MongoDBPlugin, MongoLogPlugin, MongoRRDPlugin, NaoQiButtonPlugin, NaoQiLedPlugin, NaoQiMotionPlugin, NaoQiPlugin, NaoQiSpeechSynthPlugin, NavGraphClustersPlugin, NavGraphGeneratorPlugin, NavGraphInteractivePlugin, NavGraphPlugin, NavGraphStaticConstraintsPlugin, OpenNiDataPlugin, OpenNiHandTrackerPlugin, OpenNiPclOnlyPlugin, OpenNiPlugin, OpenNiUserTrackerPlugin, OpenPRSAgentPlugin, OpenPRSExamplePlugin, OpenPRSPlugin, OpenRavePlugin, OpenraveRobotMemoryPlugin, PanTiltPlugin, PddlPlannerPlugin, PddlRobotMemoryPlugin, PlayerPlugin, PlexilExecutivePlugin, PointCloudDBMergePlugin, PointCloudDBRetrievePlugin, PointCloudDBROSCommPlugin, PointCloudDBStorePlugin, ProcRRDPlugin, Realsense2Plugin, RealsensePlugin, RefBoxCommPlugin, RobotinoIrPclPlugin, RobotinoPlugin, RobotinoRosJointsPlugin, RobotMemoryPlugin, RobotMemoryTestPlugin, RobotStatePublisherPlugin, RoombaJoystickPlugin, RoombaPlugin, RosClockPlugin, ROSCmdVelPlugin, RosDynamicReconfigurePlugin, RosImagesPlugin, RosIMUPlugin, RosJointPlugin, RosLaserScanPlugin, RosMoveBasePlugin, RosNavgraphBreakoutPlugin, RosNavigatorPlugin, ROSOdometryPlugin, ROSPlugin, RosPointCloudPlugin, RosPosition3DPlugin, ROSRobotDescriptionPlugin, RosSkillerPlugin, ROSTalkerPubPlugin, RosTfPlugin, RRDExamplePlugin, RRDPlugin, SkillerPlugin, SkillerRestApiPlugin, SkillerSimulatorPlugin, StaticTransformsPlugin, StnGeneratorPlugin, SyncPointTestPlugin, TabletopObjectsPlugin, TestPlugin, TfExamplePlugin, TimeTrackerMainLoopPlugin, WebviewPlugin, 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 39 of file plugin.h.

Constructor & Destructor Documentation

◆ Plugin()

Plugin::Plugin ( Configuration config)

Constructor.

Pass the name of your plugin to this ctor.

Parameters
configconfiguration

Definition at line 79 of file plugin.cpp.

References thread_list.

◆ ~Plugin()

Plugin::~Plugin ( )
virtual

Virtual destructor.

Definition at line 87 of file plugin.cpp.

Member Function Documentation

◆ name()

const char * Plugin::name ( ) const

Get the name of the plugin.

Returns
name of the plugin

Definition at line 149 of file plugin.cpp.

Referenced by threads().

◆ persistent()

bool 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 104 of file plugin.cpp.

References thread_list.

◆ set_name()

void 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 129 of file plugin.cpp.

◆ threads()

ThreadList & 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 118 of file plugin.cpp.

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

Referenced by LaserFilterPlugin::LaserFilterPlugin().

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 82 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 75 of file plugin.h.

Member Data Documentation

◆ config

◆ 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 59 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(), GazeboPlugin::GazeboPlugin(), JacoPlugin::JacoPlugin(), JoystickPlugin::JoystickPlugin(), KatanaPlugin::KatanaPlugin(), LaserFilterPlugin::LaserFilterPlugin(), LaserPlugin::LaserPlugin(), LuaAgentPlugin::LuaAgentPlugin(), OpenRavePlugin::OpenRavePlugin(), PanTiltPlugin::PanTiltPlugin(), persistent(), PlayerPlugin::PlayerPlugin(), Plugin(), RefBoxCommPlugin::RefBoxCommPlugin(), RoombaJoystickPlugin::RoombaJoystickPlugin(), RoombaPlugin::RoombaPlugin(), ROSPlugin::ROSPlugin(), ROSTalkerPubPlugin::ROSTalkerPubPlugin(), RRDExamplePlugin::RRDExamplePlugin(), RRDPlugin::RRDPlugin(), SkillerPlugin::SkillerPlugin(), SkillerSimulatorPlugin::SkillerSimulatorPlugin(), threads(), TimeTrackerMainLoopPlugin::TimeTrackerMainLoopPlugin(), WebviewPlugin::WebviewPlugin(), XabslPlugin::XabslPlugin(), and XmlRpcPlugin::XmlRpcPlugin().


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