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