6 #ifndef DYNAMIC_GRAPH_SIGNAL_PTR_H
7 #define DYNAMIC_GRAPH_SIGNAL_PTR_H
9 #include <dynamic-graph/exception-signal.h>
10 #include <dynamic-graph/signal.h>
26 template <
class T,
class Time>
35 T *transmitAbstractData;
37 inline bool autoref()
const {
return signalPtr ==
this; }
44 abstractTransmitter(NULL) {}
46 virtual ~
SignalPtr() { signalPtr = NULL; }
54 virtual void unplug() { plug(NULL); }
56 virtual bool isPlugged()
const {
return (NULL != signalPtr); }
58 virtual const Time &getTime()
const;
65 inline operator bool()
const {
return isPlugged(); }
68 virtual bool needUpdate(
const Time &t)
const;
69 virtual std::ostream &writeGraph(std::ostream &os)
const;
70 virtual std::ostream &display(std::ostream &os)
const;
76 virtual const T &operator()(
const Time &t);
79 virtual const T &access(
const Time &t);
80 virtual const T &accessCopy()
const;
82 inline void setConstantDefault(
const T &t) {
86 virtual inline void setConstantDefault() { setConstantDefault(accessCopy()); }
87 inline void unsetConstantDefault() { modeNoThrow =
false; }
94 virtual void setConstant(
const T &t) {
98 virtual void setReference(
const T *t,
99 typename Signal<T, Time>::Mutex *m = NULL) {
103 virtual void setFunction(boost::function2<T &, T &, Time> t,
104 typename Signal<T, Time>::Mutex *m = NULL) {
119 virtual std::ostream &displayDependencies(std::ostream &os,
120 const int depth = -1,
121 std::string space =
"",
122 std::string next1 =
"",
123 std::string next2 =
"")
const;
127 virtual void addDependency() {}
129 virtual void removeDependency() {}
130 virtual void clearDependencies() {}
135 #include <dynamic-graph/signal-ptr.t.cpp>
The base class for signals: not to be used as such.
This is the only type of signal that can be plugged to, using the plug () command.
Signals link I/O ports of entities. They can be constant-valued signals, or copy the value of a heap ...