Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
* Copyright 2010, |
3 |
|
|
* Florent Lamiraux |
4 |
|
|
* |
5 |
|
|
* CNRS/AIST |
6 |
|
|
* |
7 |
|
|
*/ |
8 |
|
|
|
9 |
|
|
#ifndef VECTOR_CONSTANT_COMMAND_H |
10 |
|
|
#define VECTOR_CONSTANT_COMMAND_H |
11 |
|
|
|
12 |
|
|
#include <dynamic-graph/command-getter.h> |
13 |
|
|
#include <dynamic-graph/command-setter.h> |
14 |
|
|
#include <dynamic-graph/command.h> |
15 |
|
|
|
16 |
|
|
#include <boost/assign/list_of.hpp> |
17 |
|
|
|
18 |
|
|
namespace dynamicgraph { |
19 |
|
|
namespace sot { |
20 |
|
|
namespace command { |
21 |
|
|
namespace vectorConstant { |
22 |
|
|
using ::dynamicgraph::command::Command; |
23 |
|
|
using ::dynamicgraph::command::Value; |
24 |
|
|
|
25 |
|
|
// Command Resize |
26 |
|
|
class Resize : public Command { |
27 |
|
|
public: |
28 |
|
✗ |
virtual ~Resize() {} |
29 |
|
|
/// Create command and store it in Entity |
30 |
|
|
/// \param entity instance of Entity owning this command |
31 |
|
|
/// \param docstring documentation of the command |
32 |
|
✗ |
Resize(VectorConstant &entity, const std::string &docstring) |
33 |
|
✗ |
: Command(entity, boost::assign::list_of(Value::UNSIGNED), docstring) {} |
34 |
|
✗ |
virtual Value doExecute() { |
35 |
|
✗ |
VectorConstant &vc = static_cast<VectorConstant &>(owner()); |
36 |
|
✗ |
std::vector<Value> values = getParameterValues(); |
37 |
|
✗ |
unsigned size = values[0].value(); |
38 |
|
✗ |
Vector m(Vector::Zero(size)); |
39 |
|
✗ |
vc.SOUT.setConstant(m); |
40 |
|
|
|
41 |
|
|
// return void |
42 |
|
✗ |
return Value(); |
43 |
|
|
} |
44 |
|
|
}; // class Resize |
45 |
|
|
} // namespace vectorConstant |
46 |
|
|
} // namespace command |
47 |
|
|
} /* namespace sot */ |
48 |
|
|
} /* namespace dynamicgraph */ |
49 |
|
|
|
50 |
|
|
#endif // VECTOR_CONSTANT_COMMAND_H |
51 |
|
|
|