| Line |
Branch |
Exec |
Source |
| 1 |
|
|
/* |
| 2 |
|
|
* Copyright 2010, |
| 3 |
|
|
* François Bleibel, |
| 4 |
|
|
* Olivier Stasse, |
| 5 |
|
|
* |
| 6 |
|
|
* CNRS/AIST |
| 7 |
|
|
* |
| 8 |
|
|
*/ |
| 9 |
|
|
|
| 10 |
|
|
/* --------------------------------------------------------------------- */ |
| 11 |
|
|
/* --- INCLUDE --------------------------------------------------------- */ |
| 12 |
|
|
/* --------------------------------------------------------------------- */ |
| 13 |
|
|
|
| 14 |
|
|
/* --- SOT --- */ |
| 15 |
|
|
#include <dynamic-graph/pool.h> |
| 16 |
|
|
|
| 17 |
|
|
#include <sot/core/debug.hh> |
| 18 |
|
|
#include <sot/core/factory.hh> |
| 19 |
|
|
#include <sot/core/periodic-call-entity.hh> |
| 20 |
|
|
|
| 21 |
|
|
using namespace std; |
| 22 |
|
|
using namespace dynamicgraph::sot; |
| 23 |
|
|
|
| 24 |
|
✗ |
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(PeriodicCallEntity, "PeriodicCallEntity"); |
| 25 |
|
|
|
| 26 |
|
|
/* --------------------------------------------------------------------- */ |
| 27 |
|
|
/* --- CLASS ----------------------------------------------------------- */ |
| 28 |
|
|
/* --------------------------------------------------------------------- */ |
| 29 |
|
|
|
| 30 |
|
✗ |
PeriodicCallEntity::PeriodicCallEntity(const string &fName) |
| 31 |
|
|
: Entity(fName), |
| 32 |
|
|
PeriodicCall(), |
| 33 |
|
✗ |
triger("Tracer(" + fName + ")::triger"), |
| 34 |
|
✗ |
trigerOnce("Tracer(" + fName + ")::trigerOnce") { |
| 35 |
|
✗ |
signalRegistration(triger << trigerOnce); |
| 36 |
|
|
|
| 37 |
|
✗ |
triger.setFunction( |
| 38 |
|
|
boost::bind(&PeriodicCallEntity::trigerCall, this, _1, _2)); |
| 39 |
|
✗ |
trigerOnce.setFunction( |
| 40 |
|
|
boost::bind(&PeriodicCallEntity::trigerOnceCall, this, _1, _2)); |
| 41 |
|
|
} |
| 42 |
|
|
|
| 43 |
|
✗ |
int &PeriodicCallEntity::trigerCall(int &dummy, const int &time) { |
| 44 |
|
✗ |
run(time); |
| 45 |
|
✗ |
return dummy; |
| 46 |
|
|
} |
| 47 |
|
✗ |
int &PeriodicCallEntity::trigerOnceCall(int &dummy, const int &time) { |
| 48 |
|
✗ |
run(time); |
| 49 |
|
✗ |
clear(); |
| 50 |
|
✗ |
return dummy; |
| 51 |
|
|
} |
| 52 |
|
|
|
| 53 |
|
|
/* --------------------------------------------------------------------- */ |
| 54 |
|
|
/* --------------------------------------------------------------------- */ |
| 55 |
|
|
/* --------------------------------------------------------------------- */ |
| 56 |
|
|
|
| 57 |
|
✗ |
void PeriodicCallEntity::display(std::ostream &os) const { |
| 58 |
|
✗ |
os << "PeriodicCallEntity <" << name << "> "; |
| 59 |
|
✗ |
PeriodicCall::display(os); |
| 60 |
|
|
} |
| 61 |
|
|
|