Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* Copyright 2019, LAAS-CNRS
*
* Olivier Stasse
*
* See LICENSE file
*
*/
#include <dynamic-graph/entity.h>
#include <dynamic-graph/exception-factory.h>
#include <dynamic-graph/factory.h>
#include <dynamic-graph/pool.h>
#include <dynamic-graph/tracer.h>
struct MyEntity : public dynamicgraph::Entity
{
static const std::string CLASS_NAME;
dynamicgraph::SignalPtr<double, int> m_sigdSIN;
dynamicgraph::SignalTimeDependent<double, int> m_sigdTimeDepSOUT;
MyEntity (const std::string& name)
: Entity (name)
,m_sigdSIN(NULL,"MyEntity("+name+")::input(double)::in_double")
,m_sigdTimeDepSOUT(boost::bind(&MyEntity::update,this,_1,_2),
m_sigdSIN,
"MyEntity("+name+")::input(double)::out_double")
{
signalRegistration(m_sigdSIN << m_sigdTimeDepSOUT);
}
virtual void display (std::ostream& os) const
{
os << "Hello! My name is " << getName () << " !" << std::endl;
}
virtual const std::string& getClassName () const
{
return CLASS_NAME;
}
double & update(double &res, const int &inTime)
{
const double &aDouble = m_sigdSIN(inTime);
res = aDouble;
return res;
}
};
BOOST_AUTO_TEST_CASE(test_tracer)
{
// Creates a tracer.
dynamicgraph::Entity& entity =
*dynamicgraph::FactoryStorage::getInstance()->newEntity("Tracer",
"my-tracer");
}