6 #ifndef DYNAMIC_GRAPH_TIME_DEPENDENCY_T_CPP 7 #define DYNAMIC_GRAPH_TIME_DEPENDENCY_T_CPP 10 #undef VP_TEMPLATE_DEBUG_MODE 11 #define VP_TEMPLATE_DEBUG_MODE 0 14 #define __TIME_DEPENDENCY_INIT(sig, dep) \ 15 leader(*sig), dependencies(), updateFromAllChildren(ALL_READY_DEFAULT), \ 16 dependencyType(dep), periodTime(PERIOD_TIME_DEFAULT) 21 const DependencyType dep)
27 const DependencyType dep)
37 for (
unsigned int i = 0; i < ar.
getSize(); ++i) {
44 dependencies.push_front(&sig);
49 dependencies.remove(&sig);
59 dgTDEBUG(15) <<
"# In {" << leader.getName() <<
" : (" << leader.getReady()
60 <<
") " << t1 <<
" >? " << leader.getTime() << std::endl;
62 if (leader.getReady()) {
66 if (lastAskForUpdate) {
71 switch (dependencyType) {
78 case TIME_DEPENDENT: {
79 if (t1 < leader.getTime() + periodTime) {
87 bool res = updateFromAllChildren;
88 const typename Dependencies::const_iterator itend = dependencies.end();
89 for (
typename Dependencies::const_iterator it = dependencies.begin();
92 dgTDEBUG(15) <<
"Ask update for " << sig << std::endl;
95 if (updateFromAllChildren)
102 if (updateFromAllChildren) {
109 lastAskForUpdate = res;
115 template <
class Time>
120 template <
class Time>
122 std::ostream &os,
const int depth, std::string space, std::string next1,
123 std::string next2)
const {
124 leader.SignalBase<Time>::displayDependencies(os, depth, space, next1, next2)
126 switch (dependencyType) {
131 os <<
"ready=" << ((leader.getReady()) ?
"TRUE" :
"FALSE");
134 os <<
"t=" << leader.getTime() <<
" (/" << periodTime <<
") ";
139 const typename Dependencies::const_iterator itend = dependencies.end();
140 for (
typename Dependencies::const_iterator it = dependencies.begin();
144 std::string ajout =
"|";
145 std::string ajout2 =
"|";
146 typename Dependencies::const_iterator it2 = it;
148 if (it2 == dependencies.end()) {
152 (*it)->displayDependencies(os, depth - 1, space + next2 +
" ", ajout,
155 os << std::endl << space <<
" `-- ...";
164 #undef __TIME_DEPENDENCY_INIT #define dgTDEBUGOUT(level)
#define __TIME_DEPENDENCY_INIT(sig, dep)
TimeDependency(SignalBase< Time > *sig, const DependencyType dep=DEPENDENCY_TYPE_DEFAULT)
A helper class for setting and specifying dependencies between signals.
dynamicgraph::SignalArray_const< double > sig
The base class for signals: not to be used as such.
virtual unsigned int getSize() const
virtual bool needUpdate(const Time &) const
virtual const Time & getTime() const