time-dependency.h
Go to the documentation of this file.
1 // -*- mode: c++ -*-
2 // Copyright 2010, François Bleibel, Thomas Moulard, Olivier Stasse,
3 // JRL, CNRS/AIST.
4 //
5 
6 #ifndef DYNAMIC_GRAPH_TIME_DEPENDENCY_H
7 #define DYNAMIC_GRAPH_TIME_DEPENDENCY_H
10 
11 #include <dynamic-graph/fwd.hh>
12 #include <list>
13 
14 namespace dynamicgraph {
18 template <class Time>
19 class TimeDependency {
20  public:
22 
23  mutable Time lastAskForUpdate;
24 
25  public:
27 
28  typedef std::list<const SignalBase<Time> *> Dependencies;
30 
31  Dependencies dependencies;
33  static const bool ALL_READY_DEFAULT = false;
34 
36 
37  Time periodTime;
38  static const Time PERIOD_TIME_DEFAULT = 1;
39 
40  public:
42  const DependencyType dep = DEPENDENCY_TYPE_DEFAULT);
44  const DependencyType dep = DEPENDENCY_TYPE_DEFAULT);
45  virtual ~TimeDependency() {}
46 
48  void addDependency(const SignalBase<Time> &sig);
49  void removeDependency(const SignalBase<Time> &sig);
50  void clearDependency();
51 
52  virtual std::ostream &writeGraph(std::ostream &os) const;
53  std::ostream &displayDependencies(std::ostream &os, const int depth = -1,
54  std::string space = "",
55  std::string next1 = "",
56  std::string next2 = "") const;
57 
58  bool needUpdate(const Time &t1) const;
59 
60  void setDependencyType(DependencyType dep) { dependencyType = dep; }
61 
62  void setNeedUpdateFromAllChildren(const bool b = true) {
63  updateFromAllChildren = b;
64  }
66 
67  void setPeriodTime(const Time &p) { periodTime = p; }
68  Time getPeriodTime() const { return periodTime; }
69 };
70 
71 } // end of namespace dynamicgraph
72 
74 #endif
TimeDependency(SignalBase< Time > *sig, const DependencyType dep=DEPENDENCY_TYPE_DEFAULT)
virtual std::ostream & writeGraph(std::ostream &os) const
static const DependencyType DEPENDENCY_TYPE_DEFAULT
std::list< const SignalBase< Time > * > Dependencies
bool needUpdate(const Time &t1) const
void setNeedUpdateFromAllChildren(const bool b=true)
void setDependencyType(DependencyType dep)
dynamicgraph::SignalArray_const< double > sig
Definition: signal-all.cpp:25
void addDependency(const SignalBase< Time > &sig)
std::ostream & displayDependencies(std::ostream &os, const int depth=-1, std::string space="", std::string next1="", std::string next2="") const
void addDependencies(const SignalArray_const< Time > &arr)
static const Time PERIOD_TIME_DEFAULT
The base class for signals: not to be used as such.
Definition: fwd.hh:51
static const bool ALL_READY_DEFAULT
bool getNeedUpdateFromAllChildren() const
SignalBase< Time > & leader
void setPeriodTime(const Time &p)
void removeDependency(const SignalBase< Time > &sig)


dynamic-graph
Author(s): Nicolas Mansard, Olivier Stasse
autogenerated on Sun Jun 25 2023 02:06:03