GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: src/tools/binary-int-to-uint.cpp Lines: 0 13 0.0 %
Date: 2023-03-13 12:09:37 Branches: 0 26 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
/* --- SOT --- */
11
#include <sot/core/binary-int-to-uint.hh>
12
#include <sot/core/debug.hh>
13
#include <sot/core/exception-feature.hh>
14
#include <sot/core/pool.hh>
15
using namespace std;
16
17
#include <dynamic-graph/factory.h>
18
19
using namespace dynamicgraph::sot;
20
using namespace dynamicgraph;
21
22
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(BinaryIntToUint, "BinaryIntToUint");
23
24
/* --------------------------------------------------------------------- */
25
/* --- CLASS ----------------------------------------------------------- */
26
/* --------------------------------------------------------------------- */
27
28
BinaryIntToUint::BinaryIntToUint(const string &fname)
29
    : Entity(fname),
30
      binaryIntSIN(NULL, "BinaryIntToUint(" + name + ")::input(int)::sin"),
31
      binaryUintSOUT(
32
          boost::bind(&BinaryIntToUint::computeOutput, this, _1, _2),
33
          binaryIntSIN,
34
          "BinaryIntToUint(" + name + ")::output(unsigned int)::sout") {
35
  signalRegistration(binaryIntSIN << binaryUintSOUT);
36
}
37
38
/* --------------------------------------------------------------------- */
39
/* --------------------------------------------------------------------- */
40
/* --------------------------------------------------------------------- */
41
42
unsigned &BinaryIntToUint::computeOutput(unsigned &res, int time) {
43
  sotDEBUGIN(15);
44
45
  int in = binaryIntSIN.access(time);
46
  if (in < 0) {
47
    res = 0;
48
  } else {
49
    res = 1;
50
  }
51
52
  sotDEBUGOUT(15);
53
  return res;
54
}
55
56
void BinaryIntToUint::display(std::ostream &os) const {
57
  os << "BinaryIntToUint <" << name << "> TODO..." << endl;
58
}