Skip to content
Snippets Groups Projects
Commit ea428009 authored by Florent Lamiraux's avatar Florent Lamiraux Committed by Florent Lamiraux
Browse files

[Command] Implement setter command for int64_t.

parent 45354a8b
No related branches found
No related tags found
No related merge requests found
...@@ -120,6 +120,40 @@ Value Setter<E, int>::doExecute() { ...@@ -120,6 +120,40 @@ Value Setter<E, int>::doExecute() {
return Value(); return Value();
} }
//
// Template specialization: int64_t
//
template <class E>
class Setter<E, int64_t> : public Command {
public:
/// Pointer to method that sets parameter of type int64_t
typedef void (E::*SetterMethod)(const int64_t &);
/// Constructor
Setter(E &entity, SetterMethod setterMethod, const std::string &docString);
protected:
virtual Value doExecute();
private:
SetterMethod setterMethod_;
}; // Class Setter
template <class E>
Setter<E, int64_t>::Setter(E &entity, SetterMethod setterMethod,
const std::string &docString)
: Command(entity, boost::assign::list_of(Value::LONGINT), docString),
setterMethod_(setterMethod) {}
template <class E>
Value Setter<E, int64_t>::doExecute() {
const std::vector<Value> &values = getParameterValues();
// Get parameter
int64_t value = values[0].value();
E &entity = static_cast<E &>(owner());
(entity.*setterMethod_)(value);
return Value();
}
// //
// Template specialization: float // Template specialization: float
// //
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment