Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

Timer.h

Go to the documentation of this file.
00001 
00037 #ifndef _AMIRE_COMMON_TIMER_H
00038 #define _AMIRE_COMMON_TIMER_H
00039 
00040 #include <ctime>
00041 
00042 #include <amire/common/Defines.h>
00043 
00044 #include <amire/common/Real.h>
00045 
00046 namespace amire {
00047   namespace common {
00051     class AMIRE_EXPORT_API Timer : public virtual osg::Referenced {
00052     public:
00053       inline Timer() : Referenced() {
00054       }
00055 
00056       virtual ~Timer();
00057 
00061       virtual Real getTime() = 0;
00062 
00066       virtual void cont() = 0;
00067 
00071       virtual void pause() = 0;
00072 
00076       virtual void reset() = 0;
00077     };
00078 
00082     class AMIRE_EXPORT_API ScaleTimer : public virtual Timer {
00083     private:
00084       osg::ref_ptr<Timer> timer;
00085       Real scale;
00086       Real time;
00087       Real timerTime;
00088       bool paused;
00089 
00090     public:
00094       inline ScaleTimer(const osg::ref_ptr<Timer> &ptimer) : Timer(), timer(ptimer) {
00095         reset();
00096         scale = 1.0;
00097         paused = false;
00098       }
00099 
00100       virtual ~ScaleTimer();
00101 
00102       virtual Real getTime();
00103       virtual void cont();
00104       virtual void pause();
00105       virtual void reset();
00106 
00110       virtual void setScale(Real s);
00111     };
00112 
00116     class AMIRE_EXPORT_API RealTimeTimer : public virtual Timer {
00117     private:
00118       long startTime;
00119       long pauseTime;
00120       long pauseBegin;
00121       bool paused;
00122 
00123     public:
00127       inline RealTimeTimer() : Timer() {
00128         reset();
00129         paused = false;
00130       }
00131 
00132       virtual ~RealTimeTimer();
00133 
00134       virtual Real getTime();
00135       virtual void cont();
00136       virtual void pause();
00137       virtual void reset();
00138     };
00139 
00143     class AMIRE_EXPORT_API CountingTimer : public virtual Timer {
00144     private:
00145       Real time;
00146       Real delta;
00147       bool paused;
00148 
00149     public:
00153       inline CountingTimer(Real delta = 0.1) : Timer() {
00154         this->delta = delta;
00155         reset();
00156         paused = false;
00157       }
00158 
00162       inline void setDelta(Real delta) {
00163         this->delta = delta;
00164       }
00165 
00169       inline Real getDelta() {
00170         return delta;
00171       }
00172 
00173       virtual ~CountingTimer();
00174 
00175       virtual Real getTime();
00176       virtual void cont();
00177       virtual void pause();
00178       virtual void reset();
00179     };
00180   }
00181 }
00182 
00183 #endif

Generated on Tue May 20 17:23:53 2003 for AMIRE-Framework by doxygen1.3