22 #ifndef CTKCMDLINEMODULEBACKENDFUNCTIONPOINTER_H
23 #define CTKCMDLINEMODULEBACKENDFUNCTIONPOINTER_H
27 #include "ctkCommandLineModulesBackendFunctionPointerExport.h"
29 #include "ctkCmdLineModuleBackendFPUtil_p.h"
31 #include <QScopedPointer>
32 #include <QSharedPointer>
41 namespace CmdLineModuleBackendFunctionPointer {
43 struct FunctionPointerProxy;
51 template<
typename T,
typename Enable =
void>
54 static QString
parameter(
int index,
const QString& typeName,
const QString& label = QString(),
const QString& description = QString())
57 QTextStream str(&xmlParameter);
58 str <<
" <" << typeName <<
">\n";
59 str <<
" <name>" << QString(
"param%1").arg(index) <<
"</name>\n";
60 str <<
" <index>" << index <<
"</index>\n";
61 str <<
" <description>" << (description.isEmpty() ?
"Description not available." : description) <<
"</description>\n";
62 str <<
" <label>" << (label.isEmpty() ? QString(
"Parameter %1").arg(index) : label) <<
"</label>\n";
63 str <<
" </" << typeName <<
">\n";
72 static QString
parameter(
int index,
const QString& typeName,
const QString& label = QString(),
const QString& description = QString())
75 QTextStream str(&xmlParameter);
76 str <<
" <" << typeName <<
">\n";
77 str <<
" <name>" << QString(
"param%1").arg(index) <<
"</name>\n";
78 str <<
" <index>" << index <<
"</index>\n";
79 str <<
" <description>" << (description.isEmpty() ?
"Description not available." : description) <<
"</description>\n";
80 str <<
" <label>" << (label.isEmpty() ? QString(
"Parameter %1").arg(index) : label) <<
"</label>\n";
81 str <<
" <channel>input</channel>\n";
82 str <<
" </" << typeName <<
">\n";
92 struct ctkCmdLineModuleBackendFunctionPointerPrivate;
107 class DescriptionPrivate;
136 friend class ctkCmdLineModuleFunctionPointerTask;
137 Description(
const QUrl& location,
const ctk::CmdLineModuleBackendFunctionPointer::FunctionPointerProxy& fpProxy);
139 QSharedPointer<DescriptionPrivate> d;
159 const QString& paramLabel = QString(),
const QString& paramDescr = QString())
164 params << ctk::CmdLineModuleBackendFunctionPointer::CreateXmlFor<RawTypeA>::
166 ctk::CmdLineModuleBackendFunctionPointer::GetParameterTypeName<RawTypeA>(),
167 paramLabel, paramDescr);
168 return this->registerFunctionPointerProxy(title, ctk::CmdLineModuleBackendFunctionPointer::FunctionPointerProxy(fp), params);
171 template<
typename A,
typename B>
173 const QString& paramLabel0 = QString(),
const QString& paramDescr0 = QString(),
174 const QString& paramLabel1 = QString(),
const QString& paramDescr1 = QString())
180 params << ctk::CmdLineModuleBackendFunctionPointer::CreateXmlFor<RawTypeA>::
182 ctk::CmdLineModuleBackendFunctionPointer::GetParameterTypeName<RawTypeA>(),
183 paramLabel0, paramDescr0);
184 params << ctk::CmdLineModuleBackendFunctionPointer::CreateXmlFor<RawTypeB>::
186 ctk::CmdLineModuleBackendFunctionPointer::GetParameterTypeName<RawTypeB>(),
187 paramLabel1, paramDescr1);
188 return this->registerFunctionPointerProxy(title, ctk::CmdLineModuleBackendFunctionPointer::FunctionPointerProxy(fp), params);
199 Description* registerFunctionPointerProxy(
const QString &title,
200 const ctk::CmdLineModuleBackendFunctionPointer::FunctionPointerProxy& proxy,
204 QScopedPointer<ctkCmdLineModuleBackendFunctionPointerPrivate> d;
209 #endif // CTKCMDLINEMODULEBACKENDFUNCTIONPOINTER_H