Public Member Functions | List of all members
dynamicgraph::SignalTimeDependent< T, Time > Class Template Reference

A type of signal that enforces a time dependency between other signals, making sure its inputs are up to date on access, using a incrementing time tick as reference. More...

#include <fwd.hh>

Inheritance diagram for dynamicgraph::SignalTimeDependent< T, Time >:
Inheritance graph
[legend]

Public Member Functions

const T & access (const Time &t1)
 
virtual void addDependency (const SignalBase< Time > &signal)
 
virtual void clearDependencies ()
 
std::ostream & displayDependencies (std::ostream &os, const int depth=-1, std::string space="", std::string next1="", std::string next2="") const
 
virtual Time getPeriodTime () const
 
virtual bool needUpdate (const Time &t) const
 
const T & operator() (const Time &t1)
 
virtual void removeDependency (const SignalBase< Time > &signal)
 
virtual void setPeriodTime (const Time &p)
 
 SignalTimeDependent (std::string name="")
 
 SignalTimeDependent (const SignalArray_const< Time > &arr, std::string name="")
 
 SignalTimeDependent (boost::function2< T &, T &, Time > t, const SignalArray_const< Time > &sig, std::string name="")
 
std::ostream & writeGraph (std::ostream &os) const
 
virtual ~SignalTimeDependent ()
 
- Public Member Functions inherited from dynamicgraph::Signal< T, Time >
virtual const T & accessCopy () const
 
virtual void checkCompatibility ()
 
virtual std::ostream & display (std::ostream &os) const
 
virtual void get (std::ostream &value) const
 
virtual void getClassName (std::string &aClassName) const
 
bool getKeepReference ()
 
 operator const T & () const
 
virtual Signal< T, Time > & operator= (const T &t)
 
virtual void recompute (const Time &t)
 
virtual void set (std::istringstream &value)
 
virtual void setConstant (const T &t)
 
virtual void setFunction (boost::function2< T &, T &, Time > t, Mutex *mutexref=NULL)
 
void setKeepReference (const bool &b)
 
virtual void setReference (const T *t, Mutex *mutexref=NULL)
 
virtual void setReferenceNonConstant (T *t, Mutex *mutexref=NULL)
 
 Signal (std::string name)
 
virtual void trace (std::ostream &os) const
 
virtual ~Signal ()
 
- Public Member Functions inherited from dynamicgraph::SignalBase< Time >
 SignalBase (std::string name="")
 
virtual ~SignalBase ()
 
virtual const Time & getTime () const
 
virtual void setTime (const Time &t)
 
const bool & getReady () const
 
const std::string & getName () const
 
void getClassName (std::string &aClassName) const
 
void setReady (const bool sready=true)
 
virtual void plug (SignalBase< Time > *sigarg)
 
virtual void unplug ()
 
virtual bool isPlugged () const
 
virtual SignalBase< Time > * getPluged () const
 
virtual void setConstantDefault ()
 
std::string shortName () const
 
virtual void ExtractNodeAndLocalNames (std::string &LocalName, std::string &NodeName) const
 
- Public Member Functions inherited from dynamicgraph::TimeDependency< Time >
void addDependencies (const SignalArray_const< Time > &arr)
 
void addDependency (const SignalBase< Time > &sig)
 
void clearDependency ()
 
std::ostream & displayDependencies (std::ostream &os, const int depth=-1, std::string space="", std::string next1="", std::string next2="") const
 
bool getNeedUpdateFromAllChildren () const
 
Time getPeriodTime () const
 
bool needUpdate (const Time &t1) const
 
void removeDependency (const SignalBase< Time > &sig)
 
void setDependencyType (DependencyType dep)
 
void setNeedUpdateFromAllChildren (const bool b=true)
 
void setPeriodTime (const Time &p)
 
 TimeDependency (SignalBase< Time > *sig, const DependencyType dep=DEPENDENCY_TYPE_DEFAULT)
 
 TimeDependency (SignalBase< Time > *sig, const SignalArray_const< Time > &arr, const DependencyType dep=DEPENDENCY_TYPE_DEFAULT)
 
virtual ~TimeDependency ()
 

Additional Inherited Members

- Public Types inherited from dynamicgraph::Signal< T, Time >
typedef int * Mutex
 
typedef int * MutexError
 
- Public Types inherited from dynamicgraph::TimeDependency< Time >
typedef std::list< const SignalBase< Time > * > Dependencies
 
enum  DependencyType { TIME_DEPENDENT, BOOL_DEPENDENT, ALWAYS_READY }
 
- Public Attributes inherited from dynamicgraph::TimeDependency< Time >
Dependencies dependencies
 
DependencyType dependencyType
 
Time lastAskForUpdate
 
SignalBase< Time > & leader
 
Time periodTime
 
bool updateFromAllChildren
 
- Static Public Attributes inherited from dynamicgraph::TimeDependency< Time >
static const bool ALL_READY_DEFAULT = false
 
static const DependencyType DEPENDENCY_TYPE_DEFAULT = TIME_DEPENDENT
 
static const Time PERIOD_TIME_DEFAULT = 1
 
- Protected Types inherited from dynamicgraph::Signal< T, Time >
enum  SignalType { CONSTANT, REFERENCE, REFERENCE_NON_CONST, FUNCTION }
 
- Protected Attributes inherited from dynamicgraph::Signal< T, Time >
bool copyInit
 
bool keepReference
 
MutexproviderMutex
 
SignalType signalType
 
T * Tcopy
 
Tcopy1
 
Tcopy2
 
boost::function2< T &, T &, Time > Tfunction
 
const T * Treference
 
T * TreferenceNonConst
 
- Protected Attributes inherited from dynamicgraph::SignalBase< Time >
std::string name
 
bool ready
 
Time signalTime
 
- Static Protected Attributes inherited from dynamicgraph::Signal< T, Time >
static const bool KEEP_REFERENCE_DEFAULT = false
 
static const SignalType SIGNAL_TYPE_DEFAULT = CONSTANT
 

Detailed Description

template<class T, class Time>
class dynamicgraph::SignalTimeDependent< T, Time >

A type of signal that enforces a time dependency between other signals, making sure its inputs are up to date on access, using a incrementing time tick as reference.

It works this way. For a given SignalTimeDependent S,

Thus, the value of dependent signals can be accessed quickly and repeatedly through the Signal::accessCopy () function.

An example:

class MyEntity : public Entity {
public:
// Some signal dependencies
SignalPtr<T,int> dep1, dep2;
SignalTimeDependent<T,int> signal;
MyEntity (const std::string& name)
: Entity (name)
, signal (
// Set the function that computes the signal value
boost::bind (&Entity::computeSignal, this, _1, _2),
// Declare the dependencies
dep1 << dep2,
"signalname")
{}
T& computeSignal (T& res, int time)
{
// The accesses below update the signal if necessary.
dep1(time);
dep1.access(time);
dep1.recompute(time);
// If dep1 and dep2 are already up-to-date, for a faster access, use
dep1.accessCopy();
dep2.accessCopy();
// Compute res
return res;
}

Definition at line 56 of file fwd.hh.

Constructor & Destructor Documentation

◆ SignalTimeDependent() [1/3]

template<class T , class Time >
dynamicgraph::SignalTimeDependent< T, Time >::SignalTimeDependent ( std::string  name = "")

Definition at line 102 of file signal-time-dependent.h.

◆ SignalTimeDependent() [2/3]

template<class T , class Time>
dynamicgraph::SignalTimeDependent< T, Time >::SignalTimeDependent ( const SignalArray_const< Time > &  arr,
std::string  name = "" 
)

Definition at line 106 of file signal-time-dependent.h.

◆ SignalTimeDependent() [3/3]

template<class T, class Time>
dynamicgraph::SignalTimeDependent< T, Time >::SignalTimeDependent ( boost::function2< T &, T &, Time >  t,
const SignalArray_const< Time > &  sig,
std::string  name = "" 
)

Definition at line 111 of file signal-time-dependent.h.

◆ ~SignalTimeDependent()

template<class T, class Time>
virtual dynamicgraph::SignalTimeDependent< T, Time >::~SignalTimeDependent ( )
inlinevirtual

Definition at line 75 of file signal-time-dependent.h.

Member Function Documentation

◆ access()

template<class T , class Time>
const T & dynamicgraph::SignalTimeDependent< T, Time >::access ( const Time &  t1)
virtual

Reimplemented from dynamicgraph::Signal< T, Time >.

Definition at line 119 of file signal-time-dependent.h.

◆ addDependency()

template<class T , class Time>
void dynamicgraph::SignalTimeDependent< T, Time >::addDependency ( const SignalBase< Time > &  signal)
virtual

Reimplemented from dynamicgraph::SignalBase< Time >.

Definition at line 136 of file signal-time-dependent.h.

◆ clearDependencies()

template<class T , class Time >
void dynamicgraph::SignalTimeDependent< T, Time >::clearDependencies ( )
virtual

Reimplemented from dynamicgraph::SignalBase< Time >.

Definition at line 148 of file signal-time-dependent.h.

◆ displayDependencies()

template<class T, class Time>
std::ostream& dynamicgraph::SignalTimeDependent< T, Time >::displayDependencies ( std::ostream &  os,
const int  depth = -1,
std::string  space = "",
std::string  next1 = "",
std::string  next2 = "" 
) const
inlinevirtual

Reimplemented from dynamicgraph::SignalBase< Time >.

Definition at line 86 of file signal-time-dependent.h.

◆ getPeriodTime()

template<class T , class Time >
Time dynamicgraph::SignalTimeDependent< T, Time >::getPeriodTime ( ) const
virtual

Reimplemented from dynamicgraph::SignalBase< Time >.

Definition at line 162 of file signal-time-dependent.h.

◆ needUpdate()

template<class T , class Time>
bool dynamicgraph::SignalTimeDependent< T, Time >::needUpdate ( const Time &  t) const
virtual

Reimplemented from dynamicgraph::SignalBase< Time >.

Definition at line 153 of file signal-time-dependent.h.

◆ operator()()

template<class T, class Time>
const T& dynamicgraph::SignalTimeDependent< T, Time >::operator() ( const Time &  t1)
inlinevirtual

Reimplemented from dynamicgraph::Signal< T, Time >.

Definition at line 77 of file signal-time-dependent.h.

◆ removeDependency()

template<class T , class Time>
void dynamicgraph::SignalTimeDependent< T, Time >::removeDependency ( const SignalBase< Time > &  signal)
virtual

Reimplemented from dynamicgraph::SignalBase< Time >.

Definition at line 142 of file signal-time-dependent.h.

◆ setPeriodTime()

template<class T , class Time>
void dynamicgraph::SignalTimeDependent< T, Time >::setPeriodTime ( const Time &  p)
virtual

Reimplemented from dynamicgraph::SignalBase< Time >.

Definition at line 158 of file signal-time-dependent.h.

◆ writeGraph()

template<class T, class Time>
std::ostream& dynamicgraph::SignalTimeDependent< T, Time >::writeGraph ( std::ostream &  os) const
inlinevirtual

Reimplemented from dynamicgraph::TimeDependency< Time >.

Definition at line 84 of file signal-time-dependent.h.


The documentation for this class was generated from the following files:


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