GCC Code Coverage Report


Directory: ./
File: src/matrix/matrix-constant-command.h
Date: 2024-11-13 12:35:17
Exec Total Coverage
Lines: 0 13 0.0%
Branches: 0 30 0.0%

Line Branch Exec Source
1 /*
2 * Copyright 2010,
3 * Florent Lamiraux
4 *
5 * CNRS/AIST
6 *
7 */
8
9 #ifndef MATRIX_CONSTANT_COMMAND_H
10 #define MATRIX_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 matrixConstant {
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(MatrixConstant &entity, const std::string &docstring)
33 : Command(entity,
34 boost::assign::list_of(Value::UNSIGNED)(Value::UNSIGNED),
35 docstring) {}
36 virtual Value doExecute() {
37 MatrixConstant &mc = static_cast<MatrixConstant &>(owner());
38 std::vector<Value> values = getParameterValues();
39 unsigned rows = values[0].value();
40 unsigned cols = values[1].value();
41 Matrix m(Matrix::Zero(rows, cols));
42 mc.SOUT.setConstant(m);
43
44 // return void
45 return Value();
46 }
47 }; // class Resize
48 } // namespace matrixConstant
49 } // namespace command
50 } // namespace sot
51 } // namespace dynamicgraph
52
53 #endif // MATRIX_CONSTANT_COMMAND_H
54