6 #ifndef DYNAMIC_GRAPH_SIGNAL_PTR_T_CPP 7 #define DYNAMIC_GRAPH_SIGNAL_PTR_T_CPP 10 #undef VP_TEMPLATE_DEBUG_MODE 11 #define VP_TEMPLATE_DEBUG_MODE 0 15 template <
class T,
class Time>
17 return ((NULL != signalPtr) || (abstractTransmitter));
20 template <
class T,
class Time>
25 "In SignalPtr: SIN ptr not set.",
" (in signal <%s>)",
31 template <
class T,
class Time>
34 <<
"->" << signalPtr << std::endl;
38 "In SignalPtr: SIN ptr not set.",
39 " (in signal <%s>)", getName().c_str());
45 template <
class T,
class Time>
47 if (!isAbstractPluged()) {
49 "In SignalPtr: SIN ptr not set.",
50 " (in signal <%s>)", getName().c_str());
52 if (NULL != signalPtr)
55 return abstractTransmitter;
58 template <
class T,
class Time>
60 if (!isAbstractPluged()) {
62 "In SignalPtr: SIN ptr not set.",
63 " (in signal <%s>)", getName().c_str());
65 if (NULL != signalPtr)
68 return abstractTransmitter;
71 template <
class T,
class Time>
76 transmitAbstract =
false;
81 dgTDEBUG(5) <<
"# In T = " << getName() <<
" =" 89 dgTDEBUG(25) <<
"Cast THROW ok." << std::endl;
91 transmitAbstract =
true;
92 abstractTransmitter = unknown_ref;
93 transmitAbstractData = t;
95 dgTDEBUG(25) <<
"Fatal error." << std::endl;
96 transmitAbstract =
false;
98 "Compl. Uncompatible types for plugin.",
99 "(while trying to plug <%s> on <%s>)" 100 " with types <%s> on <%s>.",
101 unknown_ref->
getName().c_str(),
102 this->getName().c_str(),
typeid(T).
name(),
103 typeid(unknown_ref).
name());
106 dgTDEBUG(25) <<
"Cast ok." << std::endl;
107 transmitAbstract =
false;
113 template <
class T,
class Time>
115 if (isPlugged() && (!autoref())) {
116 getPtr()->checkCompatibility();
117 }
else if (isAbstractPluged() && (!autoref())) {
118 abstractTransmitter->checkCompatibility();
123 template <
class T,
class Time>
125 if ((isAbstractPluged()) && (!autoref())) {
126 return getAbstractPtr()->needUpdate(t);
131 template <
class T,
class Time>
133 if ((isAbstractPluged()) && (!autoref())) {
134 return getAbstractPtr()->getTime();
139 template <
class T,
class Time>
144 template <
class T,
class Time>
150 }
else if (autoref()) {
153 }
else if (transmitAbstract) {
154 abstractTransmitter->recompute(t);
156 return *transmitAbstractData;
159 return getPtr()->access(t);
163 template <
class T,
class Time>
169 else if (transmitAbstract)
170 return *transmitAbstractData;
172 return getPtr()->accessCopy();
174 template <
class T,
class Time>
176 std::string LeaderLocalName;
177 std::string LeaderNodeName;
179 if (isAbstractPluged() && !autoref()) {
180 std::string itLocalName, itNodeName;
181 getAbstractPtr()->ExtractNodeAndLocalNames(itLocalName, itNodeName);
182 os <<
"\t\"" << itNodeName <<
"\" -> \"" << LeaderNodeName <<
"\"" 184 <<
"\t [ headlabel = \"" << LeaderLocalName <<
"\" , taillabel = \"" 185 << itLocalName <<
"\", fontsize=7, fontcolor=red ]" << std::endl;
190 template <
class T,
class Time>
193 <<
"||" << signalPtr;
196 if ((isAbstractPluged()) && (!autoref())) {
197 os <<
" -->-- PLUGGED";
199 if (!isAbstractPluged())
202 os <<
" AUTOPLUGGED";
209 template <
class T,
class Time>
214 std::string next2)
const {
216 if ((isAbstractPluged()) && (!autoref())) {
217 getAbstractPtr()->displayDependencies(
#define dgTDEBUGOUT(level)
virtual void ExtractNodeAndLocalNames(std::string &LocalName, std::string &NodeName) const
virtual std::ostream & display(std::ostream &os) const
virtual bool isAbstractPluged() const
virtual std::ostream & displayDependencies(std::ostream &os, const int depth=-1, std::string space="", std::string next1="", std::string next2="") const
Signals link I/O ports of entities. They can be constant-valued signals, or copy the value of a heap ...
Exceptions raised when an error related to signals happen.
#define dgTDEBUGIN(level)
const std::string & getName() const
virtual std::ostream & writeGraph(std::ostream &os) const
virtual void plug(SignalBase< Time > *ref)
virtual void checkCompatibility()
virtual void checkCompatibility()
virtual const T & access(const Time &t)
The base class for signals: not to be used as such.
virtual void checkCompatibility()
virtual const Time & getTime() const
virtual const T & operator()(const Time &t)
virtual const T & accessCopy() const
SignalBase< Time > * getAbstractPtr()
virtual bool needUpdate(const Time &) const
virtual std::ostream & display(std::ostream &os) const
virtual const T & accessCopy() const
virtual const Time & getTime() const
virtual bool needUpdate(const Time &t) const
Signal< T, Time > * getPtr()
virtual std::ostream & displayDependencies(std::ostream &os, const int=-1, std::string space="", std::string next1="", std::string="") const
virtual const T & access(const Time &t)
virtual void setReference(const T *t, Mutex *mutexref=NULL)