Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • cberge/dynamic-graph
  • ostasse/dynamic-graph
  • gsaurel/dynamic-graph
  • stack-of-tasks/dynamic-graph
4 results
Show changes
Showing
with 686 additions and 766 deletions
......@@ -6,14 +6,14 @@
#ifndef DYNAMIC_GRAPH_SIGNAL_BASE_H
#define DYNAMIC_GRAPH_SIGNAL_BASE_H
#include <dynamic-graph/exception-signal.h>
#include <boost/noncopyable.hpp>
#include <dynamic-graph/fwd.hh>
#include <sstream>
#include <string>
#include <typeinfo>
#include <dynamic-graph/exception-signal.h>
#include <dynamic-graph/fwd.hh>
namespace dynamicgraph {
/** \brief The base class for signals: not to be used as such.
......@@ -23,8 +23,9 @@ namespace dynamicgraph {
value of the signal, which can involve an extra computation,
while the latter accesses a cached value, or 'copy'.
*/
template <class Time> class SignalBase : public boost::noncopyable {
public:
template <class Time>
class SignalBase : public boost::noncopyable {
public:
explicit SignalBase(std::string name = "")
: name(name), signalTime(0), ready(false) {}
......@@ -195,7 +196,7 @@ public:
}
/// \}
protected:
protected:
std::string name;
Time signalTime;
bool ready;
......@@ -206,6 +207,6 @@ template <class Time>
std::ostream &operator<<(std::ostream &os, const SignalBase<Time> &sig) {
return sig.display(os);
}
} // end of namespace dynamicgraph.
} // end of namespace dynamicgraph.
#endif //! DYNAMIC_GRAPH_SIGNAL_BASE_H
#endif //! DYNAMIC_GRAPH_SIGNAL_BASE_H
This diff is collapsed.
......@@ -19,18 +19,18 @@
/* --- MACROS ---------------------------------------------------------- */
#define SIGNAL_OUT_FUNCTION_NAME(name) name##SOUT_function
#define DECLARE_SIGNAL(name, IO, type) \
#define DECLARE_SIGNAL(name, IO, type) \
::dynamicgraph::Signal<type, int> m_##name##S##IO
#define CONSTRUCT_SIGNAL(name, IO, type) \
m_##name##S##IO(getClassName() + "(" + getName() + ")::" + #IO + "put(" + \
#define CONSTRUCT_SIGNAL(name, IO, type) \
m_##name##S##IO(getClassName() + "(" + getName() + ")::" + #IO + "put(" + \
#type + ")::" + #name)
#define BIND_SIGNAL_TO_FUNCTION(name, IO, type) \
m_##name##S##IO.setFunction(boost::bind( \
#define BIND_SIGNAL_TO_FUNCTION(name, IO, type) \
m_##name##S##IO.setFunction(boost::bind( \
&EntityClassName::SIGNAL_OUT_FUNCTION_NAME(name), this, _1, _2));
/**/
#define DECLARE_SIGNAL_IN(name, type) \
#define DECLARE_SIGNAL_IN(name, type) \
::dynamicgraph::SignalPtr<type, int> m_##name##SIN
#define CONSTRUCT_SIGNAL_IN(name, type) \
m_##name##SIN(NULL, getClassName() + "(" + getName() + ")::input(" + #type + \
......@@ -38,40 +38,40 @@
/**/
#define DECLARE_SIGNAL_OUT_FUNCTION(name, type) \
#define DECLARE_SIGNAL_OUT_FUNCTION(name, type) \
type &SIGNAL_OUT_FUNCTION_NAME(name)(type &, int)
#define DEFINE_SIGNAL_OUT_FUNCTION(name, type) \
#define DEFINE_SIGNAL_OUT_FUNCTION(name, type) \
type &EntityClassName::SIGNAL_OUT_FUNCTION_NAME(name)(type & s, int iter)
#define SIGNAL_OUT_FUNCTION(name) name##SOUT_function
#define DECLARE_SIGNAL_OUT(name, type) \
public: \
::dynamicgraph::SignalTimeDependent<type, int> m_##name##SOUT; \
\
protected: \
#define DECLARE_SIGNAL_OUT(name, type) \
public: \
::dynamicgraph::SignalTimeDependent<type, int> m_##name##SOUT; \
\
protected: \
type &SIGNAL_OUT_FUNCTION(name)(type &, int)
#define CONSTRUCT_SIGNAL_OUT(name, type, dep) \
m_##name##SOUT( \
boost::bind(&EntityClassName::name##SOUT_function, this, _1, _2), dep, \
#define CONSTRUCT_SIGNAL_OUT(name, type, dep) \
m_##name##SOUT( \
boost::bind(&EntityClassName::name##SOUT_function, this, _1, _2), dep, \
getClassName() + "(" + getName() + ")::output(" + #type + ")::" + #name)
/**************** INNER SIGNALS *******************/
#define SIGNAL_INNER_FUNCTION_NAME(name) name##SINNER_function
#define DECLARE_SIGNAL_INNER_FUNCTION(name, type) \
#define DECLARE_SIGNAL_INNER_FUNCTION(name, type) \
type &SIGNAL_INNER_FUNCTION_NAME(name)(type &, int)
#define DEFINE_SIGNAL_INNER_FUNCTION(name, type) \
#define DEFINE_SIGNAL_INNER_FUNCTION(name, type) \
type &EntityClassName::SIGNAL_INNER_FUNCTION_NAME(name)(type & s, int iter)
#define DECLARE_SIGNAL_INNER(name, type) \
public: \
::dynamicgraph::SignalTimeDependent<type, int> m_##name##SINNER; \
\
protected: \
#define DECLARE_SIGNAL_INNER(name, type) \
public: \
::dynamicgraph::SignalTimeDependent<type, int> m_##name##SINNER; \
\
protected: \
DECLARE_SIGNAL_INNER_FUNCTION(name, type)
#define CONSTRUCT_SIGNAL_INNER(name, type, dep) \
......@@ -79,4 +79,4 @@ protected: \
boost::bind(&EntityClassName::name##SINNER_function, this, _1, _2), dep, \
getClassName() + "(" + getName() + ")::inner(" + #type + ")::" + #name)
#endif // __dynamic_graph_signal_helper_H__
#endif // __dynamic_graph_signal_helper_H__
This diff is collapsed.
......@@ -17,10 +17,10 @@ bool SignalPtr<T, Time>::isAbstractPluged() const {
return ((NULL != signalPtr) || (abstractTransmitter));
}
template <class T, class Time> Signal<T, Time> *SignalPtr<T, Time>::getPtr() {
template <class T, class Time>
Signal<T, Time> *SignalPtr<T, Time>::getPtr() {
dgTDEBUGIN(25);
if (!isPlugged())
DG_THROW
if (!isPlugged()) DG_THROW
ExceptionSignal(ExceptionSignal::NOT_INITIALIZED,
"In SignalPtr: SIN ptr not set.", " (in signal <%s>)",
getName().c_str());
......@@ -110,7 +110,8 @@ void SignalPtr<T, Time>::plug(SignalBase<Time> *unknown_ref) {
dgTDEBUGOUT(5);
}
template <class T, class Time> void SignalPtr<T, Time>::checkCompatibility() {
template <class T, class Time>
void SignalPtr<T, Time>::checkCompatibility() {
if (isPlugged() && (!autoref())) {
getPtr()->checkCompatibility();
} else if (isAbstractPluged() && (!autoref())) {
......@@ -127,7 +128,8 @@ bool SignalPtr<T, Time>::needUpdate(const Time &t) const {
return Signal<T, Time>::needUpdate(t);
}
template <class T, class Time> const Time &SignalPtr<T, Time>::getTime() const {
template <class T, class Time>
const Time &SignalPtr<T, Time>::getTime() const {
if ((isAbstractPluged()) && (!autoref())) {
return getAbstractPtr()->getTime();
}
......@@ -158,7 +160,8 @@ const T &SignalPtr<T, Time>::access(const Time &t) {
}
}
template <class T, class Time> const T &SignalPtr<T, Time>::accessCopy() const {
template <class T, class Time>
const T &SignalPtr<T, Time>::accessCopy() const {
if (modeNoThrow && (!isPlugged()) && Signal<T, Time>::copyInit)
return Signal<T, Time>::accessCopy();
else if (autoref())
......@@ -204,10 +207,11 @@ std::ostream &SignalPtr<T, Time>::display(std::ostream &os) const {
}
template <class T, class Time>
std::ostream &
SignalPtr<T, Time>::displayDependencies(std::ostream &os, const int depth,
std::string space, std::string next1,
std::string next2) const {
std::ostream &SignalPtr<T, Time>::displayDependencies(std::ostream &os,
const int depth,
std::string space,
std::string next1,
std::string next2) const {
dgTDEBUGIN(25);
if ((isAbstractPluged()) && (!autoref())) {
getAbstractPtr()->displayDependencies(
......@@ -220,6 +224,6 @@ SignalPtr<T, Time>::displayDependencies(std::ostream &os, const int depth,
return os;
}
} // end of namespace dynamicgraph.
} // end of namespace dynamicgraph.
#endif //! DYNAMIC_GRAPH_SIGNAL_PTR_T_CPP
#endif //! DYNAMIC_GRAPH_SIGNAL_PTR_T_CPP
......@@ -64,7 +64,7 @@ class SignalTimeDependent : public virtual Signal<T, Time>,
public TimeDependency<Time> {
// TimeDependency<Time> timeDependency;
public:
public:
SignalTimeDependent(std::string name = "");
SignalTimeDependent(const SignalArray_const<Time> &arr,
std::string name = "");
......@@ -163,6 +163,6 @@ Time SignalTimeDependent<T, Time>::getPeriodTime() const {
return TimeDependency<Time>::getPeriodTime();
}
} // end of namespace dynamicgraph
} // end of namespace dynamicgraph
#endif //! DYNAMIC_GRAPH_SIGNAL_TIME_DEPENDENT_H
#endif //! DYNAMIC_GRAPH_SIGNAL_TIME_DEPENDENT_H
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.