]> git.tdb.fi Git - r2c2.git/blob - source/libmarklin/controlmodel.h
Handle reversing in a way that allows backing out of a dead end
[r2c2.git] / source / libmarklin / controlmodel.h
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 #ifndef LIBMARKLIN_CONTROLMODEL_H_
9 #define LIBMARKLIN_CONTROLMODEL_H_
10
11 #include <string>
12 #include <sigc++/signal.h>
13 #include <msp/time/timedelta.h>
14
15 namespace Marklin {
16
17 class TrainControl;
18
19 class ControlModel
20 {
21 public:
22         sigc::signal<void, const std::string &, float> signal_control_changed;
23
24 protected:
25         ControlModel() { }
26 public:
27         virtual ~ControlModel() { }
28
29         virtual void set_control(const std::string &, float) = 0;
30         virtual const TrainControl &get_control(const std::string &) const = 0;
31
32         virtual float get_speed() const = 0;
33         virtual bool get_reverse() const = 0;
34         virtual float get_braking_distance() const = 0;
35
36         virtual void tick(const Msp::Time::TimeDelta &) = 0;
37 };
38
39 } // namespace Marklin
40
41 #endif