X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibmarklin%2Fcontroller.h;h=ac5128bcd0e724505a90dc4f923b0ce29af2caae;hb=9b05c573a38639827697fe393d55b7c76f5bde45;hp=b8075482ebf83f71a3428fc44eb3be1322dde57e;hpb=2571c111ec85b0d6a56ae369c83b5763b1975f93;p=r2c2.git diff --git a/source/libmarklin/controller.h b/source/libmarklin/controller.h index b807548..ac5128b 100644 --- a/source/libmarklin/controller.h +++ b/source/libmarklin/controller.h @@ -14,8 +14,6 @@ Distributed under the GPL namespace Marklin { -struct TrainControl; - /** Interface class for train controllers. Takes input through a uniform named control interface. Provides information about train movement on output. @@ -23,7 +21,34 @@ control interface. Provides information about train movement on output. class Controller { public: - sigc::signal signal_control_changed; + struct Control + { + enum Type + { + BINARY, + DISCRETE, + CONTINUOUS + }; + + std::string name; + Type type; + float min_value; + float max_value; + float step; + float value; + + private: + Control() { } + + public: + void set(float); + + static Control binary(const std::string &); + static Control discrete(const std::string &, float, float, float); + static Control continuous(const std::string &, float, float); + }; + + sigc::signal signal_control_changed; protected: Controller() { } @@ -31,7 +56,7 @@ public: virtual ~Controller() { } virtual void set_control(const std::string &, float) = 0; - virtual const TrainControl &get_control(const std::string &) const = 0; + virtual const Control &get_control(const std::string &) const = 0; /** Returns the current speed. Always non-negative. */ virtual float get_speed() const = 0;