signal-ptr.cpp 1.14 KB
Newer Older
Nicolas Mansard's avatar
ivigit.  
Nicolas Mansard committed
1
2
3
4
5
6
7
8
9
10
11
12
13
// Copyright 2010 Thomas Moulard.
//

#include <string>

#include <dynamic-graph/debug.h>
#include <dynamic-graph/entity.h>
#include <dynamic-graph/factory.h>
#include <dynamic-graph/signal-ptr.h>
#include <dynamic-graph/signal.h>
#include <dynamic-graph/pool.h>
#include <iostream>

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
#define BOOST_TEST_MODULE signal_ptr


#include <boost/test/unit_test.hpp>
#include <boost/test/output_test_stream.hpp>

using boost::test_tools::output_test_stream;

typedef dynamicgraph::SignalPtr<double, int> sigDouble_t;

template<class T>
class DummyClass
{
public:

    std::string proname;










Nicolas Mansard's avatar
ivigit.  
Nicolas Mansard committed
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61

int main( void )
{
  using namespace dynamicgraph;
  using std::cout;

  Signal<double,int> sig("sig");
  SignalPtr<double,int> sigPtrA(NULL,"sigPtrA"),sigPtrB(NULL,"sigPtrB");

  sig.setConstant( 1.56 );

  SignalBase<int> & sigRef = sig;
  SignalBase<int> & sigPtrARef = sigPtrA, & sigPtrBRef = sigPtrB;
  sigPtrARef.plug( & sigRef );
  sigPtrBRef.plug( & sigPtrARef );

  cout << "Sig = ";  sigRef.get(cout); cout << std::endl;
  cout << "SigPtrA = ";  sigPtrARef.get(cout); cout << std::endl;
  cout << "SigPtrB = ";  sigPtrBRef.get(cout); cout << std::endl;

  return 0;
}
62
63