]> git.tdb.fi Git - r2c2.git/blob - source/libr2c2/clock.h
469d1916e1de77667cb57bb74b84a719c9da0540
[r2c2.git] / source / libr2c2 / clock.h
1 #ifndef LIBR2C2_CLOCK_H_
2 #define LIBR2C2_CLOCK_H_
3
4 #include <sigc++/signal.h>
5 #include <msp/datafile/objectloader.h>
6 #include <msp/time/timedelta.h>
7
8 namespace R2C2 {
9
10 class Clock
11 {
12 public:
13         class Loader: public Msp::DataFile::ObjectLoader<Clock>
14         {
15         public:
16                 Loader(Clock &);
17
18         private:
19                 void time(Msp::Time::RawTime);
20         };
21
22         sigc::signal<void> signal_minute;
23
24 private:
25         Msp::Time::TimeDelta current_time;
26         float rate;
27         bool stopped;
28
29 public:
30         Clock();
31
32         void set_rate(float);
33         float get_rate() const { return rate; }
34         void set_current_time(const Msp::Time::TimeDelta &);
35         const Msp::Time::TimeDelta &get_current_time() const { return current_time; }
36         void stop(bool);
37         bool is_stopped() const { return stopped; }
38         void tick(const Msp::Time::TimeDelta &);
39         void save(std::list<Msp::DataFile::Statement> &) const;
40 };
41
42 } // namespace R2C2
43
44 #endif