X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fdriver.h;h=a0e5cc434405a194e56099bd5e3f63dd7512e8b4;hb=145ba6391812e2b1040a78a8f0fda5888bfea610;hp=7c762d0066b4b9b668030edb0e53dec09d0ebf50;hpb=77f1712e7f8913af3ce33efc0e1e4ebbe0e5f93a;p=r2c2.git diff --git a/source/libr2c2/driver.h b/source/libr2c2/driver.h index 7c762d0..a0e5cc4 100644 --- a/source/libr2c2/driver.h +++ b/source/libr2c2/driver.h @@ -1,8 +1,10 @@ #ifndef LIBR2C2_DRIVER_H_ #define LIBR2C2_DRIVER_H_ +#include #include #include +#include namespace R2C2 { @@ -13,6 +15,29 @@ class VehicleType; class Driver { public: + class Options + { + private: + typedef std::map OptionMap; + + OptionMap opts; + + public: + Options() { } + Options(const std::string &); + + void set(const std::string &, const std::string &); + + template + T get(const std::string &k, const T &d = T()) const + { + OptionMap::const_iterator i = opts.find(k); + if(i==opts.end()) + return d; + return Msp::lexical_cast(i->second); + } + }; + struct DetectedLocomotive { std::string protocol; @@ -27,6 +52,7 @@ public: sigc::signal signal_loco_speed; sigc::signal signal_loco_function; sigc::signal signal_turnout; + sigc::signal signal_turnout_failed; sigc::signal signal_signal; sigc::signal signal_sensor;