@@ -45,24 +45,32 @@ namespace dynamicgraph {
45
45
46
46
public: /* --- SIGNAL --- */
47
47
DYNAMIC_GRAPH_ENTITY_DECL ();
48
- dynamicgraph::Signal<bool ,int > outSOUT;
48
+ Signal<bool ,int > outSOUT;
49
+ Signal<bool ,int > turnOnSOUT;
50
+ Signal<bool ,int > turnOffSOUT;
49
51
50
52
protected:
51
53
bool signalOutput;
52
54
void turnOn (){ signalOutput = true ; }
55
+ bool & turnOnSwitch (bool & res, int ){ res = signalOutput = true ; return res; }
53
56
54
57
void turnOff (){ signalOutput = false ; }
58
+ bool & turnOffSwitch (bool & res, int ){ res = signalOutput = false ; return res; }
55
59
56
60
bool & switchOutput (bool & res, int ){ res = signalOutput; return res; }
57
61
58
62
public:
59
63
Switch ( const std::string& name )
60
64
: Entity(name)
61
65
,outSOUT(" Switch(" +name+" )::output(bool)::out" )
66
+ ,turnOnSOUT (" Switch(" +name+" )::output(bool)::turnOnSout" )
67
+ ,turnOffSOUT(" Switch(" +name+" )::output(bool)::turnOffSout" )
62
68
{
63
69
outSOUT.setFunction (boost::bind (&Switch::switchOutput,this ,_1,_2));
70
+ turnOnSOUT .setFunction (boost::bind (&Switch::turnOnSwitch ,this ,_1,_2));
71
+ turnOffSOUT.setFunction (boost::bind (&Switch::turnOffSwitch,this ,_1,_2));
64
72
signalOutput = false ;
65
- signalRegistration (outSOUT );
73
+ signalRegistration (outSOUT << turnOnSOUT << turnOffSOUT );
66
74
addCommand (" turnOn" ,
67
75
makeCommandVoid0 (*this , &Switch::turnOn,
68
76
docCommandVoid0 (" Turn on the switch" )));
0 commit comments