X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fdriver.h;h=1222540c0b81e19bff985870c730124d2ea16b2f;hb=2c08ce7d004b20a1cd9bc68fccbf734a6ba2d242;hp=7c762d0066b4b9b668030edb0e53dec09d0ebf50;hpb=269b667175f68821a3f2b871a097d4899d7abd78;p=r2c2.git diff --git a/source/libr2c2/driver.h b/source/libr2c2/driver.h index 7c762d0..1222540 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;