OpenWalnut  1.4.0
WTimer.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WTIMER_H
26 #define WTIMER_H
27 
28 #ifndef Q_MOC_RUN
29 #include <boost/shared_ptr.hpp>
30 #endif
31 
32 
33 
34 /**
35  * Base class for timing. Derive from it to write several timers like a frame-timer or realtime-timer.
36  */
37 class WTimer // NOLINT - no does not need an virtual destructor.
38 {
39 public:
40  /**
41  * Convenience typedef for a shared_ptr
42  */
43  typedef boost::shared_ptr< WTimer > SPtr;
44 
45  /**
46  * Convenience typedef for a const shared_ptr.
47  */
48  typedef boost::shared_ptr< const WTimer > ConstSPtr;
49 
50  /**
51  * Constructs a animation timer.
52  */
53  WTimer();
54 
55  /**
56  * Destructor.
57  */
58  virtual ~WTimer();
59 
60  /**
61  * Resets the start-tick.
62  */
63  virtual void reset() = 0;
64 
65  /**
66  * Returns the elapsed time since the last reset in seconds with milliseconds precision.
67  *
68  * \return elapsed time in seconds with millisecond precision.
69  */
70  virtual double elapsed() const = 0;
71 
72 private:
73 };
74 
75 #endif // WTIMER_H
WTimer()
Constructs a animation timer.
Definition: WTimer.cpp:27
virtual void reset()=0
Resets the start-tick.
boost::shared_ptr< WTimer > SPtr
Convenience typedef for a shared_ptr.
Definition: WTimer.h:43
Base class for timing.
Definition: WTimer.h:37
virtual ~WTimer()
Destructor.
Definition: WTimer.cpp:32
virtual double elapsed() const =0
Returns the elapsed time since the last reset in seconds with milliseconds precision.
boost::shared_ptr< const WTimer > ConstSPtr
Convenience typedef for a const shared_ptr.
Definition: WTimer.h:48