itom  4.1.0
addInManager.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2020, Institut fuer Technische Optik (ITO),
5  Universitaet Stuttgart, Germany
6 
7  This file is part of itom.
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  itom is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17  General Public Licence for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with itom. If not, see <http://www.gnu.org/licenses/>.
21 *********************************************************************** */
22 
23 #ifndef ADDINMANAGER_H
24 #define ADDINMANAGER_H
25 
26 #include "addInMgrDefines.h"
27 
28 #include "../common/addInInterface.h"
29 #include "../DataObject/dataobj.h"
30 #ifdef USEPCL
31 #define ITOM_POINTCLOUDLIBRARY 1
32 #else
33 #define ITOM_POINTCLOUDLIBRARY 0
34 #endif
35 #if ITOM_POINTCLOUDLIBRARY > 0
36  #include "../PointCloud/pclStructures.h"
37 #endif
38 
39 #include <qobject.h>
40 #include <qscopedpointer.h>
41 
42 //#include "algoInterfaceValidator.h"
43 
44 
45 
46 #if !defined(Q_MOC_RUN) || defined(ADDINMGR_DLL) //only moc this file in itomCommonQtLib but not in other libraries or executables linking against this itomCommonQtLib
47 
48 namespace ito
49 {
50  // forward declaration for private AddInManager functions, declared and implemented
51  // in addInManagerPrivate.cpp
52  class AddInManagerPrivate;
53 
54  class PlugInModel; //forward declaration
55  class AlgoInterfaceValidator; //forward declaration
56 
66  class ADDINMGR_EXPORT AddInManager : public QObject
67  {
68  Q_OBJECT
69 
70  public:
72  static AddInManager* createInstance(QString itomSettingsFile, void **apiFuncsGraph, QObject *mainWindow = NULL, QObject *mainApplication = NULL);
73 
75  static RetVal closeInstance();
76 
78  static AddInManager* instance() { return staticInstance; }
79 
83  const RetVal scanAddInDir(const QString &path, const int checkQCoreApp = 1);
84 
86  const QList<QObject *> * getDataIOList(void) const;
87 
89  const QList<QObject *> * getActList(void) const;
90 
92  const QList<QObject *> * getAlgList(void) const;
93 
95  const QHash<QString, ito::AddInAlgo::FilterDef *> * getFilterList(void) const;
96 
98  const QHash<QString, ito::AddInAlgo::AlgoWidgetDef *> * getAlgoWidgetList(void) const;
99 
101  const ito::FilterParams* getHashedFilterParams(ito::AddInAlgo::t_filterParam filterParam) const;
102 
104  const QList<struct PluginLoadStatus> getPluginLoadStatus() const;
105 
107  const AlgoInterfaceValidator * getAlgoInterfaceValidator(void) const;
108 
110  const ito::AddInAlgo::AlgoWidgetDef * getAlgoWidgetDef( QString algoWidgetName, QString algoPluginName = QString() );
111 
113  PlugInModel * getPluginModel(void);
114 
116  const RetVal reloadAddIn(const QString &name);
117 
119  int getTotalNumAddIns(void) const;
120 
122  void * getAddInPtr(const int itemNum);
123 
125  int getItemIndexInList(const void *item);
126 
128  void updateModel(void);
129 
131  const RetVal getInitParams(const QString &name, const int pluginType, int *pluginNum, QVector<ito::Param> *&paramsMand, QVector<ito::Param> *&paramsOpt);
132 
134  const RetVal getAboutInfo(const QString &name, QString &versionString);
135 
137  const RetVal getPluginInfo(const QString &name, int &pluginType, int &pluginNum, int &version, QString &typeString, QString &author, QString &description, QString &detaildescription, QString &license, QString &about);
138 
140  const RetVal incRef(ito::AddInBase *plugin);
141 
143  const RetVal decRef(ito::AddInBase **plugin);
144 
146  const RetVal setTimeOuts(const int initClose, const int general);
147 
149  const RetVal setMainWindow(QObject *mainWindow);
150 
152  bool isPluginInstanceDead(const ito::AddInBase *plugin) const;
153 
155  const QList<ito::AddInAlgo::FilterDef *> getFilterByInterface(ito::AddInAlgo::tAlgoInterface iface, const QString tag = QString::Null()) const;
156 
158  const QList<ito::AddInAlgo::FilterDef *> getFiltersByCategory(ito::AddInAlgo::tAlgoCategory cat) const;
159 
161  const QList<ito::AddInAlgo::FilterDef *> getFilterByInterfaceAndCategory(ito::AddInAlgo::tAlgoInterface iface, ito::AddInAlgo::tAlgoCategory cat, const QString tag = QString::Null()) const;
162 
164  void **getItomApiFuncsPtr(void);
165 
166  private:
168  AddInManager(QString itomSettingsFile, void **apiFuncsGraph, QObject *mainWindow = NULL, QObject *mainApplication = NULL);
169 
170  ~AddInManager(void);
171 
172  static AddInManager *staticInstance;
173  QScopedPointer<AddInManagerPrivate> d_ptr;
174  Q_DECLARE_PRIVATE(AddInManager);
175  Q_DISABLE_COPY(AddInManager);
176 
177  signals:
179  void splashLoadMessage(const QString &message);
180 
181  public slots:
183  ito::RetVal showConfigDialog(ito::AddInBase *addin, ItomSharedSemaphore *waitCond = NULL);
184 
186  ito::RetVal showDockWidget(ito::AddInBase *addin, int visible, ItomSharedSemaphore *waitCond = NULL);
187 
189  ito::RetVal initAddIn(const int pluginNum, const QString &name, ito::AddInDataIO **addIn, QVector<ito::ParamBase> *paramsMand, QVector<ito::ParamBase> *paramsOpt, bool autoLoadPluginParams, ItomSharedSemaphore *aimWait = NULL);
190 
192  ito::RetVal initAddIn(const int pluginNum, const QString &name, ito::AddInActuator **addIn, QVector<ito::ParamBase> *paramsMand, QVector<ito::ParamBase> *paramsOpt, bool autoLoadPluginParams, ItomSharedSemaphore *aimWait = NULL);
193 
195  ito::RetVal initAddIn(const int pluginNum, const QString &name, ito::AddInAlgo **addIn, QVector<ito::ParamBase> *paramsMand, QVector<ito::ParamBase> *paramsOpt, bool autoLoadPluginParams, ItomSharedSemaphore *aimWait = NULL);
196 
198  ito::RetVal closeAddIn(ito::AddInBase *addIn, ItomSharedSemaphore *aimWait = NULL);
199 
201  ito::RetVal interruptAllActuatorInstances(ItomSharedSemaphore *aimWait = NULL);
202  };
203 } //namespace ito
204 #endif // #if !defined(Q_MOC_RUN) || defined(ADDINMGR_DLL)
205 #endif // #if ADDINMANAGER_H
container for publishing widgets provided by any plugin
Definition: addInInterface.h:1045
The class AlgoInterfaceValidator provides validators and checks in order to verify that a certain fil...
Definition: algoInterfaceValidator.h:37
base class for all actuator plugin classes
Definition: addInInterface.h:738
class for visualizing the available (loaded) plugins
Definition: pluginModel.h:78
Class for managing status values (like errors or warning)
Definition: retVal.h:54
base class for all dataIO plugin classes
Definition: addInInterface.h:661
Base class for all plugins.
Definition: addInInterface.h:385
class for AddIn management
Definition: addInManager.h:66
base class for all "algorithm" plugin classes
Definition: addInInterface.h:929
ito::RetVal(* t_filterParam)(QVector< ito::Param > *paramsMand, QVector< ito::Param > *paramsOpt, QVector< ito::Param > *paramsOut)
possible categories for filter or widget-methods
Definition: addInInterface.h:943
QScopedPointer< AddInManagerPrivate > d_ptr
static instance pointer
Definition: addInManager.h:173
Definition: apiFunctionsGraph.cpp:39
semaphore which can be used for asychronous thread communication. By using this class it is possible ...
Definition: sharedStructuresQt.h:57
tAlgoCategory
Definition: addInInterface.h:946
tAlgoInterface
Definition: addInInterface.h:955
static AddInManager * instance()
returns the instantiated singleton class or NULL if it has not been loaded, yet
Definition: addInManager.h:78
Definition: addInInterface.h:209