]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/sensor.h
Initial revision
[r2c2.git] / source / libmarklin / sensor.h
1 #ifndef LIBMARKLIN_SENSOR_H_
2 #define LIBMARKLIN_SENSOR_H_
3
4 #include <list>
5 #include <map>
6 #include <sigc++/sigc++.h>
7
8 namespace Marklin {
9
10 class Control;
11
12 class Sensor
13 {
14 public:
15         sigc::signal<void, bool> signal_state_changed;
16
17         Sensor(Control &, unsigned);
18         unsigned get_address() const { return addr; }
19         bool     get_state() const   { return state; }
20 private:
21         Control  &control;
22         unsigned addr;
23         bool     state;
24
25         void sensor_event(unsigned, bool);
26 };
27 typedef std::list<Sensor *> SensorSeq;
28 typedef std::map<unsigned, Sensor *> SensorMap;
29
30 } // namespace Marklin
31
32 #endif