itom 2.0.0
D:/git-itom/sources/itom/common/pluginThreadCtrl.h
00001 /* ********************************************************************
00002     itom software
00003     URL: http://www.uni-stuttgart.de/ito
00004     Copyright (C) 2013, Institut für Technische Optik (ITO),
00005     Universität 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 für 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 HELPERGRABBER_H
00029 #define HELPERGRABBER_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 //----------------------------------------------------------------------------------------------------------------------------------
00056 class ITOMCOMMONQT_EXPORT PluginThreadCtrl
00057 {
00058 protected:
00059     ito::AddInBase *m_pPlugin;                   
00060     ito::RetVal waitForSemaphore(ItomSharedSemaphore *waitCond, int timeOutMS = PLUGINWAIT);    
00062 public:
00063     PluginThreadCtrl();                                                                  
00064     PluginThreadCtrl(const ito::ParamBase &pluginParameter, ito::RetVal *retval = NULL); 
00065     PluginThreadCtrl(ito::AddInBase *plugin, ito::RetVal *retval = NULL);                
00066     PluginThreadCtrl(const PluginThreadCtrl &other);
00067     virtual ~PluginThreadCtrl();                                                         
00069     PluginThreadCtrl& operator =(const PluginThreadCtrl &other);
00070 
00071     ito::RetVal getParam(ito::Param &val, int timeOutMS = PLUGINWAIT);      
00072     ito::RetVal setParam(ito::ParamBase val, int timeOutMS = PLUGINWAIT);       
00073 };
00074 
00075 
00076 //-----------------------------------------------------------------------------------
00077 class ITOMCOMMONQT_EXPORT DataIOThreadCtrl : public PluginThreadCtrl
00078 {
00079 public:
00080     DataIOThreadCtrl();                                                                  
00081     DataIOThreadCtrl(const ito::ParamBase &pluginParameter, ito::RetVal *retval = NULL); 
00082     DataIOThreadCtrl(ito::AddInDataIO *plugin, ito::RetVal *retval = NULL);              
00083     DataIOThreadCtrl(const DataIOThreadCtrl &other);
00084     virtual ~DataIOThreadCtrl();                                                         
00086     ito::RetVal startDevice(int timeOutMS = PLUGINWAIT);                     
00087     ito::RetVal stopDevice(int timeOutMS = PLUGINWAIT);                      
00088     ito::RetVal acquire(const int trigger = 0, int timeOutMS = PLUGINWAIT);  
00089     ito::RetVal getVal(ito::DataObject &dObj, int timeOutMS = PLUGINWAIT);   
00090     ito::RetVal copyVal(ito::DataObject &dObj, int timeOutMS = PLUGINWAIT);  
00092     ito::RetVal getImageParams(int &bpp, int &sizex, int &sizey, int timeOutMS = PLUGINWAIT); 
00093 };
00094 
00095 //-----------------------------------------------------------------------------------
00096 class ITOMCOMMONQT_EXPORT ActuatorThreadCtrl : public PluginThreadCtrl
00097 {
00098 protected:
00099     int m_numAxes;
00100 
00101 public:
00102     ActuatorThreadCtrl();                                                                  
00103     ActuatorThreadCtrl(const ito::ParamBase &pluginParameter, ito::RetVal *retval = NULL); 
00104     ActuatorThreadCtrl(ito::AddInActuator *plugin, ito::RetVal *retval = NULL);            
00105     ActuatorThreadCtrl(const ActuatorThreadCtrl &other);
00106     virtual ~ActuatorThreadCtrl();                                                         
00108     ito::RetVal setPosRel(const QVector<int> &axes, const QVector<double> &relPositions, int timeOutMS = PLUGINWAIT);  
00109     ito::RetVal setPosAbs(const QVector<int> &axes, const QVector<double> &absPositions, int timeOutMS = PLUGINWAIT);  
00110     ito::RetVal setPosRel(int axis, double relPosition, int timeOutMS = PLUGINWAIT);                       
00111     ito::RetVal setPosAbs(int axis, double absPosition, int timeOutMS = PLUGINWAIT);                       
00113     ito::RetVal getPos(QVector<int> axes, QVector<double> &positions, int timeOutMS = PLUGINWAIT);         
00114     ito::RetVal getPos(int axis, double &position, int timeOutMS = PLUGINWAIT);                            
00116     ito::RetVal checkAxis(int axisNum);                                                                    
00117 };
00118 
00119 }   // end namespace ito
00120 
00121 #endif //#if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC)
00122 
00123 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends