itom 2.2.1
K:/git-itom/sources/itom/common/addInGrabber.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 ADDINGRABBER_H
00029 #define ADDINGRABBER_H
00030 
00031 #include "addInInterface.h"
00032 
00033 #include "../DataObject/dataobj.h"
00034 #include "sharedStructuresQt.h"
00035 #include "sharedStructures.h"
00036 
00037 #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
00038 
00039 namespace ito
00040 {
00041     class AddInGrabberPrivate;
00042 
00043     class ITOMCOMMONQT_EXPORT AddInGrabber : public ito::AddInDataIO
00044     {
00045         Q_OBJECT
00046 
00047     private:
00049 
00055         int m_started;
00056 
00057         AddInGrabberPrivate *dd;        
00058 
00059     protected:
00060         void timerEvent (QTimerEvent *event);  
00062 
00063 
00072         virtual ito::RetVal checkData(ito::DataObject *externalDataObject = NULL);
00073 
00075 
00082         virtual ito::RetVal retrieveData(ito::DataObject *externalDataObject = NULL) = 0; 
00083 
00084         ito::RetVal sendDataToListeners(int waitMS);  
00086         inline int grabberStartedCount() { return m_started; }  
00089         inline void incGrabberStarted() 
00090         { 
00091             m_started++; 
00092             if(m_started == 1)
00093             {
00094                 runStatusChanged(true); //now, the device is started -> check if any listener is connected and if so start the auto grabbing timer (if flag is true, too)
00095             }
00096         }  
00097 
00099         inline void decGrabberStarted() 
00100         { 
00101             m_started--; 
00102             if(m_started == 0)
00103             {
00104                 runStatusChanged(false); //now, the device is stopped -> stop any possibly started auto grabbing listener
00105             }
00106         } 
00107 
00109         inline void setGrabberStarted(int value) 
00110         { 
00111             m_started = value; 
00112             runStatusChanged( value > 0 );
00113         }  
00114 
00115         ito::DataObject m_data; 
00117     public:
00118         AddInGrabber();
00119         ~AddInGrabber();
00120 
00121     };
00122 } //end namespace ito
00123 
00124 #endif //#if !defined(Q_MOC_RUN) || defined(ITOMCOMMONQT_MOC)
00125 
00126 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Friends