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

Provides a back-end implementation to enable directly calling a function pointer. More...

#include <Libs/CommandLineModules/Backend/FunctionPointer/ctkCmdLineModuleBackendFunctionPointer.h>

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

Classes

class  Description
 

Public Member Functions

 ctkCmdLineModuleBackendFunctionPointer ()
 
virtual QString description () const
 Returns a brief description of the type of the backend. More...
 
virtual QString name () const
 Returns the name of the type of the backend, not the name of the thing or application that is run. More...
 
virtual QByteArray rawXmlDescription (const QUrl &location, int timeout)
 Get the XML parameter description from the given location. More...
 
QList< QUrl > registeredFunctionPointers () const
 
template<typename A >
DescriptionregisterFunctionPointer (const QString &title, void(*fp)(A), const QString &paramLabel=QString(), const QString &paramDescr=QString())
 
template<typename A , typename B >
DescriptionregisterFunctionPointer (const QString &title, void(*fp)(A, B), const QString &paramLabel0=QString(), const QString &paramDescr0=QString(), const QString &paramLabel1=QString(), const QString &paramDescr1=QString())
 
virtual QList< QString > schemes () const
 Returns a list of URL schemes this back-end can handle. More...
 
virtual qint64 timeStamp (const QUrl &location) const
 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...
 
 ~ctkCmdLineModuleBackendFunctionPointer ()
 
- Public Member Functions inherited from ctkCmdLineModuleBackend
QByteArray rawXmlDescription (const QUrl &location)
 Get the XML parameter description from the given location. More...
 
virtual int timeOutForXmlRetrieval () const
 returns the number of milliseconds to wait when retrieving xml. More...
 
virtual ~ctkCmdLineModuleBackend ()
 

Protected Member Functions

virtual QList< QVariant > arguments (ctkCmdLineModuleFrontend *frontend) const
 
virtual ctkCmdLineModuleFuture run (ctkCmdLineModuleFrontend *frontend)
 The main method to actually execute the back-end process. More...
 

Detailed Description

Provides a back-end implementation to enable directly calling a function pointer.

Warning
This back-end is highly experimental and will not work for most function pointers when trying to register them via registerFunctionPointer().

Definition at line 102 of file ctkCmdLineModuleBackendFunctionPointer.h.

Constructor & Destructor Documentation

◆ ctkCmdLineModuleBackendFunctionPointer()

ctkCmdLineModuleBackendFunctionPointer::ctkCmdLineModuleBackendFunctionPointer ( )

◆ ~ctkCmdLineModuleBackendFunctionPointer()

ctkCmdLineModuleBackendFunctionPointer::~ctkCmdLineModuleBackendFunctionPointer ( )

Member Function Documentation

◆ arguments()

virtual QList<QVariant> ctkCmdLineModuleBackendFunctionPointer::arguments ( ctkCmdLineModuleFrontend frontend) const
protectedvirtual

◆ description()

virtual QString ctkCmdLineModuleBackendFunctionPointer::description ( ) const
virtual

Returns a brief description of the type of the backend.

Returns
A QString containing a description.

Implements ctkCmdLineModuleBackend.

◆ name()

virtual QString ctkCmdLineModuleBackendFunctionPointer::name ( ) const
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.

Implements ctkCmdLineModuleBackend.

◆ rawXmlDescription()

virtual QByteArray ctkCmdLineModuleBackendFunctionPointer::rawXmlDescription ( const QUrl &  location,
int  timeout 
)
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.

Implements ctkCmdLineModuleBackend.

◆ registeredFunctionPointers()

QList<QUrl> ctkCmdLineModuleBackendFunctionPointer::registeredFunctionPointers ( ) const

◆ registerFunctionPointer() [1/2]

template<typename A >
Description* ctkCmdLineModuleBackendFunctionPointer::registerFunctionPointer ( const QString &  title,
void(*)(A)  fp,
const QString &  paramLabel = QString(),
const QString &  paramDescr = QString() 
)
inline

Definition at line 158 of file ctkCmdLineModuleBackendFunctionPointer.h.

◆ registerFunctionPointer() [2/2]

template<typename A , typename B >
Description* ctkCmdLineModuleBackendFunctionPointer::registerFunctionPointer ( const QString &  title,
void(*)(A, B)  fp,
const QString &  paramLabel0 = QString(),
const QString &  paramDescr0 = QString(),
const QString &  paramLabel1 = QString(),
const QString &  paramDescr1 = QString() 
)
inline

Definition at line 172 of file ctkCmdLineModuleBackendFunctionPointer.h.

◆ run()

virtual ctkCmdLineModuleFuture ctkCmdLineModuleBackendFunctionPointer::run ( ctkCmdLineModuleFrontend frontend)
protectedvirtual

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.

Implements ctkCmdLineModuleBackend.

◆ schemes()

virtual QList<QString> ctkCmdLineModuleBackendFunctionPointer::schemes ( ) const
virtual

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

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

Implements ctkCmdLineModuleBackend.

◆ timeStamp()

virtual qint64 ctkCmdLineModuleBackendFunctionPointer::timeStamp ( const QUrl &  location) const
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.

Implements ctkCmdLineModuleBackend.


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