GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: src/matrix/matrix-constant.cpp Lines: 0 13 0.0 %
Date: 2023-03-13 12:09:37 Branches: 0 32 0.0 %

Line Branch Exec Source
1
/*
2
 * Copyright 2010,
3
 * François Bleibel,
4
 * Olivier Stasse,
5
 *
6
 * CNRS/AIST
7
 *
8
 */
9
10
#include <sot/core/factory.hh>
11
#include <sot/core/matrix-constant.hh>
12
13
#include "../src/matrix/matrix-constant-command.h"
14
15
using namespace std;
16
using namespace dynamicgraph::sot;
17
using namespace dynamicgraph;
18
19
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(MatrixConstant, "MatrixConstant");
20
21
/* --------------------------------------------------------------------- */
22
/* --- MATRIX ---------------------------------------------------------- */
23
/* --------------------------------------------------------------------- */
24
25
MatrixConstant::MatrixConstant(const std::string &name)
26
    : Entity(name),
27
      rows(0),
28
      cols(0),
29
      SOUT("sotMatrixConstant(" + name + ")::output(matrix)::sout") {
30
  SOUT.setDependencyType(TimeDependency<int>::BOOL_DEPENDENT);
31
  signalRegistration(SOUT);
32
  //
33
  // Commands
34
35
  // Resize
36
  std::string docstring;
37
  docstring =
38
      "    \n"
39
      "    Resize the matrix and set it to zero.\n"
40
      "      Input\n"
41
      "        - unsigned int: number of lines.\n"
42
      "        - unsigned int: number of columns.\n"
43
      "\n";
44
  addCommand("resize", new command::matrixConstant::Resize(*this, docstring));
45
  // set
46
  docstring =
47
      "    \n"
48
      "    Set value of output signal\n"
49
      "    \n"
50
      "      input:\n"
51
      "        - a matrix\n"
52
      "    \n";
53
  addCommand(
54
      "set",
55
      new ::dynamicgraph::command::Setter<MatrixConstant, dynamicgraph::Matrix>(
56
          *this, &MatrixConstant::setValue, docstring));
57
}
58
59
void MatrixConstant::setValue(const dynamicgraph::Matrix &inValue) {
60
  SOUT.setConstant(inValue);
61
}