1 #ifndef LIBR2C2_CONTROLLER_H_
2 #define LIBR2C2_CONTROLLER_H_
5 #include <sigc++/signal.h>
6 #include <msp/time/timedelta.h>
11 Interface class for train controllers. Takes input through a uniform named
12 control interface. Provides information about train movement on output.
39 static Control binary(const std::string &);
40 static Control discrete(const std::string &, float, float, float);
41 static Control continuous(const std::string &, float, float);
44 sigc::signal<void, const Control &> signal_control_changed;
49 virtual ~Controller() { }
51 virtual const char *enumerate_controls(unsigned) const = 0;
52 virtual void set_control(const std::string &, float) = 0;
53 virtual const Control &get_control(const std::string &) const = 0;
55 /** Returns the current speed. Always non-negative. */
56 virtual float get_speed() const = 0;
58 /** Returns true if traveling in reverse. */
59 virtual bool get_reverse() const = 0;
61 /** Determines the distance required to come to a full stop. */
62 virtual float get_braking_distance() const = 0;
64 virtual void tick(const Msp::Time::TimeDelta &) = 0;