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
ctkCmdLineModuleBackend Struct Referenceabstract

Abstract base class for all back-end command line module implementations. More...

#include <Libs/CommandLineModules/Core/ctkCmdLineModuleBackend.h>

Inheritance diagram for ctkCmdLineModuleBackend:
Inheritance graph
[legend]

Public Member Functions

virtual QString description () const =0
 Returns a brief description of the type of the backend. More...
 
virtual QString name () const =0
 Returns the name of the type of the backend, not the name of the thing or application that is run. More...
 
QByteArray rawXmlDescription (const QUrl &location)
 Get the XML parameter description from the given location. More...
 
virtual QByteArray rawXmlDescription (const QUrl &location, int timeout)=0
 Get the XML parameter description from the given location. More...
 
virtual QList< QString > schemes () const =0
 Returns a list of URL schemes this back-end can handle. More...
 
virtual int timeOutForXmlRetrieval () const
 returns the number of milliseconds to wait when retrieving xml. More...
 
virtual qint64 timeStamp (const QUrl &location) const =0
 Returns a timestap of the backend, which for example in the case of the LocalProcess may be the last modified time of the command line application. More...
 
virtual ~ctkCmdLineModuleBackend ()
 

Protected Member Functions

virtual ctkCmdLineModuleFuture run (ctkCmdLineModuleFrontend *frontend)=0
 The main method to actually execute the back-end process. More...
 

Friends

class ctkCmdLineModuleManager
 

Detailed Description

Abstract base class for all back-end command line module implementations.

A back-end is responsible for providing the XML module description for a given URL and its "timestamp". It also knows how to actually run a module, using the current parameter values provided by a ctkCmdLineModuleFrontend instance.

See also
ctkCmdLineModuleBackendLocalProcess
ctkCmdLineModuleBackendFunctionPointer

Definition at line 46 of file ctkCmdLineModuleBackend.h.

Constructor & Destructor Documentation

◆ ~ctkCmdLineModuleBackend()

virtual ctkCmdLineModuleBackend::~ctkCmdLineModuleBackend ( )
virtual

Member Function Documentation

◆ description()

virtual QString ctkCmdLineModuleBackend::description ( ) const
pure virtual

Returns a brief description of the type of the backend.

Returns
A QString containing a description.

Implemented in ctkCmdLineModuleBackendXMLChecker, ctkCmdLineModuleBackendLocalProcess, and ctkCmdLineModuleBackendFunctionPointer.

◆ name()

virtual QString ctkCmdLineModuleBackend::name ( ) const
pure virtual

Returns the name of the type of the backend, not the name of the thing or application that is run.

Returns
A QString containing the name.

Implemented in ctkCmdLineModuleBackendXMLChecker, ctkCmdLineModuleBackendLocalProcess, and ctkCmdLineModuleBackendFunctionPointer.

◆ rawXmlDescription() [1/2]

QByteArray ctkCmdLineModuleBackend::rawXmlDescription ( const QUrl &  location)

Get the XML parameter description from the given location.

Parameters
locationThe location URL specifying the module.
Returns
The raw XML parameter description.

This method calls rawXmlDescription(const QUrl&, int) with a timeout of 30 seconds.

Exceptions
ctkCmdLineModuleTimeoutExceptionif a time-out occurred when retrieving the XML parameter description.
ctkCmdLineModuleRunExceptionif a runtime error occurred when invoking the module to retrieve the XML parameter description.

◆ rawXmlDescription() [2/2]

virtual QByteArray ctkCmdLineModuleBackend::rawXmlDescription ( const QUrl &  location,
int  timeout 
)
pure virtual

Get the XML parameter description from the given location.

Parameters
locationThe location URL specifying the module.
timeoutThe time-out for retrieving the XML parameter description
Returns
The raw XML parameter description.

This method may be concurrently called by the ctkCmdLineModuleManager and must be thread-safe. Implementations must not use any caching mechanism, as caching is done by the ctkCmdLineModuleManager itself, checking the return value of timeStamp().

Implementations should also throw either a ctkCmdLineModuleTimeoutException object if a time-out occured when retrieving the XML parameter description or a ctkCmdLineModuleRunException for any other error during invocation of the module.

Exceptions
ctkCmdLineModuleTimeoutExceptionif a time-out occurred when retrieving the XML parameter description.
ctkCmdLineModuleRunExceptionif a runtime error occurred when invoking the module to retrieve the XML parameter description.

Implemented in ctkCmdLineModuleBackendXMLChecker, ctkCmdLineModuleBackendLocalProcess, and ctkCmdLineModuleBackendFunctionPointer.

◆ run()

virtual ctkCmdLineModuleFuture ctkCmdLineModuleBackend::run ( ctkCmdLineModuleFrontend frontend)
protectedpure virtual

The main method to actually execute the back-end process.

Parameters
frontendA pointer to a front end implementation.

Implementations must execute the actual task of running the module asynchronously and return from this method immediately. After returning from this method, accessing the frontend pointer is not guaranteed to be safe.

Implemented in ctkCmdLineModuleBackendXMLChecker, ctkCmdLineModuleBackendLocalProcess, and ctkCmdLineModuleBackendFunctionPointer.

◆ schemes()

virtual QList<QString> ctkCmdLineModuleBackend::schemes ( ) const
pure virtual

Returns a list of URL schemes this back-end can handle.

Returns
A list of "schemes", meaning the capabilities.

Implemented in ctkCmdLineModuleBackendXMLChecker, ctkCmdLineModuleBackendLocalProcess, and ctkCmdLineModuleBackendFunctionPointer.

◆ timeOutForXmlRetrieval()

virtual int ctkCmdLineModuleBackend::timeOutForXmlRetrieval ( ) const
virtual

returns the number of milliseconds to wait when retrieving xml.

The default implementation returns 0, which signals that the global timeout value from the ctkCmdLineModuleManager object with which this backend was registered should be used.

Returns
int Time-out in milliseconds.

◆ timeStamp()

virtual qint64 ctkCmdLineModuleBackend::timeStamp ( const QUrl &  location) const
pure virtual

Returns a timestap of the backend, which for example in the case of the LocalProcess may be the last modified time of the command line application.

Implemented in ctkCmdLineModuleBackendXMLChecker, ctkCmdLineModuleBackendLocalProcess, and ctkCmdLineModuleBackendFunctionPointer.

Friends And Related Function Documentation

◆ ctkCmdLineModuleManager

friend class ctkCmdLineModuleManager
friend

Definition at line 128 of file ctkCmdLineModuleBackend.h.


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