|
@@ -37,12 +37,14 @@
|
|
|
namespace ctk {
|
|
namespace ctk {
|
|
|
namespace CmdLineModuleBackendFunctionPointer {
|
|
namespace CmdLineModuleBackendFunctionPointer {
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
template<>
|
|
template<>
|
|
|
CTK_CMDLINEMODULEBACKENDFP_EXPORT QString GetParameterTypeName<int>()
|
|
CTK_CMDLINEMODULEBACKENDFP_EXPORT QString GetParameterTypeName<int>()
|
|
|
{
|
|
{
|
|
|
return "integer";
|
|
return "integer";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
template<>
|
|
template<>
|
|
|
CTK_CMDLINEMODULEBACKENDFP_EXPORT QString GetParameterTypeName<QList<int> >()
|
|
CTK_CMDLINEMODULEBACKENDFP_EXPORT QString GetParameterTypeName<QList<int> >()
|
|
|
{
|
|
{
|
|
@@ -52,6 +54,7 @@ CTK_CMDLINEMODULEBACKENDFP_EXPORT QString GetParameterTypeName<QList<int> >()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
void CalculateFibonacciNumbers(int level) //, QList<int>* result)
|
|
void CalculateFibonacciNumbers(int level) //, QList<int>* result)
|
|
|
{
|
|
{
|
|
|
qDebug() << "Number: 0";
|
|
qDebug() << "Number: 0";
|
|
@@ -74,70 +77,84 @@ void CalculateFibonacciNumbers(int level) //, QList<int>* result)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
ctkCmdLineModuleBackendFunctionPointer::Description::Description()
|
|
ctkCmdLineModuleBackendFunctionPointer::Description::Description()
|
|
|
: d(new ctkCmdLineModuleBackendFunctionPointer::DescriptionPrivate)
|
|
: d(new ctkCmdLineModuleBackendFunctionPointer::DescriptionPrivate)
|
|
|
{
|
|
{
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
ctkCmdLineModuleBackendFunctionPointer::Description::~Description()
|
|
ctkCmdLineModuleBackendFunctionPointer::Description::~Description()
|
|
|
{
|
|
{
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
QUrl ctkCmdLineModuleBackendFunctionPointer::Description::moduleLocation() const
|
|
QUrl ctkCmdLineModuleBackendFunctionPointer::Description::moduleLocation() const
|
|
|
{
|
|
{
|
|
|
return d->ModuleLocation;
|
|
return d->ModuleLocation;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
QString ctkCmdLineModuleBackendFunctionPointer::Description::moduleCategory() const
|
|
QString ctkCmdLineModuleBackendFunctionPointer::Description::moduleCategory() const
|
|
|
{
|
|
{
|
|
|
return d->ModuleCategory;
|
|
return d->ModuleCategory;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
void ctkCmdLineModuleBackendFunctionPointer::Description::setModuleCategory(const QString& category)
|
|
void ctkCmdLineModuleBackendFunctionPointer::Description::setModuleCategory(const QString& category)
|
|
|
{
|
|
{
|
|
|
d->ModuleCategory = category;
|
|
d->ModuleCategory = category;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
QString ctkCmdLineModuleBackendFunctionPointer::Description::moduleTitle() const
|
|
QString ctkCmdLineModuleBackendFunctionPointer::Description::moduleTitle() const
|
|
|
{
|
|
{
|
|
|
return d->ModuleTitle;
|
|
return d->ModuleTitle;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
void ctkCmdLineModuleBackendFunctionPointer::Description::setModuleTitle(const QString &title)
|
|
void ctkCmdLineModuleBackendFunctionPointer::Description::setModuleTitle(const QString &title)
|
|
|
{
|
|
{
|
|
|
d->ModuleTitle = title;
|
|
d->ModuleTitle = title;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
QString ctkCmdLineModuleBackendFunctionPointer::Description::moduleDescription() const
|
|
QString ctkCmdLineModuleBackendFunctionPointer::Description::moduleDescription() const
|
|
|
{
|
|
{
|
|
|
return d->ModuleDescription;
|
|
return d->ModuleDescription;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
void ctkCmdLineModuleBackendFunctionPointer::Description::setModuleDescription(const QString &description)
|
|
void ctkCmdLineModuleBackendFunctionPointer::Description::setModuleDescription(const QString &description)
|
|
|
{
|
|
{
|
|
|
d->ModuleDescription = description;
|
|
d->ModuleDescription = description;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
QString ctkCmdLineModuleBackendFunctionPointer::Description::moduleVersion() const
|
|
QString ctkCmdLineModuleBackendFunctionPointer::Description::moduleVersion() const
|
|
|
{
|
|
{
|
|
|
return d->ModuleVersion;
|
|
return d->ModuleVersion;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
void ctkCmdLineModuleBackendFunctionPointer::Description::setModuleVersion(const QString &version)
|
|
void ctkCmdLineModuleBackendFunctionPointer::Description::setModuleVersion(const QString &version)
|
|
|
{
|
|
{
|
|
|
d->ModuleVersion = version;
|
|
d->ModuleVersion = version;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
QString ctkCmdLineModuleBackendFunctionPointer::Description::moduleContributor() const
|
|
QString ctkCmdLineModuleBackendFunctionPointer::Description::moduleContributor() const
|
|
|
{
|
|
{
|
|
|
return d->ModuleContributor;
|
|
return d->ModuleContributor;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
void ctkCmdLineModuleBackendFunctionPointer::Description::setModuleContributor(const QString &contributor)
|
|
void ctkCmdLineModuleBackendFunctionPointer::Description::setModuleContributor(const QString &contributor)
|
|
|
{
|
|
{
|
|
|
d->ModuleContributor = contributor;
|
|
d->ModuleContributor = contributor;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
ctkCmdLineModuleBackendFunctionPointer::Description::Description(const QUrl &location,
|
|
ctkCmdLineModuleBackendFunctionPointer::Description::Description(const QUrl &location,
|
|
|
const ctk::CmdLineModuleBackendFunctionPointer::FunctionPointerProxy &fpProxy)
|
|
const ctk::CmdLineModuleBackendFunctionPointer::FunctionPointerProxy &fpProxy)
|
|
|
: d(new ctkCmdLineModuleBackendFunctionPointer::DescriptionPrivate)
|
|
: d(new ctkCmdLineModuleBackendFunctionPointer::DescriptionPrivate)
|
|
@@ -146,45 +163,53 @@ ctkCmdLineModuleBackendFunctionPointer::Description::Description(const QUrl &loc
|
|
|
d->FpProxy = fpProxy;
|
|
d->FpProxy = fpProxy;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
struct ctkCmdLineModuleBackendFunctionPointerPrivate
|
|
struct ctkCmdLineModuleBackendFunctionPointerPrivate
|
|
|
{
|
|
{
|
|
|
QHash<QUrl, ctkCmdLineModuleBackendFunctionPointer::Description> UrlToFpDescription;
|
|
QHash<QUrl, ctkCmdLineModuleBackendFunctionPointer::Description> UrlToFpDescription;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
ctkCmdLineModuleBackendFunctionPointer::ctkCmdLineModuleBackendFunctionPointer()
|
|
ctkCmdLineModuleBackendFunctionPointer::ctkCmdLineModuleBackendFunctionPointer()
|
|
|
: d(new ctkCmdLineModuleBackendFunctionPointerPrivate)
|
|
: d(new ctkCmdLineModuleBackendFunctionPointerPrivate)
|
|
|
{
|
|
{
|
|
|
this->registerFunctionPointer("Fibonacci Number", CalculateFibonacciNumbers, "Count");
|
|
this->registerFunctionPointer("Fibonacci Number", CalculateFibonacciNumbers, "Count");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
QString ctkCmdLineModuleBackendFunctionPointer::name() const
|
|
QString ctkCmdLineModuleBackendFunctionPointer::name() const
|
|
|
{
|
|
{
|
|
|
return "Function Pointer (experimental)";
|
|
return "Function Pointer (experimental)";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
QString ctkCmdLineModuleBackendFunctionPointer::description() const
|
|
QString ctkCmdLineModuleBackendFunctionPointer::description() const
|
|
|
{
|
|
{
|
|
|
return "Calls a previously registered function pointer.";
|
|
return "Calls a previously registered function pointer.";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
QList<QString> ctkCmdLineModuleBackendFunctionPointer::schemes() const
|
|
QList<QString> ctkCmdLineModuleBackendFunctionPointer::schemes() const
|
|
|
{
|
|
{
|
|
|
static QList<QString> supportedSchemes = QList<QString>() << "fp";
|
|
static QList<QString> supportedSchemes = QList<QString>() << "fp";
|
|
|
return supportedSchemes;
|
|
return supportedSchemes;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
qint64 ctkCmdLineModuleBackendFunctionPointer::timeStamp(const QUrl &location) const
|
|
qint64 ctkCmdLineModuleBackendFunctionPointer::timeStamp(const QUrl &location) const
|
|
|
{
|
|
{
|
|
|
Q_UNUSED(location)
|
|
Q_UNUSED(location)
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
QByteArray ctkCmdLineModuleBackendFunctionPointer::rawXmlDescription(const QUrl& location)
|
|
QByteArray ctkCmdLineModuleBackendFunctionPointer::rawXmlDescription(const QUrl& location)
|
|
|
{
|
|
{
|
|
|
if (!d->UrlToFpDescription.contains(location)) return QByteArray();
|
|
if (!d->UrlToFpDescription.contains(location)) return QByteArray();
|
|
|
return QByteArray(qPrintable(d->UrlToFpDescription[location].d->xmlDescription()));
|
|
return QByteArray(qPrintable(d->UrlToFpDescription[location].d->xmlDescription()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
ctkCmdLineModuleFuture ctkCmdLineModuleBackendFunctionPointer::run(ctkCmdLineModuleFrontend *frontend)
|
|
ctkCmdLineModuleFuture ctkCmdLineModuleBackendFunctionPointer::run(ctkCmdLineModuleFrontend *frontend)
|
|
|
{
|
|
{
|
|
|
QUrl url = frontend->location();
|
|
QUrl url = frontend->location();
|
|
@@ -198,11 +223,13 @@ ctkCmdLineModuleFuture ctkCmdLineModuleBackendFunctionPointer::run(ctkCmdLineMod
|
|
|
return fpTask->start();
|
|
return fpTask->start();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
QList<QUrl> ctkCmdLineModuleBackendFunctionPointer::registeredFunctionPointers() const
|
|
QList<QUrl> ctkCmdLineModuleBackendFunctionPointer::registeredFunctionPointers() const
|
|
|
{
|
|
{
|
|
|
return d->UrlToFpDescription.keys();
|
|
return d->UrlToFpDescription.keys();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+//----------------------------------------------------------------------------
|
|
|
ctkCmdLineModuleBackendFunctionPointer::Description*
|
|
ctkCmdLineModuleBackendFunctionPointer::Description*
|
|
|
ctkCmdLineModuleBackendFunctionPointer::registerFunctionPointerProxy(const QString& title,
|
|
ctkCmdLineModuleBackendFunctionPointer::registerFunctionPointerProxy(const QString& title,
|
|
|
const ctk::CmdLineModuleBackendFunctionPointer::FunctionPointerProxy& proxy,
|
|
const ctk::CmdLineModuleBackendFunctionPointer::FunctionPointerProxy& proxy,
|