itom
Loading...
Searching...
No Matches
addInManagerPrivate.h
1/* ********************************************************************
2itom software
3URL: http://www.uni-stuttgart.de/ito
4Copyright (C) 2020, Institut für Technische Optik (ITO),
5Universität Stuttgart, Germany
6
7This file is part of itom.
8
9itom is free software; you can redistribute it and/or modify it
10under the terms of the GNU Library General Public Licence as published by
11the Free Software Foundation; either version 2 of the Licence, or (at
12your option) any later version.
13
14itom is distributed in the hope that it will be useful, but
15WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17General Public Licence for more details.
18
19You should have received a copy of the GNU Library General Public License
20along with itom. If not, see <http://www.gnu.org/licenses/>.
21*********************************************************************** */
22
23#ifndef ADDINMANAGERIMPL_H
24#define ADDINMANAGERIMPL_H
25
26#include "algoInterfaceValidator.h"
27#include "../common/sharedFunctionsQt.h"
28#include "../common/addInInterface.h"
29#include "pluginModel.h"
30
31#include <qobject.h>
32#include <qtimer.h>
33#include <qlist.h>
34#include <qhash.h>
35#include <qstring.h>
36#include <qglobal.h>
37#include <qfileinfo.h>
38#include <qsettings.h>
39#include <QDir>
40#include <QDirIterator>
41#include <QTranslator>
42#include <qmainwindow.h>
43#include <qpair.h>
44#include <qpointer.h>
45#include <qsharedpointer.h>
46
47
48namespace ito
49{
50
51class AddInManager;
52
53class AddInManagerPrivate : public QObject
54{
55 Q_OBJECT
56
57 Q_DECLARE_PUBLIC(AddInManager);
58 public:
61
62 // two helper methods for Qt < 5.12. They can be removed once the minimum Qt version is 5.12.
63 static QString regExpAnchoredPattern(const QString& expression);
64 static QString wildcardToRegularExpression(const QString &pattern);
65
66 protected:
67 AddInManager* const q_ptr;
68
69 private:
70 QVector<QTranslator*> m_Translator;
71
72 QList<QObject *> m_addInListDataIO;
73 QList<QObject *> m_addInListAct;
74 QList<QObject *> m_addInListAlgo;
75 QHash<QString, ito::AddInAlgo::FilterDef *> m_filterList;
76 QMultiHash<QString, ito::AddInAlgo::FilterDef *> m_filterListInterfaceTag; //hash value is "{interface-number}_{tag}"
77 QHash<QString, ito::AddInAlgo::AlgoWidgetDef *> m_algoWidgetList;
78 QHash<void*, ito::FilterParams *> filterParamHash;
79 QList<PluginLoadStatus> m_pluginLoadStatus;
80 QObject *m_pMainWindow;
81 QObject *m_pMainApplication;
82
83 AlgoInterfaceValidator *m_algoInterfaceValidator;
84 PlugInModel *m_plugInModel;
85
86 QCoreApplication *m_pQCoreApp;
87 QList< QPointer<ito::AddInBase> > m_deadPlugins;
88 QTimer m_deadPluginTimer;
89 int m_timeOutInitClose;
90 int m_timeOutGeneral;
91
92 int getItemNum(const void *item);
93 int getPluginNum(const QString &name, ito::AddInInterfaceBase *&addIn);
94 const RetVal saveParamVals(ito::AddInBase *plugin);
95 const RetVal loadParamVals(ito::AddInBase *plugin);
96 void incRefParamPlugins(ito::AddInBase *ai, QVector<ito::ParamBase> *paramsMand, QVector<ito::ParamBase> *paramsOpt);
98 const RetVal decRef(ito::AddInBase **plugin);
99 const RetVal closeAddIn(AddInBase *addIn, ItomSharedSemaphore *aimWait = NULL);
100
101 template<typename _Tp> const RetVal initAddInActuatorOrDataIO(
102 bool actuatorNotDataIO,
103 const int pluginNum, const QString &name,
104 _Tp** addIn, QVector<ito::ParamBase> *paramsMand,
105 QVector<ito::ParamBase> *paramsOpt, bool autoLoadPluginParams,
106 ItomSharedSemaphore *aimWait = NULL);
107
108 const RetVal initAddInAlgo(
109 const int pluginNum, const QString &name, ito::AddInAlgo **addIn,
110 QVector<ito::ParamBase> * paramsMand, QVector<ito::ParamBase> * paramsOpt,
111 bool autoLoadPluginParams, ItomSharedSemaphore *aimWait = NULL);
112
113 protected:
114 void setItomProperties(void *propPtr) {};
116 RetVal loadAddIn(QString &filename);
117
118 RetVal loadAddInDataIO(QObject *plugin, ito::PluginLoadStatus &pluginLoadStatus);
119 RetVal loadAddInActuator(QObject *plugin, ito::PluginLoadStatus &pluginLoadStatus);
120 RetVal loadAddInAlgo(QObject *plugin, ito::PluginLoadStatus &pluginLoadStatus);
121
123
124 private slots:
126 void propertiesChanged();
127};
128
129} //end namespace ito
130
131
132
133#endif // ADDINMANAGERIMPL_H
semaphore which can be used for asynchronous thread communication. By using this class it is possible...
Definition sharedStructuresQt.h:58
base class for all "algorithm" plugin classes
Definition addInInterface.h:930
Base class for all plugins.
Definition addInInterface.h:386
forward declaration to private container class of AddInAlog
Definition addInInterface.h:249
class for AddIn management
Definition addInManager.h:67
Definition addInManagerPrivate.h:54
RetVal initDockWidget(const ito::AddInBase *addIn)
Definition addInManagerPrivate.cpp:1370
ito::RetVal decRefParamPlugins(ito::AddInBase *ai)
Definition addInManagerPrivate.cpp:63
RetVal closeDeadPlugins()
Definition addInManagerPrivate.cpp:221
const RetVal saveParamVals(ito::AddInBase *plugin)
Definition addInManagerPrivate.cpp:1215
RetVal registerPluginAsDeadPlugin(ito::AddInBase *addIn)
Definition addInManagerPrivate.cpp:266
RetVal loadAddIn(QString &filename)
Definition addInManagerPrivate.cpp:284
const RetVal initAddInAlgo(const int pluginNum, const QString &name, ito::AddInAlgo **addIn, QVector< ito::ParamBase > *paramsMand, QVector< ito::ParamBase > *paramsOpt, bool autoLoadPluginParams, ItomSharedSemaphore *aimWait=NULL)
Definition addInManagerPrivate.cpp:796
const RetVal closeAddIn(AddInBase *addIn, ItomSharedSemaphore *aimWait=NULL)
Definition addInManagerPrivate.cpp:1054
void incRefParamPlugins(ito::AddInBase *ai, QVector< ito::ParamBase > *paramsMand, QVector< ito::ParamBase > *paramsOpt)
Definition addInManagerPrivate.cpp:100
RetVal loadAddInDataIO(QObject *plugin, ito::PluginLoadStatus &pluginLoadStatus)
Definition addInManagerPrivate.cpp:540
RetVal loadAddInAlgo(QObject *plugin, ito::PluginLoadStatus &pluginLoadStatus)
Definition addInManagerPrivate.cpp:582
const RetVal loadParamVals(ito::AddInBase *plugin)
Definition addInManagerPrivate.cpp:1270
RetVal loadAddInActuator(QObject *plugin, ito::PluginLoadStatus &pluginLoadStatus)
Definition addInManagerPrivate.cpp:561
const RetVal decRef(ito::AddInBase **plugin)
Definition addInManagerPrivate.cpp:1190
The class AlgoInterfaceValidator provides validators and checks in order to verify that a certain fil...
Definition algoInterfaceValidator.h:38
class for visualizing the available (loaded) plugins
Definition pluginModel.h:78
Class for managing status values (like errors or warning)
Definition retVal.h:54
Definition apiFunctionsGraph.cpp:40
This struct provides a structure for saving the load status of any plugins or designerWidgets.
Definition pluginModel.h:61