6 #ifndef DYNAMIC_GRAPH_SIGNAL_T_CPP 7 #define DYNAMIC_GRAPH_SIGNAL_T_CPP 11 #undef VP_TEMPLATE_DEBUG_MODE 12 #define VP_TEMPLATE_DEBUG_MODE 0 15 #define __SIGNAL_INIT(name, Tcpy, Tref, TrefNC, mutex) \ 16 SignalBase<Time>(name), signalType(SIGNAL_TYPE_DEFAULT), Tcopy1(Tcpy), \ 17 Tcopy2(Tcpy), Tcopy(&Tcopy1), Treference(Tref), \ 18 TreferenceNonConst(TrefNC), Tfunction(), \ 19 keepReference(KEEP_REFERENCE_DEFAULT), providerMutex(mutex) 23 template <
class T,
class Time>
31 template <
class T,
class Time>
36 template <
class T,
class Time>
41 template <
class T,
class Time>
47 "TRACE operation not possible with this signal. ",
48 "(bad cast while getting value from %s).",
55 template <
class T,
class Time>
57 if (Tcopy == &Tcopy1) {
70 template <
class T,
class Time>
78 template <
class T,
class Time>
86 template <
class T,
class Time>
88 if (Tcopy == &Tcopy1) {
97 template <
class T,
class Time>
99 signalType = CONSTANT;
104 template <
class T,
class Time>
106 signalType = REFERENCE;
108 providerMutex = mutexref;
113 template <
class T,
class Time>
115 signalType = REFERENCE_NON_CONST;
117 TreferenceNonConst = t;
118 providerMutex = mutexref;
123 template <
class T,
class Time>
126 signalType = FUNCTION;
128 providerMutex = mutexref;
133 template <
class T,
class Time>
138 template <
class T,
class Time>
140 switch (signalType) {
142 case REFERENCE_NON_CONST: {
143 if (NULL == providerMutex) {
146 return setTcopy(*Treference);
149 #ifdef HAVE_LIBBOOST_THREAD 150 boost::try_mutex::scoped_try_lock lock(*providerMutex);
154 return setTcopy(*Treference);
164 if (NULL == providerMutex) {
166 Tfunction(getTwork(), t);
168 return switchTcopy();
171 #ifdef HAVE_LIBBOOST_THREAD 172 boost::try_mutex::scoped_try_lock lock(*providerMutex);
175 Tfunction(getTwork(), t);
177 return switchTcopy();
186 if (this->getReady()) {
194 template <
class T,
class Time>
196 if (keepReference && (REFERENCE_NON_CONST == signalType) &&
197 (NULL != TreferenceNonConst)) {
198 if (NULL == providerMutex) {
200 (*TreferenceNonConst) = t;
203 #ifdef HAVE_LIBBOOST_THREAD 204 boost::try_mutex::scoped_try_lock lock(*providerMutex);
207 (*TreferenceNonConst) = t;
217 template <
class T,
class Time>
219 os <<
"Sig:" << this->
name <<
" (Type ";
220 switch (this->signalType) {
Class used for I/O operations in Signal<T,Time>
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.
The base class for signals: not to be used as such.
#define __SIGNAL_INIT(name, Tcpy, Tref, TrefNC, mutex)