Gnash  0.8.11dev
ManualClock.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3  * Free Software Foundation, Inc.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  *
20  */
21 
22 #ifndef _GNASH_MANUAL_CLOCK_HH
23 #define _GNASH_MANUAL_CLOCK_HH
24 
25 #include "VirtualClock.h" // for inheritance
26 
27 namespace gnash {
28 
30 class ManualClock : public VirtualClock
31 {
32 public:
33 
36  :
37  _elapsed(0)
38  {}
39 
40  // see dox in VirtualClock.h
41  unsigned long elapsed() const
42  {
43  return _elapsed;
44  }
45 
46  // see dox in VirtualClock.h
47  void restart()
48  {
49  _elapsed=0;
50  }
51 
53  void advance(unsigned long amount)
54  {
55  _elapsed += amount;
56  }
57 
58 private:
59 
60  unsigned long _elapsed;
61 };
62 
63 
64 } // namespace gnash
65 
66 #endif // _GNASH_MANUAL_CLOCK_HH
A class used to virtualize time flow.
Definition: VirtualClock.h:33
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
void advance(unsigned long amount)
Advance the clock by the given amount of milliseconds.
Definition: ManualClock.h:53
void restart()
Restart the clock.
Definition: ManualClock.h:47
A manually advanced clock.
Definition: ManualClock.h:30
unsigned long elapsed() const
Return number of milliseconds elapsed since start.
Definition: ManualClock.h:41
ManualClock()
Construct a manual clock.
Definition: ManualClock.h:35