test_signal.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 /* -------------------------------------------------------------------------- */
11 /* --- INCLUDES ------------------------------------------------------------- */
12 /* -------------------------------------------------------------------------- */
15 
16 #include <iostream>
17 using namespace std;
18 using namespace dynamicgraph;
19 
20 class DummyClass {
21  public:
23  res.resize(3);
24  res.fill(j);
25  return res;
26  }
27 };
28 
32 
34  return res = test_data;
35 }
36 
37 int main(void) {
38  test_data.fill(1);
39  cout << "test_data: " << test_data << endl;
40 
41  sig.setConstant(test_data);
42  cout << "Constant: " << sig.access(1.) << endl;
43  test_data *= 2;
44  cout << "Constant: " << sig(1.) << endl;
45 
46  sig.setReference(&test_data);
47  cout << "Reference: " << sig(1.) << endl;
48  test_data *= 2;
49  cout << "Reference: " << sig(1.) << endl;
50 
51  sig.setFunction(&fun);
52  cout << "Function: " << sig(1.) << endl;
53  test_data *= 2;
54  cout << "Function: " << sig(1.) << endl;
55 
56  // boost::function2<int,int,double> onClick = (&DummyClass::fun, &dummy,
57  // _1,_2) ; boost::function<> onClick = boost::bind(&DummyClass::fun,
58  // &dummy);
59  sig.setFunction(boost::bind(&DummyClass::fun, &dummy, _1, _2));
60  cout << "Function: " << sig(1.5) << endl;
61  test_data *= 2;
62  cout << "Function: " << sig(1.34) << endl;
63 
64  // sig.setFunction(&DummyClass::fun, dummy);
65  // cout << "Function: " << sig(1.5) <<endl;
66  // test_data*=2;
67  // cout << "Function: " << sig(12.34) <<endl;
68 
69  return 0;
70 }
Eigen::VectorXd Vector
T & fun(T &res, int t)
dynamicgraph::Vector test_data(6)
int main(void)
Definition: test_signal.cpp:37
Signal< dynamicgraph::Vector, double > sig("sigtest")
DummyClass dummy
Definition: test_signal.cpp:31
dynamicgraph::Vector & fun(dynamicgraph::Vector &res, double)
Definition: test_signal.cpp:33


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