OMKClock.h

Go to the documentation of this file.
00001 /*
00002  * Software OpenMASK-3DVis  INRIA 1993-2002, thereinafter the Software
00003  * 
00004  * The software has been developed within the Siames Project. 
00005  * INRIA hold intellectual property rights
00006  * 
00007  * The Software has been registered with the Agence pour la Protection des
00008  * Programmes (APP) under registration number IDDN.FR.001.500027.00.S.P.2001.000.41200
00009  *
00010  * This file may be distributed under the terms of the Q Public License
00011  * version 1.0 as defined by Trolltech AS of Norway and appearing in the file
00012  * LICENSE.QPL included in the packaging of this file.
00013  *
00014  * Licensees holding valid specific licenses issued by INRIA for the software may use 
00015  * this file in accordance with that specific license         
00016  *
00017  */
00018 //-----------------------------------------------------------------------------
00019 #ifndef OMKClockHEADER
00020 #define OMKClockHEADER
00021 
00022 #include <OMKExtensibleSimulatedObject.h>
00023 
00024 #ifdef _MSC_VER
00025 #include <windows.h>
00026 #endif
00027 namespace OMK
00028 {
00076 class OMK_API Clock 
00077 : public OMK::ExtensibleSimulatedObject
00078 {
00079 public:
00080   DECLARE_OBJECT_FACTORY( Clock ) ;
00082 
00083   virtual void init();
00084   virtual void compute();  
00085   virtual bool processEvent( Event* event );
00087 
00088 
00089 
00094   bool isSleepActive() const { return _activeSleep ; }
00101   void setSleepActive( bool activeSleep ) { _activeSleep = activeSleep ; }
00106   bool isFreeRunning() const { return _freeRun; }
00113   void setFreeRunning( bool freeRun )
00114   {  
00115     _freeRun = freeRun;
00116   }
00120   float getRealMultiplier() const { return _realMult; }
00124   float getWantedMultiplier() const { return _wantedMult; }
00130   void setWantedMultiplier( float m ) { if( 0 < m ) _wantedMult = m; }
00132 protected:
00133 
00134 #ifdef _MSC_VER // WINDOWS Time Management
00135   LARGE_INTEGER _startSimulationDate;// Date at which simulation started (in micro-secondes).
00136   LARGE_INTEGER _lastCallDate;       // Last call date to compute in micro-secondes.
00137   LARGE_INTEGER _lastRealRefresh;    // To regularly update simulated clock and ratio display
00138   LARGE_INTEGER _processorFrequency; // Frequency ( clock processor speed )
00139 #else // POSIX Time Management
00140   unsigned long _lastCallDate;   
00141   unsigned long _lastRealRefresh; 
00142 #endif
00143   unsigned long _firstRealDate;  
00144 
00145   long          _timeToSpend;    
00146   unsigned long _simulFrequency; 
00147 
00148   float _wantedMult; 
00149 
00150   float _realMult;   
00151 
00152   bool _freeRun;      
00153 
00154 
00155   bool _activeSleep;  
00156 
00157   
00158   bool _simulationStarted; 
00159 
00160 };  
00161 } // namespace OMK
00162 #endif  // OMKClockHEADER
00163 
00164 

logo OpenMask

Documentation generated on Mon Jun 9 11:45:55 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007