itom  4.1.0
addInInterface.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 and its software development toolkit (SDK).
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 In addition, as a special exception, the Institut fuer Technische
15 Optik (ITO) gives you certain additional rights.
16 These rights are described in the ITO LGPL Exception version 1.0,
17 which can be found in the file LGPL_EXCEPTION.txt in this package.
18 
19 itom is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
22 General Public Licence for more details.
23 
24 You should have received a copy of the GNU Library General Public License
25 along with itom. If not, see <http://www.gnu.org/licenses/>.
26 *********************************************************************** */
27 
28 #ifndef ADDININTERFACE_H
29 #define ADDININTERFACE_H
30 
31 #include "commonGlobal.h"
32 
33 #include "apiFunctionsInc.h"
34 #include "apiFunctionsGraphInc.h"
35 
36 #include "addInInterfaceVersion.h"
37 #include "sharedStructuresQt.h"
38 #include "sharedStructures.h"
39 #include "functionCancellationAndObserver.h"
40 
41 #include <qlist.h>
42 #include <qmap.h>
43 #include <qpair.h>
44 #include <qset.h>
45 #include <qthread.h>
46 #include <qsharedpointer.h>
47 #include <qmutex.h>
48 #include <qapplication.h>
49 #include <qscopedpointer.h>
50 #include <QtWidgets/qdockwidget.h>
51 
52 //plugins define VISUAL_LEAK_DETECTOR_CMAKE in their CMake configuration file
53 #if defined _DEBUG && defined(_MSC_VER) && defined(VISUAL_LEAK_DETECTOR_CMAKE)
54 #ifndef NOMINAX
55 #define NOMINMAX //instead min, max is defined as macro in winDef.h, included by vld.h
56 #include "vld.h"
57 #undef NOMINMAX
58 #else
59 #include "vld.h"
60 #endif
61 #endif
62 
63 #if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC) //only moc this file in itomCommonQtLib but not in other libraries or executables linking against this itomCommonQtLib
64 
66 
70 #define NEW_PLUGININSTANCE(PluginClass) \
71  PluginClass* newInst = new PluginClass(); \
72  newInst->setBasePlugin(this); \
73  *addInInst = qobject_cast<ito::AddInBase*>(newInst); \
74  m_InstList.append(*addInInst);
75 
77 
82 #define REMOVE_PLUGININSTANCE(PluginClass) \
83  if (*addInInst) \
84  { \
85  (*addInInst)->deleteLater(); \
86  m_InstList.removeOne(*addInInst); \
87  }
88 
90 
94 #define REGISTER_FILTERS_AND_WIDGETS \
95  foreach(ito::AddInAlgo::FilterDef *f, newInst->m_filterList) \
96  { \
97  f->m_pBasePlugin = this; \
98  } \
99  foreach(ito::AddInAlgo::AlgoWidgetDef *w, newInst->m_algoWidgetList) \
100  { \
101  w->m_pBasePlugin = this; \
102  }
103 
104 //write this macro right after Q_INTERFACE(...) in your interface class definition
105 #define PLUGIN_ITOM_API \
106  protected: \
107  void importItomApi(void** apiPtr) \
108  {ito::ITOM_API_FUNCS = apiPtr;} \
109  void importItomApiGraph(void** apiPtr) \
110  { ito::ITOM_API_FUNCS_GRAPH = apiPtr;} \
111  public: \
112  virtual int getAddInInterfaceVersion() const \
113  { return ITOM_ADDININTERFACE_VERSION; } \
114  //.
115 
116 QT_BEGIN_NAMESPACE
117 class QPluginLoader;
118 QT_END_NAMESPACE
119 
120 namespace ito
121 {
122  //----------------------------------------------------------------------------------------------------------------------------------
124 
129  {
130  typeDataIO = 0x1,
131  typeActuator = 0x2,
132  typeAlgo = 0x4,
133  typeGrabber = 0x80,
134  typeADDA = 0x100,
135  typeRawIO = 0x200
136  };
137 
139 
149  {
150  //moving flags
151  actuatorUnknown = 0x0001,
153  actuatorMoving = 0x0004,
154  actuatorAtTarget = 0x0008,
155  actuatorTimeout = 0x0010,
156  //switches
157  actuatorEndSwitch = 0x0100,
162  actuatorRefSwitch = 0x0800,
168  //status flags
169  actuatorAvailable = 0x4000,
170  actuatorEnabled = 0x8000,
171  actuatorError = 0x10000,/*axis has encountered error/reports error*/
172 
185  };
186 
188  {
192  };
193 
195  {
198  };
199 
201  {
202  ExecFuncParams() : infoString("") {}
203  QVector<Param> paramsMand;
204  QVector<Param> paramsOpt;
205  QVector<Param> paramsOut;
206  QString infoString;
207  };
208 
209  struct FilterParams
210  {
211  QVector<Param> paramsMand;
212  QVector<Param> paramsOpt;
213  QVector<Param> paramsOut;
214  };
215 
216  class AddInBase;
217  class DataObject;
218  class AddInBasePrivate;
220  class AddInActuatorPrivate;
221  class AddInDataIOPrivate;
222  class AddInAlgoPrivate;
223 
224  //----------------------------------------------------------------------------------------------------------------------------------
248  class ITOMCOMMONQT_EXPORT AddInInterfaceBase : public QObject
249  {
250  Q_OBJECT
251 
252  private:
254  virtual ito::RetVal closeThisInst(ito::AddInBase **addInInst) = 0;
255 
256  QScopedPointer<AddInInterfaceBasePrivate> d_ptr;
257  Q_DECLARE_PRIVATE(AddInInterfaceBase);
258 
259  protected:
260  int m_type;
261  int m_version;
262  QString m_filename;
265  QString m_author;
266  QString m_description;
268  QString m_license;
269  QString m_aboutThis;
270  QList<ito::AddInBase *> m_InstList;
271  QVector<ito::Param> m_initParamsMand;
272  QVector<ito::Param> m_initParamsOpt;
278  virtual void importItomApi(void** apiPtr) = 0; //this methods are implemented in the plugin itsself. Therefore place ITOM_API right after Q_INTERFACE in the header file and replace Q_EXPORT_PLUGIN2 by Q_EXPORT_PLUGIN2_ITOM in the source file.
279  virtual void importItomApiGraph(void** apiPtr) = 0;
280 
282  inline bool hasGuiSupport()
283  {
284  if (qobject_cast<QApplication*>(QCoreApplication::instance()))
285  {
286  return true;
287  }
288  else
289  {
290  return false;
291  }
292  }
293 
294  public:
295  void **m_apiFunctionsBasePtr;
296  void **m_apiFunctionsGraphBasePtr;
297 
299  virtual ~AddInInterfaceBase();
300 
303 
305  /* This method is automatically implemented by the PLUGIN_ITOM_API macro.
306  The definition is 0xAABBCC where AA is the major, BB the minor and CC the patch.
307  */
308  virtual int getAddInInterfaceVersion() const = 0;
309 
311  inline int getType(void) const { return m_type; }
313  inline int getVersion(void) const { return m_version; }
315  inline int getMinItomVer(void) const { return m_minItomVer; }
317  inline int getMaxItomVer(void) const { return m_maxItomVer; }
318 
320  inline bool getCallInitInNewThread(void) const { return m_callInitInNewThread; }
321 
323  inline tAutoLoadPolicy getAutoLoadPolicy(void) const { return m_autoLoadPolicy; }
324 
326  inline tAutoSavePolicy getAutoSavePolicy(void) const { return m_autoSavePolicy; }
327 
329  const QString getAuthor(void) const { return m_author; }
331  const QString getDescription(void) const { return m_description; }
333  const QString getDetailDescription(void) const { return m_detaildescription; }
335  const QString getLicenseInfo(void) const { return m_license; }
337  const QString getAboutInfo(void) const { return m_aboutThis; }
339  const QString getFilename(void) const { return m_filename; }
340 
341  const ito::RetVal setFilename(const QString &name) { m_filename = name; return ito::retOk; }
343  inline QList<ito::AddInBase *> getInstList(void) { return m_InstList; }
344  inline const QList<ito::AddInBase *> getInstList(void) const { return m_InstList; }
346  ito::RetVal closeInst(ito::AddInBase **addInInst);
348  virtual QVector<ito::Param>* getInitParamsMand(void) { return &m_initParamsMand; }
350  virtual QVector<ito::Param>* getInitParamsOpt(void) { return &m_initParamsOpt; }
352  virtual ito::RetVal getAddInInst(ito::AddInBase **addInInst) = 0;
354  void incRef(ito::AddInBase *addIn);
356  void decRef(ito::AddInBase *addIn);
358  int getRef(ito::AddInBase *addIn);
360  int getInstCount() { return m_InstList.length(); }
362  void setApiFunctions(void **apiFunctions);
363  void setApiFunctionsGraph(void ** apiFunctionsGraph);
364 
365  void setLoader(QPluginLoader *loader);
366  QPluginLoader * getLoader(void) const;
367 
368  bool event(QEvent *e);
369  };
370 
371  //----------------------------------------------------------------------------------------------------------------------------------
385  class ITOMCOMMONQT_EXPORT AddInBase : public QObject
386  {
387  Q_OBJECT
388 
389  public:
390 
391  struct AddInRef {
392  AddInRef() : type(-1), ptr(0) {}
393  AddInRef(void *p, int t) : type(t), ptr(p) {}
394  int type;
395  void *ptr;
396  };
397 
399  const Param getParamRec(const QString name, bool *nameCheckOk = NULL) const;
400 
402  AddInInterfaceBase* getBasePlugin(void) const;
403 
405  ito::RetVal MoveToThread(void);
406 
408  /*
409  Use the method setParam in order to change any parameter.
410 
411  \param paramNames [out]. The pointer contains a pointer to the map after the call of this function
412  \return RetVal returns retOk.
413  */
414  inline const ito::RetVal getParamList(QMap<QString, Param> **paramNames) { *paramNames = &m_params; return ito::retOk; }
415 
417  /*
418  \param [out] funcs is the pointer to a map, that points to the internal map of additional functions after the method-call.
419  \return retOk
420  \sa registerExecFunc
421  */
422  inline const ito::RetVal getExecFuncList(QMap<QString, ExecFuncParams> **funcs) { *funcs = &m_execFuncList; return ito::retOk; }
423 
425  int getID() const;
426 
428  inline QString getIdentifier() const { return m_identifier; }
429 
431  virtual int hasConfDialog(void);
432 
434  virtual const ito::RetVal showConfDialog(void);
435 
437  int createdByGUI() const;
438 
440  void setCreatedByGUI(int value);
441 
443  /*
444  The reference counter is zero-based, hence, the value zero means that one reference is pointing to this instance
445  */
446  int getRefCount(void) const;
447 
449  /*
450  \sa getDockWidget
451  */
452  bool hasDockWidget(void) const;
453 
455  /*
456  \sa hasDockWidget
457  */
458  QDockWidget* getDockWidget(void) const;
459 
460  // doc in source
461  virtual void dockWidgetDefaultStyle(bool &floating, bool &visible, Qt::DockWidgetArea &defaultArea) const;
462 
464  /*
465  Any time-consuming operation of the plugin should regularly set the alive-flag to true
466  by calling setAlive. The state of this flag is returned by this method and afterwards
467  reset to 0. This method is thread-safe.
468 
469  \return current status of alive-flag (1 if "still alive", else 0)
470  \sa setAlive
471  */
472  int isAlive(void);
473 
475  /*
476  This method is thread-safe.
477 
478  \sa isAlive
479  */
480  void setAlive(void);
481 
483  bool isInitialized(void) const;
484 
486  /*
487  \param [in] initialized is the value to set
488  */
489  void setInitialized(bool initialized);
490 
492  /*
493  This vector contains all plugin-instances, that have been passed to the init
494  method of this plugin. The reference counter of these plugin is incremented at
495  initialization of this plugin and decremented if this plugin will be destroyed.
496 
497  \sa AddInRef, init
498  */
499  QVector<ito::AddInBase::AddInRef *> * getArgAddIns(void) { return &m_hwDecList; }
500 
502  /* This mutex has no designed task in the plugin, however it can be used by
503  the user to for instance protect a sequence of different calls to this plugin.
504 
505  This can be important, if the plugin is for instance a communication object,
506  that is used by different other hardware instances (e.g. a SerialIO to
507  an arduino, that controls different motors, sensors etc.). Then, it might
508  be important, that every hardware plugin object, that uses the serialIO
509  plugin, can protect a setVal / getVal sequence without that any other
510  plugin instance interrupts its. However, it is the task of the user to
511  implement that protection. This mutex can only help for this.
512  */
513  QMutex& getUserMutex();
514 
515  static int getMaximumThreadCount();
516 
517  static RetVal setMaximumThreadCount(int threadCount);
518 
519  protected:
520  // constructor (doc in source)
521  AddInBase();
522 
523  // destructor (doc in source)
524  virtual ~AddInBase();
525 
527  void setIdentifier(const QString &identifier);
528 
529  //doc in source
530  void createDockWidget(QString title, QDockWidget::DockWidgetFeatures features, Qt::DockWidgetAreas allowedAreas = Qt::AllDockWidgetAreas, QWidget *content = NULL);
531 
532  // doc in source
533  ito::RetVal registerExecFunc(const QString funcName, const QVector<ito::Param> &paramsMand, const QVector<ito::Param> &paramsOpt, const QVector<ito::Param> &paramsOut, const QString infoString);
534 
536  void setBasePlugin(AddInInterfaceBase *base);
537 
538  QMap<QString, Param> m_params;
539 
540  QString m_identifier;
541 
543  inline bool hasGuiSupport()
544  {
545  if (qobject_cast<QApplication*>(QCoreApplication::instance()))
546  {
547  return true;
548  }
549  else
550  {
551  return false;
552  }
553  }
554 
555  private:
556  Q_DISABLE_COPY(AddInBase)
557 
558 
559  void incRefCount(void);
560 
562  void decRefCount(void);
563 
564  QVector<ito::AddInBase::AddInRef *> m_hwDecList;
565  QMap<QString, ExecFuncParams> m_execFuncList;
566 
567  QScopedPointer<AddInBasePrivate> d_ptr;
568  Q_DECLARE_PRIVATE(AddInBase);
569 
570  friend class AddInInterfaceBase;
571 
572  static int m_instCounter;
573  static int maxThreadCount;
574 
575  Q_SIGNALS:
577 
585  void parametersChanged(QMap<QString, ito::Param> params);
586 
587  public Q_SLOTS:
589  virtual ito::RetVal init(QVector<ito::ParamBase> *paramsMand, QVector<ito::ParamBase> *paramsOpt, ItomSharedSemaphore *waitCond = NULL) = 0;
591  virtual ito::RetVal close(ItomSharedSemaphore *waitCond) = 0;
592 
594  virtual ito::RetVal getParam(QSharedPointer<ito::Param> val, ItomSharedSemaphore *waitCond = NULL) = 0;
596  virtual ito::RetVal setParam(QSharedPointer<ito::ParamBase> val, ItomSharedSemaphore *waitCond = NULL) = 0;
597 
599  ito::RetVal setParamVector(const QVector<QSharedPointer<ito::ParamBase> > values, ItomSharedSemaphore *waitCond = NULL);
600 
602  ito::RetVal getParamVector(const QVector<QSharedPointer<ito::Param> > values, ItomSharedSemaphore *waitCond = NULL);
603 
605  virtual ito::RetVal execFunc(const QString funcName, QSharedPointer<QVector<ito::ParamBase> > paramsMand, QSharedPointer<QVector<ito::ParamBase> > paramsOpt, QSharedPointer<QVector<ito::ParamBase> > paramsOut, ItomSharedSemaphore *waitCond = NULL);
606 
608  ito::RetVal moveBackToApplicationThread(ItomSharedSemaphore *waitCond = NULL);
609 
611 
618  void sendParameterRequest(){ emit parametersChanged(m_params); };
619 
620  private Q_SLOTS:
621 
623 
631  virtual void dockWidgetVisibilityChanged(bool /*visible*/) {};
632  };
633 
634  //----------------------------------------------------------------------------------------------------------------------------------
661  class ITOMCOMMONQT_EXPORT AddInDataIO : public AddInBase
662  {
663  Q_OBJECT
664 
665  private:
666  Q_DISABLE_COPY(AddInDataIO)
667 
668  QScopedPointer<AddInDataIOPrivate> d_ptr;
669  Q_DECLARE_PRIVATE(AddInDataIO);
670 
671  protected:
672  virtual ~AddInDataIO();
673  AddInDataIO();
674 
675  void runStatusChanged(bool deviceStarted);
676 
677  //void timerEvent (QTimerEvent *event) = 0; //implement this event in your plugin, if you are a device, which is accessible by any liveImage!!!
678 
679  QSet<QObject*> m_autoGrabbingListeners;
680  int m_timerID;
684  public:
685  inline int getAutoGrabbing() { return m_autoGrabbingEnabled; }
687  Q_SIGNALS:
688 
689  public Q_SLOTS:
691  virtual ito::RetVal startDevice(ItomSharedSemaphore *waitCond);
692 
694  virtual ito::RetVal stopDevice(ItomSharedSemaphore *waitCond);
695 
697  virtual ito::RetVal acquire(const int trigger, ItomSharedSemaphore *waitCond = NULL);
698 
700  virtual ito::RetVal stop(ItomSharedSemaphore *waitCond = NULL);
701 
703  virtual ito::RetVal getVal(void* data, ItomSharedSemaphore *waitCond = NULL);
704 
706  virtual ito::RetVal getVal(QSharedPointer<char> data, QSharedPointer<int> length, ItomSharedSemaphore *waitCond = NULL);
707 
709  virtual ito::RetVal copyVal(void *dObj, ItomSharedSemaphore *waitCond);
710 
712  virtual ito::RetVal setVal(const char *data, const int length, ItomSharedSemaphore *waitCond = NULL);
713 
715  ito::RetVal enableAutoGrabbing(ItomSharedSemaphore *waitCond = NULL); //consider this method as final
716 
718  ito::RetVal disableAutoGrabbing(ItomSharedSemaphore *waitCond = NULL); //consider this method as final
719 
721  ito::RetVal setAutoGrabbingInterval(QSharedPointer<int> interval, ItomSharedSemaphore *waitCond = NULL); //consider this method as final
722 
724  ito::RetVal startDeviceAndRegisterListener(QObject* obj, ItomSharedSemaphore *waitCond = NULL); //consider this method as final
725 
727  ito::RetVal stopDeviceAndUnregisterListener(QObject* obj, ItomSharedSemaphore *waitCond = NULL); //consider this method as final
728  };
729 
730  //----------------------------------------------------------------------------------------------------------------------------------
731 
738  class ITOMCOMMONQT_EXPORT AddInActuator : public AddInBase
739  {
740  Q_OBJECT
741 
742  private:
743  Q_DISABLE_COPY(AddInActuator)
744 
745  QScopedPointer<AddInActuatorPrivate> d_ptr;
746  Q_DECLARE_PRIVATE(AddInActuator);
747 
748  protected:
749  virtual ~AddInActuator();
750  AddInActuator();
751 
752  QVector<int> m_currentStatus;
753  QVector<double> m_currentPos;
754  QVector<double> m_targetPos;
756  bool isMotorMoving() const;
758 
759  void sendStatusUpdate(const bool statusOnly = false); /* emits actuatorStatusChanged signal with the vector of currentStatus (and currentPos if statusOnly = false) to notify connected listeners about the current status (and position)*/
760  void sendTargetUpdate(); /* emits targetChanged with the vector of targetPositions to notify connected listeners about the change of the target position(s) */
761 
763 
767  virtual ito::RetVal waitForDone(const int timeoutMS = -1, const QVector<int> axis = QVector<int>() /*if empty -> all axis*/, const int flags = 0 /*for your use*/) = 0;
768 
770 
780  void setStatus(int &status, const int newFlags, const int keepMask = 0);
781 
783 
793  void setStatus(const QVector<int> &axis, const int newFlags, const int keepMask = 0);
794 
796 
805  void replaceStatus(int &status, const int existingFlag, const int replaceFlag);
806 
808 
818  void replaceStatus(const QVector<int> &axis, const int existingFlag, const int replaceFlag);
819 
821 
825  void initStatusAndPositions(int numAxes, int status, double currentPosition = 0.0, double targetPosition = 0.0, bool sendUpdateSignals = true);
826 
828 
834  bool isInterrupted();
835 
836  public:
838 
845  void setInterrupt();
846 
848 
853  void resetInterrupt();
854 
856 
864  ito::RetVal getLastSignalledStates(QVector<int> &status, QVector<double> &currentPos, QVector<double> &targetPos);
865 
866  Q_SIGNALS:
868 
877  void actuatorStatusChanged(QVector<int> status, QVector<double> actPosition);
878 
880 
888  void targetChanged(QVector<double> targetPositions);
889 
890  public Q_SLOTS:
892  virtual ito::RetVal calib(const int axis, ItomSharedSemaphore *waitCond = NULL) = 0;
894  virtual ito::RetVal calib(const QVector<int> axis, ItomSharedSemaphore *waitCond = NULL) = 0;
896  virtual ito::RetVal setOrigin(const int axis, ItomSharedSemaphore *waitCond = NULL) = 0;
898  virtual ito::RetVal setOrigin(const QVector<int> axis, ItomSharedSemaphore *waitCond = NULL) = 0;
900  virtual ito::RetVal getStatus(QSharedPointer<QVector<int> > status, ItomSharedSemaphore *waitCond) = 0;
902  virtual ito::RetVal getStatus(const int axis, QSharedPointer<int> status, ItomSharedSemaphore *waitCond);
904  virtual ito::RetVal getPos(const int axis, QSharedPointer<double> pos, ItomSharedSemaphore *waitCond) = 0;
906  virtual ito::RetVal getPos(const QVector<int> axis, QSharedPointer<QVector<double> > pos, ItomSharedSemaphore *waitCond) = 0;
908  virtual ito::RetVal setPosAbs(const int axis, const double pos, ItomSharedSemaphore *waitCond = NULL) = 0;
910  virtual ito::RetVal setPosAbs(const QVector<int> axis, QVector<double> pos, ItomSharedSemaphore *waitCond = NULL) = 0;
912  virtual ito::RetVal setPosRel(const int axis, const double pos, ItomSharedSemaphore *waitCond = NULL) = 0;
914  virtual ito::RetVal setPosRel(const QVector<int> axis, QVector<double> pos, ItomSharedSemaphore *waitCond = NULL) = 0;
915 
917  virtual ito::RetVal requestStatusAndPosition(bool sendCurrentPos, bool sendTargetPos);
918  };
919 
920  //----------------------------------------------------------------------------------------------------------------------------------
929  class ITOMCOMMONQT_EXPORT AddInAlgo : public AddInBase
930  {
931  Q_OBJECT
932 
933  private:
934  Q_DISABLE_COPY(AddInAlgo)
935 
936  QScopedPointer<AddInAlgoPrivate> d_ptr;
937  Q_DECLARE_PRIVATE(AddInAlgo);
938 
939  public:
940  typedef ito::RetVal (*t_filter) (QVector<ito::ParamBase> *paramsMand, QVector<ito::ParamBase> *paramsOpt, QVector<ito::ParamBase> *paramsOut);
941  typedef ito::RetVal (*t_filterExt) (QVector<ito::ParamBase> *paramsMand, QVector<ito::ParamBase> *paramsOpt, QVector<ito::ParamBase> *paramsOut, QSharedPointer<ito::FunctionCancellationAndObserver> observer);
942  typedef QWidget* (*t_algoWidget) (QVector<ito::ParamBase> *paramsMand, QVector<ito::ParamBase> *paramsOpt, ito::RetVal &retValue);
943  typedef ito::RetVal (*t_filterParam)(QVector<ito::Param> *paramsMand, QVector<ito::Param> *paramsOpt, QVector<ito::Param> *paramsOut);
944 
947  {
948  catNone = 0x0000,
949  catDiskIO = 0x0001,
950  catAnalyseDataObject = 0x0002,
951  catPlotDataObject = 0x0004
952  };
953 
956  {
957  iNotSpecified = 0x0000,
958  iReadDataObject = 0x0001,
959  iWriteDataObject = 0x0002,
960  iReadPointCloud = 0x0004,
961  iWritePointCloud = 0x0008,
962  iReadPolygonMesh = 0x0010,
963  iWritePolygonMesh = 0x0020,
964  iPlotSingleObject = 0x0040
965  };
966 
967  //Q_ENUM exposes a meta object to the enumeration types, such that the key names for the enumeration
968  //values are always accessible.
969  Q_ENUM(tAlgoCategory)
970  Q_ENUM(tAlgoInterface)
971 
973  class FilterDef
974  {
975  public:
978  m_filterFunc(NULL),
979  m_paramFunc(NULL),
980  m_pBasePlugin(NULL),
981  m_category(ito::AddInAlgo::catNone),
982  m_interface(ito::AddInAlgo::iNotSpecified)
983  {}
984 
986  FilterDef(AddInAlgo::t_filter filterFunc, AddInAlgo::t_filterParam filterParamFunc,
987  QString description = QString(), ito::AddInAlgo::tAlgoCategory category = ito::AddInAlgo::catNone,
989  QString interfaceMeta = QString()) :
990  m_filterFunc(filterFunc),
991  m_paramFunc(filterParamFunc),
992  m_pBasePlugin(NULL),
993  m_description(description),
994  m_category(category),
995  m_interface(interf),
996  m_interfaceMeta(interfaceMeta)
997  {}
998 
999  virtual ~FilterDef() {}
1000 
1001  t_filter m_filterFunc;
1002  t_filterParam m_paramFunc;
1004  QString m_name;
1005  QString m_description;
1009  private:
1010  FilterDef(const FilterDef & /*p*/); //disable copy constructor
1011  };
1012 
1014  class FilterDefExt : public FilterDef
1015  {
1016  public:
1019  FilterDef(),
1020  m_filterFuncExt(NULL)
1021  {}
1022 
1024  FilterDefExt(AddInAlgo::t_filterExt filterFuncExt, AddInAlgo::t_filterParam filterParamFunc,
1025  QString description = QString(), ito::AddInAlgo::tAlgoCategory category = ito::AddInAlgo::catNone,
1027  QString interfaceMeta = QString(), bool hasStatusInfo = true, bool isCancellable = true) :
1028  FilterDef(NULL, filterParamFunc, description, category, interf, interfaceMeta),
1029  m_filterFuncExt(filterFuncExt),
1030  m_hasStatusInformation(hasStatusInfo),
1031  m_isCancellable(isCancellable)
1032  {}
1033 
1034  virtual ~FilterDefExt() {}
1035 
1036  t_filterExt m_filterFuncExt;
1039 
1040  private:
1041  FilterDefExt(const FilterDefExt & /*p*/); //disable copy constructor
1042  };
1043 
1046  {
1047  public:
1050  m_widgetFunc(NULL),
1051  m_paramFunc(NULL),
1052  m_pBasePlugin(NULL),
1053  m_category(ito::AddInAlgo::catNone),
1054  m_interface(ito::AddInAlgo::iNotSpecified)
1055  {}
1056 
1058  AlgoWidgetDef(AddInAlgo::t_algoWidget algoWidgetFunc, AddInAlgo::t_filterParam algoWidgetParamFunc, QString description = QString(), ito::AddInAlgo::tAlgoCategory category = ito::AddInAlgo::catNone, ito::AddInAlgo::tAlgoInterface interf = ito::AddInAlgo::iNotSpecified, QString interfaceMeta = QString()) :
1059  m_widgetFunc(algoWidgetFunc),
1060  m_paramFunc(algoWidgetParamFunc),
1061  m_pBasePlugin(NULL),
1062  m_description(description),
1063  m_category(category),
1064  m_interface(interf),
1065  m_interfaceMeta(interfaceMeta)
1066  {}
1067 
1068  virtual ~AlgoWidgetDef() {}
1069 
1070  t_algoWidget m_widgetFunc;
1071  t_filterParam m_paramFunc;
1073  QString m_name;
1074  QString m_description;
1078 
1079  private:
1080  AlgoWidgetDef(const AlgoWidgetDef & /*p*/); //disable copy constructor
1081  };
1082 
1083  ito::RetVal getFilterList(QHash<QString, FilterDef *> &fList) const;
1084  ito::RetVal getAlgoWidgetList(QHash<QString, AlgoWidgetDef *> &awList) const;
1085  ito::RetVal rejectFilter(const QString &name);
1086  ito::RetVal rejectAlgoWidget(const QString &name);
1087 
1088  protected:
1089  virtual ~AddInAlgo();
1090  AddInAlgo();
1091  QHash<QString, FilterDef *> m_filterList;
1092  QHash<QString, AlgoWidgetDef *> m_algoWidgetList;
1093 
1095  static ito::RetVal prepareParamVectors(QVector<ito::Param> *paramsMand, QVector<ito::Param> *paramsOpt, QVector<ito::Param> *paramsOut);
1096 
1097  public Q_SLOTS:
1098  virtual ito::RetVal getParam(QSharedPointer<ito::Param> /*val*/, ItomSharedSemaphore * /*waitCond*/ = NULL) { return ito::retOk; }
1099  virtual ito::RetVal setParam(QSharedPointer<ito::ParamBase> /*val*/, ItomSharedSemaphore * /*waitCond*/ = NULL) { return ito::retOk; }
1100  };
1101 
1102  //----------------------------------------------------------------------------------------------------------------------------------
1103 } // namespace ito
1104 
1105 #endif //#if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC)
1106 
1108 Q_DECLARE_INTERFACE(ito::AddInInterfaceBase, ito_AddInInterface_CurrentVersion /*"ito.AddIn.InterfaceBase/4"*/)
1109 
1110 
1111 
1112 #endif
Definition: addInInterface.h:196
Definition: addInInterface.h:173
QString m_name
name of widget
Definition: addInInterface.h:1073
tAutoLoadPolicy getAutoLoadPolicy(void) const
returns true if the plugin allows his own parameter load to be autoloaded by addin manager ...
Definition: addInInterface.h:323
QVector< double > m_currentPos
Definition: addInInterface.h:753
PyObject * setParam(ito::AddInBase *addInObj, PyObject *args)
Definition: pythonPlugins.cpp:1347
container for publishing widgets provided by any plugin
Definition: addInInterface.h:1045
const ito::RetVal getExecFuncList(QMap< QString, ExecFuncParams > **funcs)
returns list of registered additional functions
Definition: addInInterface.h:422
Definition: addInInterface.h:200
bool hasGuiSupport()
check if we have gui support
Definition: addInInterface.h:543
QString m_description
description of filter
Definition: addInInterface.h:1005
Definition: addInInterface.h:158
tPluginType
tPluginType enumeration
Definition: addInInterface.h:128
base class for all actuator plugin classes
Definition: addInInterface.h:738
dataObject contains a n-dimensional matrix
Definition: dataobj.h:511
Definition: addInInterface.h:154
ito::AddInAlgo::tAlgoInterface m_interface
algorithm interface, filter fits to (default: iNotSpecified)
Definition: addInInterface.h:1007
QVector< double > m_targetPos
Definition: addInInterface.h:754
QVector< ito::Param > m_initParamsMand
vector with the mandatory initialisation parameters, please only read this vector within the init-met...
Definition: addInInterface.h:271
Definition: addInInterface.h:152
const ito::RetVal getParamList(QMap< QString, Param > **paramNames)
returns a map with the parameters of this plugin.
Definition: addInInterface.h:414
QString m_description
a brief descrition of the plugin
Definition: addInInterface.h:266
Definition: addInInterface.h:166
Definition: addInInterface.h:169
Class for managing status values (like errors or warning)
Definition: retVal.h:54
class for parameter handling e.g. to pass paramters to plugins
Definition: param.h:283
Definition: addInInterface.h:132
const QString getAboutInfo(void) const
returns a detailed description of the plugin compile informations
Definition: addInInterface.h:337
base class for all dataIO plugin classes
Definition: addInInterface.h:661
virtual ~AlgoWidgetDef()
destructor
Definition: addInInterface.h:1068
Definition: addInInterface.h:162
int m_timerIntervalMS
Definition: addInInterface.h:681
Base class for all plugins.
Definition: addInInterface.h:385
bool m_autoGrabbingEnabled
Definition: addInInterface.h:682
QString m_name
name of filter
Definition: addInInterface.h:1004
tAutoSavePolicy m_autoSavePolicy
Definition: addInInterface.h:274
tAutoLoadPolicy m_autoLoadPolicy
Definition: addInInterface.h:273
PyObject * getParam(ito::AddInBase *addInObj, PyObject *args)
Definition: pythonPlugins.cpp:868
tActuatorStatus
tActuatorStatus enumeration
Definition: addInInterface.h:148
ito::AddInInterfaceBase * m_pBasePlugin
interface (factory) instance of this plugin (will be automatically filled)
Definition: addInInterface.h:1003
base class for all "algorithm" plugin classes
Definition: addInInterface.h:929
Definition: addInInterface.h:153
Definition: addInInterface.cpp:50
int getMaxItomVer(void) const
returns maximum supported version of main program
Definition: addInInterface.h:317
int getInstCount()
get number instantiated plugins
Definition: addInInterface.h:360
int m_version
plugin version
Definition: addInInterface.h:261
Definition: typeDefs.h:58
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
Definition: addInInterface.h:165
QString m_description
description of widget
Definition: addInInterface.h:1074
Definition: addInInterface.h:170
tAutoSavePolicy getAutoSavePolicy(void) const
returns true if the plugin allows his own parameter save to be autoloaded by addin manager ...
Definition: addInInterface.h:326
Definition: addInInterface.h:131
Definition: addInInterface.cpp:167
virtual QVector< ito::Param > * getInitParamsMand(void)
returns a vector with the mandatory initialisation parameters
Definition: addInInterface.h:348
QVector< Param > paramsOpt
Definition: addInInterface.h:204
Definition: addInInterface.h:175
tAutoSavePolicy
Definition: addInInterface.h:194
QVector< Param > paramsMand
Definition: addInInterface.h:203
t_filterParam m_paramFunc
function pointer (unbounded, static) for widget's default parameter method
Definition: addInInterface.h:1071
QString m_license
a short license string for the plugin, default value is "LGPL with ITO itom-exception" ...
Definition: addInInterface.h:268
t_filterExt m_filterFuncExt
extended function pointer (unbounded, static) for filter-method
Definition: addInInterface.h:1036
Definition: apiFunctionsGraph.cpp:39
default: no category
Definition: addInInterface.h:948
bool hasGuiSupport()
check if we have gui support
Definition: addInInterface.h:282
extended FilterDef (derived from FilterDef) with a filterFunc of type f_filterExt instead of t_filter...
Definition: addInInterface.h:1014
t_filter m_filterFunc
function pointer (unbounded, static) for filter-method
Definition: addInInterface.h:1001
Definition: addInInterface.h:157
int getVersion(void) const
returns addIn version
Definition: addInInterface.h:313
bool getCallInitInNewThread(void) const
returns whether init-method should be called in new thread (default) or still in main thread ...
Definition: addInInterface.h:320
FilterDefExt()
< empty, default constructor
Definition: addInInterface.h:1018
Definition: addInInterface.h:190
ito::AddInAlgo::tAlgoInterface m_interface
algorithm interface, widget fits to (default: iNotSpecified)
Definition: addInInterface.h:1076
FilterDef()
< empty, default constructor
Definition: addInInterface.h:977
QVector< ito::Param > m_initParamsOpt
vector with the optional initialisation parameters, please only read this vector within the init-meth...
Definition: addInInterface.h:272
QString m_interfaceMeta
meta information if required by algorithm interface
Definition: addInInterface.h:1077
Definition: addInInterface.h:164
semaphore which can be used for asychronous thread communication. By using this class it is possible ...
Definition: sharedStructuresQt.h:57
Definition: addInInterface.h:161
int m_type
plugin type
Definition: addInInterface.h:260
Definition: addInInterface.h:189
Definition: addInInterface.h:391
Definition: addInInterface.h:197
virtual QVector< ito::Param > * getInitParamsOpt(void)
returns a vector with the optional initialisation parameters
Definition: addInInterface.h:350
Definition: addInInterface.h:133
int m_minItomVer
maximum supported version of the main program
Definition: addInInterface.h:264
Definition: addInInterface.h:184
QString m_identifier
unique identifier (serial number, com-port...)
Definition: addInInterface.h:540
Definition: addInInterface.h:130
int m_timerID
Definition: addInInterface.h:680
QString m_author
the plugin author
Definition: addInInterface.h:265
forward declaration to private container class of AddInAlog
Definition: addInInterface.h:248
QList< ito::AddInBase * > m_InstList
vector holding a list of the actual instantiated classes of the plugin
Definition: addInInterface.h:270
virtual void dockWidgetVisibilityChanged(bool)
overwrite this slot if you want to get informed when the dock-widget of the plugin becomes (in)visibl...
Definition: addInInterface.h:631
QVector< ito::AddInBase::AddInRef * > * getArgAddIns(void)
returns vector of AddInRef instances.
Definition: addInInterface.h:499
Definition: addInInterface.h:134
tAutoLoadPolicy
Definition: addInInterface.h:187
Definition: addInInterface.h:159
default: filter or widget does not fit to any interface
Definition: addInInterface.h:957
const QString getLicenseInfo(void) const
returns a detailed description of the plugin license
Definition: addInInterface.h:335
int getMinItomVer(void) const
returns minimum required version of main program
Definition: addInInterface.h:315
int getAutoGrabbing()
Definition: addInInterface.h:685
QSet< QObject * > m_autoGrabbingListeners
Definition: addInInterface.h:679
Definition: addInInterface.h:191
QList< ito::AddInBase * > getInstList(void)
returns a list of the actual intantiated classes from this plugin
Definition: addInInterface.h:343
tAlgoCategory
Definition: addInInterface.h:946
QVector< int > m_currentStatus
Definition: addInInterface.h:752
const QString getAuthor(void) const
returns plugin author
Definition: addInInterface.h:329
const QString getDetailDescription(void) const
returns a detailed description of the plugin
Definition: addInInterface.h:333
int getType(void) const
returns addIn type
Definition: addInInterface.h:311
ito::AddInInterfaceBase * m_pBasePlugin
interface (factory) instance of this plugin (will be automatically filled)
Definition: addInInterface.h:1072
Definition: addInInterface.h:163
Definition: addInInterface.h:178
AlgoWidgetDef()
< empty, default constructor
Definition: addInInterface.h:1049
Definition: param.h:67
Definition: addInInterface.h:135
ito::AddInAlgo::tAlgoCategory m_category
category, widget belongs to (default: catNone)
Definition: addInInterface.h:1075
QString m_interfaceMeta
meta information if required by algorithm interface
Definition: addInInterface.h:1008
bool m_isCancellable
true, if filter listens to a possible interrupt flag in the optional observer and cancels the executi...
Definition: addInInterface.h:1038
QMap< QString, Param > m_params
map of the available parameters
Definition: addInInterface.h:538
t_algoWidget m_widgetFunc
function pointer (unbounded, static) for widget-method
Definition: addInInterface.h:1070
Definition: apiFunctionsGraph.h:38
QString m_filename
plugin (library) filename on the disc
Definition: addInInterface.h:262
ito::AddInAlgo::tAlgoCategory m_category
category, filter belongs to (default: catNone)
Definition: addInInterface.h:1006
Definition: addInInterface.h:155
bool m_callInitInNewThread
Definition: addInInterface.h:275
t_filterParam m_paramFunc
function pointer (unbounded, static) for filter's default parameter method
Definition: addInInterface.h:1002
QVector< Param > paramsOut
Definition: addInInterface.h:205
int m_maxItomVer
minimum required version of the main program
Definition: addInInterface.h:263
const QString getDescription(void) const
returns a brief description of the plugin
Definition: addInInterface.h:331
Definition: addInInterface.cpp:1184
tAlgoInterface
Definition: addInInterface.h:955
Definition: addInInterface.h:151
const QString getFilename(void) const
returns the plugin's filename
Definition: addInInterface.h:339
bool m_hasStatusInformation
true, if filter updates status information to the optional observer
Definition: addInInterface.h:1037
Definition: addInInterface.cpp:1441
Definition: addInInterface.h:182
QString getIdentifier() const
retrieve the unique identifier of this instance
Definition: addInInterface.h:428
Definition: addInInterface.cpp:815
Definition: addInInterface.h:209
Definition: addInInterface.h:160
container for publishing filters provided by any plugin
Definition: addInInterface.h:973
QString m_detaildescription
a detail descrition of the plugin
Definition: addInInterface.h:267