itom 2.2.1
K:/git-itom/sources/itom/common/pluginThreadCtrl.h
00001 /* ********************************************************************
00002     itom software
00003     URL: http://www.uni-stuttgart.de/ito
00004     Copyright (C) 2016, Institut fuer Technische Optik (ITO),
00005     Universitaet Stuttgart, Germany
00006 
00007     This file is part of itom and its software development toolkit (SDK).
00008 
00009     itom is free software; you can redistribute it and/or modify it
00010     under the terms of the GNU Library General Public Licence as published by
00011     the Free Software Foundation; either version 2 of the Licence, or (at
00012     your option) any later version.
00013    
00014     In addition, as a special exception, the Institut fuer Technische
00015     Optik (ITO) gives you certain additional rights.
00016     These rights are described in the ITO LGPL Exception version 1.0,
00017     which can be found in the file LGPL_EXCEPTION.txt in this package.
00018 
00019     itom is distributed in the hope that it will be useful, but
00020     WITHOUT ANY WARRANTY; without even the implied warranty of
00021     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
00022     General Public Licence for more details.
00023 
00024     You should have received a copy of the GNU Library General Public License
00025     along with itom. If not, see <http://www.gnu.org/licenses/>.
00026 *********************************************************************** */
00027 
00028 #ifndef PLUGINTHREADCTRL_H
00029 #define PLUGINTHREADCTRL_H
00030 
00031 #include "typeDefs.h"
00032 #include "addInInterface.h"
00033 #include "sharedStructures.h"
00034 
00035 #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
00036 
00037 namespace ito
00038 {
00039 
00040 //----------------------------------------------------------------------------------------------------------------------------------
00049 class ITOMCOMMONQT_EXPORT PluginThreadCtrl
00050 {
00051 protected:
00052     ito::AddInBase *m_pPlugin;                   
00053     ItomSharedSemaphoreLocker m_semaphoreLocker; 
00055 public:
00057     PluginThreadCtrl();
00058 
00060 
00071     PluginThreadCtrl(const ito::ParamBase &pluginParameter, ito::RetVal *retval = NULL);
00072 
00074 
00083     PluginThreadCtrl(ito::AddInBase *plugin, ito::RetVal *retval = NULL);
00084 
00086     PluginThreadCtrl(const PluginThreadCtrl &other);
00087 
00089     virtual ~PluginThreadCtrl();
00090 
00092     PluginThreadCtrl& operator =(const PluginThreadCtrl &other);
00093 
00094     ito::RetVal getParam(ito::Param &val, int timeOutMS = PLUGINWAIT);      
00095     ito::RetVal setParam(ito::ParamBase val, int timeOutMS = PLUGINWAIT);   
00097     ito::RetVal waitForSemaphore(int timeOutMS = PLUGINWAIT);               
00098 };
00099 
00100 
00101 //-----------------------------------------------------------------------------------
00149 class ITOMCOMMONQT_EXPORT DataIOThreadCtrl : public PluginThreadCtrl
00150 {
00151 public:
00153     DataIOThreadCtrl();
00154 
00156 
00167     DataIOThreadCtrl(const ito::ParamBase &pluginParameter, ito::RetVal *retval = NULL);
00168 
00170 
00179     DataIOThreadCtrl(ito::AddInDataIO *plugin, ito::RetVal *retval = NULL);
00180 
00182     DataIOThreadCtrl(const DataIOThreadCtrl &other);
00183 
00185     virtual ~DataIOThreadCtrl();
00186 
00187     ito::RetVal startDevice(int timeOutMS = PLUGINWAIT);                     
00188     ito::RetVal stopDevice(int timeOutMS = PLUGINWAIT);                      
00189     ito::RetVal acquire(const int trigger = 0, int timeOutMS = PLUGINWAIT);  
00190     ito::RetVal getVal(ito::DataObject &dObj, int timeOutMS = PLUGINWAIT);   
00191     ito::RetVal copyVal(ito::DataObject &dObj, int timeOutMS = PLUGINWAIT);  
00192     ito::RetVal enableAutoGrabbing(int timeOutMS = PLUGINWAIT);              
00193     ito::RetVal disableAutoGrabbing(int timeOutMS = PLUGINWAIT);             
00194     ito::RetVal setAutoGrabbingInterval(QSharedPointer<int> interval, int timeOutMS = PLUGINWAIT); 
00195     bool getAutoGrabbing();                                                  
00197     ito::RetVal getImageParams(int &bpp, int &sizex, int &sizey, int timeOutMS = PLUGINWAIT); 
00198 };
00199 
00200 //-----------------------------------------------------------------------------------
00239 class ITOMCOMMONQT_EXPORT ActuatorThreadCtrl : public PluginThreadCtrl
00240 {
00241 protected:
00242     int m_numAxes;
00243 
00244 public:
00246     ActuatorThreadCtrl();            
00247 
00249 
00260     ActuatorThreadCtrl(const ito::ParamBase &pluginParameter, ito::RetVal *retval = NULL);
00261 
00263 
00272     ActuatorThreadCtrl(ito::AddInActuator *plugin, ito::RetVal *retval = NULL);
00273 
00275     ActuatorThreadCtrl(const ActuatorThreadCtrl &other);
00276 
00278     virtual ~ActuatorThreadCtrl();
00279 
00280     ito::RetVal setPosRel(const QVector<int> &axes, const QVector<double> &relPositions, int timeOutMS = PLUGINWAIT);  
00281     ito::RetVal setPosAbs(const QVector<int> &axes, const QVector<double> &absPositions, int timeOutMS = PLUGINWAIT);  
00282     ito::RetVal setPosRel(int axis, double relPosition, int timeOutMS = PLUGINWAIT);                       
00283     ito::RetVal setPosAbs(int axis, double absPosition, int timeOutMS = PLUGINWAIT);                       
00285     ito::RetVal getPos(QVector<int> axes, QVector<double> &positions, int timeOutMS = PLUGINWAIT);         
00286     ito::RetVal getPos(int axis, double &position, int timeOutMS = PLUGINWAIT);                            
00289     ito::RetVal checkAxis(int axisNum);                                                              
00290 };
00291 
00292 }   // end namespace ito
00293 
00294 #endif //#if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC)
00295 #endif //PLUGINTHREADCTRL_H
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Friends