3 This file is part of the MSP Märklin suite
4 Copyright © 2010 Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
8 #ifndef LIBMARKLIN_CONTROLMODEL_H_
9 #define LIBMARKLIN_CONTROLMODEL_H_
12 #include <sigc++/signal.h>
13 #include <msp/time/timedelta.h>
20 Interface class for train control models. Takes input through a uniform named
21 control interface. Provides information about train movement on output.
26 sigc::signal<void, const TrainControl &> signal_control_changed;
31 virtual ~ControlModel() { }
33 virtual void set_control(const std::string &, float) = 0;
34 virtual const TrainControl &get_control(const std::string &) const = 0;
36 /** Returns the current speed. Always non-negative. */
37 virtual float get_speed() const = 0;
39 /** Returns true if traveling in reverse. */
40 virtual bool get_reverse() const = 0;
42 /** Determines the distance required to come to a full stop. */
43 virtual float get_braking_distance() const = 0;
45 virtual void tick(const Msp::Time::TimeDelta &) = 0;
48 } // namespace Marklin