diff options
author | Matthias P. Braendli (think) <matthias@mpb.li> | 2012-08-16 17:11:17 +0200 |
---|---|---|
committer | Matthias P. Braendli (think) <matthias@mpb.li> | 2012-08-16 17:11:17 +0200 |
commit | f419f8cb2e3768789cb23593cfa7c850acc0fe72 (patch) | |
tree | 57b37507d5175aae6b7a104af16dabf2a5fcbcb6 /src/testremotecontrol | |
parent | 2a4ec6dd6a48668589c7db2206c97e8781b644b3 (diff) | |
download | dabmod-f419f8cb2e3768789cb23593cfa7c850acc0fe72.tar.gz dabmod-f419f8cb2e3768789cb23593cfa7c850acc0fe72.tar.bz2 dabmod-f419f8cb2e3768789cb23593cfa7c850acc0fe72.zip |
crc-dabmod: RemoteControl cleanup
Diffstat (limited to 'src/testremotecontrol')
-rw-r--r-- | src/testremotecontrol/test.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/testremotecontrol/test.cpp b/src/testremotecontrol/test.cpp index 7733a96..84032fc 100644 --- a/src/testremotecontrol/test.cpp +++ b/src/testremotecontrol/test.cpp @@ -1,24 +1,38 @@ #include <string> +#include <map> #include <unistd.h> #include "RemoteControl.h" using namespace std; +#define BUILD_FOO(p) { \ + vector<string> p; \ + p.push_back(#p); \ + p.push_back("That's the" #p); \ + parameters_.push_back(p); \ +} + class TestControllable : public RemoteControllable { public: TestControllable(string name) { name_ = name; - parameterlist_.push_back("foo"); - parameterlist_.push_back("bar"); - parameterlist_.push_back("baz"); + + BUILD_FOO(foo); + BUILD_FOO(bar); + BUILD_FOO(baz); + } - std::string get_rc_name() { return name_; }; + string get_rc_name() { return name_; }; list<string> get_supported_parameters() { - return parameterlist_; + list<string> parameterlist; + for (list< vector<string> >::iterator it = parameters_.begin(); it != parameters_.end(); it++) { + parameterlist.push_back((*it)[0]); + } + return parameterlist; } void set_parameter(string parameter, string value) { @@ -81,12 +95,16 @@ class TestControllable : public RemoteControllable return ss.str(); } + std::list< std::vector<std::string> > get_parameter_descriptions() { + return parameters_; + } + private: long foo_; std::string bar_; std::string name_; double baz_; - std::list<std::string> parameterlist_; + std::list< std::vector<std::string> > parameters_; }; |