]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/turnout.h
Change terminology to better distinguish routes on the layout from paths across track...
[r2c2.git] / source / libmarklin / turnout.h
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2006-2009 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef LIBMARKLIN_TURNOUT_H_
9 #define LIBMARKLIN_TURNOUT_H_
10
11 #include <list>
12 #include <map>
13 #include <string>
14 #include <sigc++/sigc++.h>
15 #include "constants.h"
16
17 namespace Marklin {
18
19 class Control;
20 class Reply;
21
22 class Turnout
23 {
24 public:
25         sigc::signal<void, unsigned> signal_path_changing;
26         sigc::signal<void, unsigned> signal_path_changed;
27
28 private:
29         Control &control;
30         unsigned addr;
31         unsigned path;
32         bool dual;
33
34 public:
35         Turnout(Control &, unsigned, bool =false);
36
37         void set_path(unsigned);
38         unsigned get_address() const { return addr; }
39         unsigned get_path() const { return path; }
40 private:
41         void command(bool);
42         void status_reply(const Reply &, bool);
43         bool switch_timeout();
44         void turnout_event(unsigned, bool);
45 };
46
47 } // namespace Marklin
48
49 #endif