#ifndef LIBR2C2_DRIVER_H_
#define LIBR2C2_DRIVER_H_
+#include <map>
#include <string>
#include <sigc++/signal.h>
+#include <msp/strings/lexicalcast.h>
namespace R2C2 {
class Driver
{
public:
+ class Options
+ {
+ private:
+ typedef std::map<std::string, std::string> OptionMap;
+
+ OptionMap opts;
+
+ public:
+ Options() { }
+ Options(const std::string &);
+
+ void set(const std::string &, const std::string &);
+
+ template<typename T>
+ 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<T>(i->second);
+ }
+ };
+
struct DetectedLocomotive
{
std::string protocol;
sigc::signal<void, unsigned, unsigned, bool> signal_loco_speed;
sigc::signal<void, unsigned, unsigned, bool> signal_loco_function;
sigc::signal<void, unsigned, unsigned> signal_turnout;
+ sigc::signal<void, unsigned> signal_turnout_failed;
sigc::signal<void, unsigned, unsigned> signal_signal;
sigc::signal<void, unsigned, bool> signal_sensor;