CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Member Functions | List of all members
ctkPluginActivator Class Referenceabstract

#include <Libs/PluginFramework/ctkPluginActivator.h>

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 Plugin facilities:

class MyPlugin : public QObject, public ctkPluginActivator
{
Q_OBJECT
Q_INTERFACES(ctkPluginActivator)
public:
void start(ctkPluginContext* context);
void stop(ctkPluginContext* context);
};
virtual void stop(ctkPluginContext *context)=0
virtual void start(ctkPluginContext *context)=0

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 Plugins 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 71 of file ctkPluginActivator.h.

Constructor & Destructor Documentation

◆ ~ctkPluginActivator()

virtual ctkPluginActivator::~ctkPluginActivator ( )
inlinevirtual

Definition at line 75 of file ctkPluginActivator.h.

Member Function Documentation

◆ start()

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
contextThe execution context of the plugin being started.
Exceptions
std::exceptionIf 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.

◆ stop()

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
contextThe execution context of the plugin being stopped.
Exceptions
std::exceptionIf 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.

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