summaryrefslogtreecommitdiffstats
path: root/src/testremotecontrol
diff options
context:
space:
mode:
authorMatthias P. Braendli (think) <matthias@mpb.li>2012-08-16 18:05:40 +0200
committerMatthias P. Braendli (think) <matthias@mpb.li>2012-08-16 18:05:40 +0200
commitb946ff6bceef6150f19da0a86950ed9ebbf0c2cb (patch)
tree6987a458cdb324a0155f7f8d36fc1ecc0d336bb3 /src/testremotecontrol
parent521ee81560be5d065bd090002a2c6b92a322a034 (diff)
downloaddabmod-b946ff6bceef6150f19da0a86950ed9ebbf0c2cb.tar.gz
dabmod-b946ff6bceef6150f19da0a86950ed9ebbf0c2cb.tar.bz2
dabmod-b946ff6bceef6150f19da0a86950ed9ebbf0c2cb.zip
crc-dabmod: removed useless set_parameters from remote_control
Diffstat (limited to 'src/testremotecontrol')
-rw-r--r--src/testremotecontrol/test.cpp41
1 files changed, 8 insertions, 33 deletions
diff --git a/src/testremotecontrol/test.cpp b/src/testremotecontrol/test.cpp
index 07b761f..40f0e25 100644
--- a/src/testremotecontrol/test.cpp
+++ b/src/testremotecontrol/test.cpp
@@ -1,6 +1,7 @@
#include <string>
#include <map>
#include <unistd.h>
+
#include "RemoteControl.h"
using namespace std;
@@ -10,23 +11,22 @@ class TestControllable : public RemoteControllable
public:
TestControllable(string name) : RemoteControllable(name)
{
- ADD_PARAMETER(foo, "That's the foo");
- ADD_PARAMETER(bar, "That's the bar");
- ADD_PARAMETER(baz, "That's the baz");
+ RC_ADD_PARAMETER(foo, "That's the foo");
+ RC_ADD_PARAMETER(bar, "That's the bar");
+ RC_ADD_PARAMETER(baz, "That's the baz");
}
- string get_rc_name() { return name_; };
-
void set_parameter(string parameter, string value) {
+ stringstream ss(value);
+ ss.exceptions ( stringstream::failbit | stringstream::badbit );
+
if (parameter == "foo") {
- stringstream ss(value);
ss >> foo_;
}
else if (parameter == "bar") {
bar_ = value;
}
else if (parameter == "baz") {
- stringstream ss(value);
ss >> baz_;
}
else {
@@ -36,30 +36,9 @@ class TestControllable : public RemoteControllable
}
}
- void set_parameter(string parameter, double value) {
- if (parameter == "baz") {
- baz_ = value;
- }
- else {
- stringstream ss;
- ss << "Parameter '" << parameter << "' is not a double in controllable " << get_rc_name();
- throw ParameterError(ss.str());
- }
- }
-
- void set_parameter(string parameter, long value) {
- if (parameter == "foo") {
- foo_ = value;
- }
- else {
- stringstream ss;
- ss << "Parameter '" << parameter << "' is not a long in controllable " << get_rc_name();
- throw ParameterError(ss.str());
- }
- }
-
string get_parameter(string parameter) {
stringstream ss;
+
if (parameter == "foo") {
ss << foo_;
}
@@ -77,10 +56,6 @@ class TestControllable : public RemoteControllable
return ss.str();
}
- std::list< std::vector<std::string> > get_parameter_descriptions() {
- return parameters_;
- }
-
private:
long foo_;
std::string bar_;