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 #include <boost/shared_ptr.hpp>
29 
30 
31 
32 /**
33  * Base class for timing. Derive from it to write several timers like a frame-timer or realtime-timer.
34  */
35 class WTimer // NOLINT - no does not need an virtual destructor.
36 {
37 public:
38  /**
39  * Convenience typedef for a shared_ptr
40  */
41  typedef boost::shared_ptr< WTimer > SPtr;
42 
43  /**
44  * Convenience typedef for a const shared_ptr.
45  */
46  typedef boost::shared_ptr< const WTimer > ConstSPtr;
47 
48  /**
49  * Constructs a animation timer.
50  */
51  WTimer();
52 
53  /**
54  * Destructor.
55  */
56  virtual ~WTimer();
57 
58  /**
59  * Resets the start-tick.
60  */
61  virtual void reset() = 0;
62 
63  /**
64  * Returns the elapsed time since the last reset in seconds with milliseconds precision.
65  *
66  * \return elapsed time in seconds with millisecond precision.
67  */
68  virtual double elapsed() const = 0;
69 
70 private:
71 };
72 
73 #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:41
Base class for timing.
Definition: WTimer.h:35
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:46