binary-int-to-uint.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2010,
3  * François Bleibel,
4  * Olivier Stasse,
5  *
6  * CNRS/AIST
7  *
8  */
9 
10 /* --- SOT --- */
12 #include <sot/core/debug.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 
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") {
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 }
void signalRegistration(const SignalArray< int > &signals)
#define sotDEBUGOUT(level)
Definition: debug.hh:212
dynamicgraph::SignalTimeDependent< unsigned, int > binaryUintSOUT
virtual void display(std::ostream &os) const
#define sotDEBUGIN(level)
Definition: debug.hh:211
virtual unsigned & computeOutput(unsigned &res, int time)
virtual const T & access(const Time &t)
dynamicgraph::SignalPtr< int, int > binaryIntSIN
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(BinaryIntToUint, "BinaryIntToUint")


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Wed Jun 21 2023 02:51:26