Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00020 #ifndef CLOCK_HPP_3123312070
00021 #define CLOCK_HPP_3123312070
00022 
00023 #include <ctime>
00024 #include <iostream>
00025 
00026 
00027 namespace TRTK
00028 {
00029 
00030 
00102 class Clock
00103 {
00104 public:
00105     enum Error {UNKNOWN_ERROR, UNKNOWN_STATE};
00106 
00107     Clock();
00108 
00109     double elapsed_time() const;
00110     void pause();
00111     void reset();
00112     void resume();
00113     void wait_milliseconds(double time) const;
00114     void wait_seconds(double time) const;
00115 
00116 private:
00117     enum State {RUNNING, PAUSED};
00118 
00119     clock_t m_time;
00120     clock_t m_time_when_paused;
00121     State state;
00122 };
00123 
00124 
00125 std::ostream & operator<< (std::ostream & output, Clock & clock);
00126 
00127 
00128 } 
00129 
00130 
00131 #endif // CLOCK_HPP_3123312070