Skip to content

Commit 8530ada

Browse files
authored
Merge pull request #45 from jmirabel/devel
Add TimeDependency::addDependencies + doc of SignalTimeDependent
2 parents 384b207 + 8d66424 commit 8530ada

File tree

11 files changed

+66
-23
lines changed

11 files changed

+66
-23
lines changed

doc/Doxyfile.extra.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ IMAGE_PATH = @CMAKE_SOURCE_DIR@/doc/pictures \
66
FILE_PATTERNS = *.cc *.cpp *.h *.hh *.hxx
77

88
TAGFILES = \
9-
"@CMAKE_INSTALL_PREFIX@/share/doc/dynamic-graph-python.doxytag = @CMAKE_INSTALL_PREFIX@/share/doc/dynamic-graph-python"
9+
"@CMAKE_INSTALL_PREFIX@/share/doc/dynamic-graph-python.doxytag = @CMAKE_INSTALL_PREFIX@/share/doc/dynamic-graph-python"
10+
11+
EXAMPLE_PATH = @CMAKE_SOURCE_DIR@

doc/additionalDoc/debug-doc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ WARNING, ERROR). It is described in details here: \subpage subp_logger
1313
int: \subpage subp_dbg_trace
1414
- If you just need to collect informations from signals (like rosbag). You can
1515
use an entity called Tracer inside the graph:\subpage tracerdoc . <br> A real
16-
time version exists to write directly inside a memory buffer \subpage
17-
tracerrealtimedoc
16+
time version exists to write directly inside a memory buffer
17+
\subpage tracerrealtimedoc
1818
**/

doc/additionalDoc/debug-trace-doc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ test \endcode
6565
\section subp_dbg_trace_wrk_exp Working example
6666
6767
A full working example is given here:
68-
\include ../tests/debug-trace.cpp
68+
\include tests/debug-trace.cpp
6969
*/

doc/additionalDoc/package.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ The software graph structure is detailled in \subpage p_graph
2222
2323
For debugging your entities detailed instructions are given in \subpage debug
2424
25-
For citing the software in your research work please refer to \subpage
26-
subp_references
25+
For citing the software in your research work please refer to
26+
\subpage subp_references
2727
2828
\namespace dynamicgraph This is the namespace where every object and class of
2929
this library is located.

include/dynamic-graph/entity.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class DYNAMIC_GRAPH_DLLAPI Entity : private boost::noncopyable {
8585

8686
/** \name Logger related methods */
8787
/** \{*/
88-
/// \brief Send messages \param msg with level t.
88+
/// \brief Send messages \c msg with level \c t.
8989
/// Add string file and line to message.
9090
void sendMsg(const std::string &msg, MsgType t = MSG_TYPE_INFO,
9191
const char *file = "", int line = 0);

include/dynamic-graph/null-ptr.hh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#define DYNAMIC_GRAPH_NULL_PTR_HH
66

77
namespace dynamicgraph {
8+
/// \cond
89
const class {
910
public:
1011
template <class T> operator T *() const { return 0; }
@@ -14,6 +15,7 @@ public:
1415
private:
1516
void operator&() const;
1617
} nullptr = {};
18+
/// \endcond
1719

1820
} // end of namespace dynamicgraph.
1921

include/dynamic-graph/process-list.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public:
2222
ProcessList();
2323
};
2424

25-
/// \class This class gather information on a specific CPU.
25+
/// This class gather information on a specific CPU.
2626
///
2727
class DYNAMIC_GRAPH_DLLAPI CPUData {
2828
public:
@@ -123,7 +123,7 @@ public:
123123
}
124124
};
125125

126-
/// \class This class gathers information on a computer.
126+
/// This class gathers information on a computer.
127127
/// This includes a list of CPU
128128
class DYNAMIC_GRAPH_DLLAPI System {
129129
private:

include/dynamic-graph/signal-time-dependent.h

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,49 @@ namespace dynamicgraph {
1313
signals,
1414
making sure its inputs are up to date on access, using a incrementing time
1515
tick as reference.
16-
It works this way: for a given SignalTimeDependent S, the user manually
17-
adds dependent signals through the
18-
use of the addDependency function. On access (calling the signal S
19-
operator () or access(Time) function),
20-
if the dependent signals are not up-to-date, i.e. if their [last update]
21-
time is less than the
22-
current time, their value will be access ()'ed to bring them up-to-date.
23-
Thus, the value of dependent
24-
signals can be accessed \b quickly and \b repeatedly through the
25-
accessCopy () function.
16+
17+
It works this way. For a given SignalTimeDependent S,
18+
- the user manually adds dependent signals through the use of the SignalTimeDependent::addDependency function.
19+
- On access (calling the signal S SignalTimeDependent::operator()(const Time&) or
20+
SignalTimeDependent::access(const Time&) function), if the dependent signals are not
21+
up-to-date, i.e. if their [last update] time is less than the current time,
22+
their value will be SignalTimeDependent::access ()'ed to bring them up-to-date.
23+
24+
Thus, the value of dependent signals can be accessed \b quickly and
25+
\b repeatedly through the Signal::accessCopy () function.
26+
27+
An example:
28+
\code
29+
class MyEntity : public Entity {
30+
public:
31+
// Some signal dependencies
32+
SignalPtr<T,int> dep1, dep2;
33+
SignalTimeDependent<T,int> signal;
34+
35+
MyEntity (const std::string& name)
36+
: Entity (name)
37+
, signal (
38+
// Set the function that computes the signal value
39+
boost::bind (&Entity::computeSignal, this, _1, _2),
40+
// Declare the dependencies
41+
dep1 << dep2,
42+
"signalname")
43+
{}
44+
45+
T& computeSignal (T& res, int time)
46+
{
47+
// The accesses below update the signal if necessary.
48+
dep1(time);
49+
dep1.access(time);
50+
dep1.recompute(time);
51+
// If dep1 and dep2 are already up-to-date, for a faster access, use
52+
dep1.accessCopy();
53+
dep2.accessCopy();
54+
55+
// Compute res
56+
return res;
57+
}
58+
\endcode
2659
*/
2760
template <class T, class Time>
2861
class SignalTimeDependent : public virtual Signal<T, Time>,

include/dynamic-graph/time-dependency.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ template <class Time> class TimeDependency {
4343
const DependencyType dep = DEPENDENCY_TYPE_DEFAULT);
4444
virtual ~TimeDependency() {}
4545

46+
void addDependencies(const SignalArray_const<Time> &arr);
4647
void addDependency(const SignalBase<Time> &sig);
4748
void removeDependency(const SignalBase<Time> &sig);
4849
void clearDependency();

0 commit comments

Comments
 (0)