]> git.tdb.fi Git - r2c2.git/blob - source/libr2c2/clock.h
59bffe70f0f3871ff4c469fbc73456bd301db2a5
[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
28 public:
29         Clock();
30
31         void set_rate(float);
32         float get_rate() const { return rate; }
33         void set_current_time(const Msp::Time::TimeDelta &);
34         const Msp::Time::TimeDelta &get_current_time() const { return current_time; }
35         void tick(const Msp::Time::TimeDelta &);
36         void save(std::list<Msp::DataFile::Statement> &) const;
37 };
38
39 } // namespace R2C2
40
41 #endif