]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/dummy.cpp
Major architecture rework
[r2c2.git] / source / libmarklin / dummy.cpp
1 /* $Id$
2
3 This file is part of the MSP Märklin suite
4 Copyright © 2010  Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #include "dummy.h"
9
10 using namespace std;
11
12 namespace Marklin {
13
14 Dummy::Dummy():
15         power(true)
16 { }
17
18 void Dummy::set_power(bool p)
19 {
20         power = p;
21         signal_power.emit(power);
22 }
23
24 void Dummy::add_turnout(unsigned addr)
25 {
26         turnouts[addr];
27 }
28
29 void Dummy::set_turnout(unsigned addr, bool state)
30 {
31         turnouts[addr] = state;
32         signal_turnout.emit(addr, state);
33 }
34
35 bool Dummy::get_turnout(unsigned addr) const
36 {
37         map<unsigned, bool>::const_iterator i = turnouts.find(addr);
38         if(i!=turnouts.end())
39                 return i->second;
40         return false;
41 }
42
43 } // namespace Marklin