Public Member Functions

ctkPluginActivator Class Reference

#include <Libs/PluginFramework/ctkPluginActivator.h>

Inheritance diagram for ctkPluginActivator:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual void start (ctkPluginContext *context)=0
virtual void stop (ctkPluginContext *context)=0
virtual ~ctkPluginActivator ()

Detailed Description

Customizes the starting and stopping of a plugin.

ctkPluginActivator is an interface that must be implemented by every plugin in the Framework. The Framework can create instances of a plugin's ctkPluginActivator as required. If an instance's ctkPluginActivator::start method executes successfully, it is guaranteed that the same instance's ctkPluginActivator::stop method will be called when the plugin is to be stopped. The Framework must not concurrently call a ctkPluginActivator object.

ctkPluginActivator is a Qt interface which must be implemented using the standard Qt ctkPlugin facilities:

 class MyPlugin : public QObject, public ctkctkPluginActivator
 {
   Q_OBJECT
   Q_INTERFACES(ctk::ctkPluginActivator)
 public:
   void start(ctkctkPluginContext* context);
   void stop(ctkctkPluginContext* context);
 };
 

And in your implementation file:

 Q_EXPORT_PLUGIN2(mypluginlib, MyPlugin)
 

where mypluginlib is the basename of your shared plugin library.

See the Qt Documentation about How to Create Qt ctkPlugins for details.

The class implementing the ctkPluginActivator interface must have a public constructor that takes no parameters so that a ctkPluginActivator object can be created by QPluginLoader::instance.

Definition at line 69 of file ctkPluginActivator.h.


Constructor & Destructor Documentation

virtual ctkPluginActivator::~ctkPluginActivator (  )  [inline, virtual]

Definition at line 73 of file ctkPluginActivator.h.


Member Function Documentation

virtual void ctkPluginActivator::start ( ctkPluginContext context  )  [pure virtual]

Called when this plugin is started so the Framework can perform the plugin-specific activities necessary to start this plugin. This method can be used to register services or to allocate any resources that this plugin needs.

This method must complete and return to its caller in a timely manner.

Parameters:
context The execution context of the plugin being started.
Exceptions:
std::exception If this method throws an exception, this plugin is marked as stopped and the Framework will remove this plugin's listeners, unregister all services registered by this plugin, and release all services used by this plugin.

Implemented in ctkCLIPlugin, and ctkEventBusPlugin.

virtual void ctkPluginActivator::stop ( ctkPluginContext context  )  [pure virtual]

Called when this plugin is stopped so the Framework can perform the plugin-specific activities necessary to stop the plugin. In general, this method should undo the work that the ctkPluginActivator::start method started. There should be no active threads that were started by this plugin when this plugin returns. A stopped plugin must not call any Framework objects.

This method must complete and return to its caller in a timely manner.

Parameters:
context The execution context of the plugin being stopped.
Exceptions:
std::exception If this method throws an exception, the plugin is still marked as stopped, and the Framework will remove the plugin's listeners, unregister all services registered by the plugin, and release all services used by the plugin.

Implemented in ctkCLIPlugin, and ctkEventBusPlugin.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines