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 | Protected Member Functions | Friends | List of all members
ctkPluginFramework Class Reference

#include <Libs/PluginFramework/ctkPluginFramework.h>

Inheritance diagram for ctkPluginFramework:
Inheritance graph
[legend]
Collaboration diagram for ctkPluginFramework:
Collaboration graph
[legend]

Public Member Functions

QHash< QString, QString > getHeaders ()
 
QByteArray getResource (const QString &path) const
 
QStringList getResourceList (const QString &path) const
 
void init ()
 
void start (const ctkPlugin::StartOptions &options=0)
 
void stop (const StopOptions &options=0)
 
void uninstall ()
 
ctkPluginFrameworkEvent waitForStop (unsigned long timeout)
 
- Public Member Functions inherited from ctkPlugin
virtual QStringList findResources (const QString &path, const QString &filePattern, bool recurse) const
 
QString getLocation () const
 
ctkPluginContextgetPluginContext () const
 
long getPluginId () const
 
ctkPluginLocalization getPluginLocalization (const QLocale &locale, const QString &base=ctkPluginConstants::PLUGIN_LOCALIZATION_DEFAULT_BASENAME) const
 
State getState () const
 
QString getSymbolicName () const
 
ctkVersion getVersion () const
 
virtual void start (const StartOptions &options=START_ACTIVATION_POLICY)
 
void update (const QUrl &updateLocation=QUrl())
 
virtual ~ctkPlugin ()
 

Protected Member Functions

 ctkPluginFramework ()
 
- Protected Member Functions inherited from ctkPlugin
 ctkPlugin ()
 
void init (const QWeakPointer< ctkPlugin > &self, ctkPluginFrameworkContext *fw, QSharedPointer< ctkPluginArchive > ba)
 
void init (ctkPluginPrivate *dd)
 

Friends

class ctkPluginFrameworkContext
 

Additional Inherited Members

- Public Types inherited from ctkPlugin
enum  StartOption { START_TRANSIENT = 0x00000001 , START_ACTIVATION_POLICY = 0x00000002 }
 
enum  State {
  UNINSTALLED = 0x00000001 , INSTALLED = 0x00000002 , RESOLVED = 0x00000004 , STARTING = 0x00000008 ,
  STOPPING = 0x00000010 , ACTIVE = 0x00000020
}
 
enum  StopOption { STOP_TRANSIENT = 0x00000001 }
 
- Protected Attributes inherited from ctkPlugin
ctkPluginPrivate * d_ptr
 

Detailed Description

A ctkPluginFramework instance. A ctkPluginFramework is also known as a System Plugin.

ctkPluginFramework instances are created using a ctkPluginFrameworkFactory. The methods of this class can be used to manage and control the created plugin framework instance.

Remarks
This class is thread safe.

Definition at line 45 of file ctkPluginFramework.h.

Constructor & Destructor Documentation

◆ ctkPluginFramework()

ctkPluginFramework::ctkPluginFramework ( )
protected

Member Function Documentation

◆ getHeaders()

QHash<QString, QString> ctkPluginFramework::getHeaders ( )
virtual
See also
ctkPlugin::getHeaders()

Reimplemented from ctkPlugin.

◆ getResource()

QByteArray ctkPluginFramework::getResource ( const QString &  path) const
virtual
See also
ctkPlugin::getResource()

Reimplemented from ctkPlugin.

◆ getResourceList()

QStringList ctkPluginFramework::getResourceList ( const QString &  path) const
virtual
See also
ctkPlugin::getResourceList()

Reimplemented from ctkPlugin.

◆ init()

void ctkPluginFramework::init ( )

Initialize this ctkPluginFramework. After calling this method, this ctkPluginFramework must:

  • Be in the STARTING state.
  • Have a valid Plugin Context.
  • Be at start level 0.
  • Have event handling enabled.
  • Have create ctkPlugin objects for all installed plugins.
  • Have registered any framework services.

This ctkPluginFramework will not actually be started until start is called.

This method does nothing if called when this ctkPluginFramework is in the STARTING, ACTIVE or STOPPING states.

Exceptions
ctkPluginExceptionIf this ctkPluginFramework could not be initialized.

◆ start()

void ctkPluginFramework::start ( const ctkPlugin::StartOptions &  options = 0)

Start this ctkPluginFramework.

The following steps are taken to start this ctkPluginFramework:

  1. If this ctkPluginFramework is not in the STARTING state, initialize this ctkPluginFramework.
  2. All installed plugins must be started in accordance with each plugin's persistent autostart setting. This means some plugins will not be started, some will be started with lazy activation and some will be started with their declared activation policy. Any exceptions that occur during plugin starting must be wrapped in a ctkPluginException and then published as a plugin framework event of type ctkPluginFrameworkEvent::PLUGIN_ERROR
  3. This PluinFramework's state is set to ACTIVE.
  4. A plugin framework event of type ctkPluginFrameworkEvent::FRAMEWORK_STARTED is fired
Parameters
optionsIgnored. There are no start options for the ctkPluginFramework.
Exceptions
ctkPluginExceptionIf this ctkPluginFramework could not be started.

◆ stop()

void ctkPluginFramework::stop ( const StopOptions &  options = 0)
virtual

Stop this ctkPluginFramework.

The method returns immediately to the caller after initiating the following steps to be taken on another thread.

  1. This Framework's state is set to STOPPING.
  2. All installed plugins must be stopped without changing each plugin's persistent autostart setting. If this Framework implements the optional Start Level Service Specification, then the start level of this Framework is moved to start level zero (0), as described in the Start Level Service Specification. Any exceptions that occur during plugin stopping must be wrapped in a ctkPluginException and then published as a framework event of type ctkPluginFrameworkEvent#PLUGIN_ERROR
  3. Unregister all services registered by this Framework.
  4. Event handling is disabled.
  5. This Framework's state is set to RESOLVED.
  6. All resources held by this Framework are released. This includes threads, loaded libraries, open files, etc.
  7. Notify all threads that are waiting at waitForStop that the stop operation has completed.

After being stopped, this Framework may be discarded, initialized or started.

Parameters
optionsIgnored. There are no stop options for the Framework.
Exceptions
ctkPluginExceptionIf stopping this Framework could not be initiated.
See also
"Start Level Service Specification"

Reimplemented from ctkPlugin.

◆ uninstall()

void ctkPluginFramework::uninstall ( )
virtual

The ctkPluginFramework cannot be uninstalled.

This method always throws a ctkPluginException.

Exceptions
ctkPluginExceptionThis Framework cannot be uninstalled.

Reimplemented from ctkPlugin.

◆ waitForStop()

ctkPluginFrameworkEvent ctkPluginFramework::waitForStop ( unsigned long  timeout)

Wait until this ctkPluginFramework has completely stopped. The stop and update methods perform an asynchronous stop of the Framework. This method can be used to wait until the asynchronous stop of this Framework has completed. This method will only wait if called when this Framework is in the STARTING, ACTIVE, or STOPPING states. Otherwise it will return immediately.

A Framework Event is returned to indicate why this Framework has stopped.

Parameters
timeoutMaximum number of milliseconds to wait until this Framework has completely stopped. A value of zero will wait indefinitely.
Returns
A Framework Event indicating the reason this method returned. The following ctkPluginFrameworkEvent types may be returned by this method.
  • STOPPED - This Framework has been stopped.

  • STOPPED_UPDATE - This Framework has been updated which has shutdown and will now restart.

  • ERROR - The Framework encountered an error while shutting down or an error has occurred which forced the framework to shutdown.

  • WAIT_TIMEDOUT - This method has timed out and returned before this Framework has stopped.

Friends And Related Function Documentation

◆ ctkPluginFrameworkContext

friend class ctkPluginFrameworkContext
friend

Definition at line 195 of file ctkPluginFramework.h.


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