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, sigtime_t 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 }
dynamicgraph
dynamicgraph::Entity
boost
dynamicgraph::Entity::name
std::string name
debug.hh
res
res
dynamicgraph::SignalPtr::access
virtual const T & access(const Time &t)
sotDEBUGOUT
#define sotDEBUGOUT(level)
Definition: debug.hh:215
dynamicgraph::sot::BinaryIntToUint::display
virtual void display(std::ostream &os) const
Definition: binary-int-to-uint.cpp:56
dynamicgraph::sigtime_t
int64_t sigtime_t
sotDEBUGIN
#define sotDEBUGIN(level)
Definition: debug.hh:214
dynamicgraph::sot::BinaryIntToUint::binaryUintSOUT
dynamicgraph::SignalTimeDependent< unsigned, sigtime_t > binaryUintSOUT
Definition: binary-int-to-uint.hh:48
exception-feature.hh
pool.hh
dynamicgraph::sot
binary-int-to-uint.hh
dynamicgraph::sot::BinaryIntToUint::binaryIntSIN
dynamicgraph::SignalPtr< int, sigtime_t > binaryIntSIN
Definition: binary-int-to-uint.hh:47
dynamicgraph::sot::BinaryIntToUint::computeOutput
virtual unsigned int & computeOutput(unsigned int &res, sigtime_t time)
Definition: binary-int-to-uint.cpp:42
dynamicgraph::sot::BinaryIntToUint
Definition: binary-int-to-uint.hh:40
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(BinaryIntToUint, "BinaryIntToUint")
dynamicgraph::Entity::signalRegistration
void signalRegistration(const SignalArray< sigtime_t > &signals)
compile.name
name
Definition: compile.py:23


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Tue Oct 24 2023 02:26:31