]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/dummy.cpp
Major architecture rework
[r2c2.git] / source / libmarklin / dummy.cpp
diff --git a/source/libmarklin/dummy.cpp b/source/libmarklin/dummy.cpp
new file mode 100644 (file)
index 0000000..1a7dd36
--- /dev/null
@@ -0,0 +1,43 @@
+/* $Id$
+
+This file is part of the MSP Märklin suite
+Copyright © 2010  Mikkosoft Productions, Mikko Rasa
+Distributed under the GPL
+*/
+
+#include "dummy.h"
+
+using namespace std;
+
+namespace Marklin {
+
+Dummy::Dummy():
+       power(true)
+{ }
+
+void Dummy::set_power(bool p)
+{
+       power = p;
+       signal_power.emit(power);
+}
+
+void Dummy::add_turnout(unsigned addr)
+{
+       turnouts[addr];
+}
+
+void Dummy::set_turnout(unsigned addr, bool state)
+{
+       turnouts[addr] = state;
+       signal_turnout.emit(addr, state);
+}
+
+bool Dummy::get_turnout(unsigned addr) const
+{
+       map<unsigned, bool>::const_iterator i = turnouts.find(addr);
+       if(i!=turnouts.end())
+               return i->second;
+       return false;
+}
+
+} // namespace Marklin