custom_entity.cpp
Go to the documentation of this file.
1 /* Copyright 2010-2019 LAAS, CNRS
2  * Thomas Moulard.
3  *
4  */
5 
6 #define ENABLE_RT_LOG
7 
8 #include "custom_entity.h"
9 
11 #include <dynamic-graph/entity.h>
13 #include <dynamic-graph/factory.h>
14 #include <dynamic-graph/pool.h>
18 
19 #include <boost/bind.hpp>
20 
21 namespace dynamicgraph {
22 
23 CustomEntity::CustomEntity(const std::string n)
24  : Entity(n),
25  m_sigdSIN(NULL, "CustomEntity(" + name + ")::input(double)::in_double"),
26  m_sigdTimeDepSOUT(boost::bind(&CustomEntity::update, this, _1, _2),
27  m_sigdSIN,
28  "CustomEntity(" + name + ")::input(double)::out_double")
29 
30 {
31  addSignal();
32 
33  using namespace dynamicgraph::command;
34 
35  this->addCommand("act",
36  makeCommandVoid0(*this, &CustomEntity::act,
37  docCommandVoid0("act on input signal")));
38 }
39 
42 }
43 
45  signalDeregistration("in_double");
46  signalDeregistration("out_double");
47 }
48 
49 double &CustomEntity::update(double &res, const sigtime_t &inTime) {
50  const double &aDouble = m_sigdSIN(inTime);
51  res = aDouble;
52  logger().stream(MSG_TYPE_ERROR) << "start update " << res << '\n';
54  << "This is a message of level MSG_TYPE_DEBUG\n";
56  << "This is a message of level MSG_TYPE_INFO\n";
58  << "This is a message of level MSG_TYPE_WARNING\n";
60  << "This is a message of level MSG_TYPE_ERROR\n";
62  << "This is a message of level MSG_TYPE_DEBUG_STREAM\n";
64  << "This is a message of level MSG_TYPE_INFO_STREAM\n";
66  << "This is a message of level MSG_TYPE_WARNING_STREAM\n";
68  << "This is a message of level MSG_TYPE_ERROR_STREAM\n";
69  logger().stream(MSG_TYPE_ERROR) << "end update\n";
70  return res;
71 }
72 
73 void CustomEntity::act() { m_sigdSIN.accessCopy(); }
74 
75 DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(CustomEntity, "CustomEntity");
76 } // namespace dynamicgraph
signal-ptr.h
dynamicgraph::Entity::logger
Logger & logger()
signal-time-dependent.h
dynamicgraph::CustomEntity::m_sigdTimeDepSOUT
dynamicgraph::SignalTimeDependent< double, sigtime_t > m_sigdTimeDepSOUT
Definition: custom_entity.h:18
dynamicgraph::SignalPtr::accessCopy
virtual const T & accessCopy() const
dynamicgraph
exception-factory.h
dynamicgraph::command
sigtime_t
dynamicgraph::sigtime_t sigtime_t
dynamicgraph::command::docCommandVoid0
std::string docCommandVoid0(const std::string &doc)
dynamicgraph::DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN
DYNAMICGRAPH_FACTORY_ENTITY_PLUGIN(CustomEntity, "CustomEntity")
dynamicgraph::CustomEntity::CustomEntity
CustomEntity(const std::string &n)
dynamicgraph::MSG_TYPE_ERROR
MSG_TYPE_ERROR
dynamicgraph::command::makeCommandVoid0
CommandVoid0< E > * makeCommandVoid0(E &entity, boost::function< void(E *)> function, const std::string &docString)
command-bind.h
res
res
dynamicgraph::CustomEntity::m_sigdSIN
dynamicgraph::SignalPtr< double, sigtime_t > m_sigdSIN
Definition: custom_entity.h:17
DYNAMIC_GRAPH_ENTITY_DEBUG
#define DYNAMIC_GRAPH_ENTITY_DEBUG(entity)
dynamicgraph::CustomEntity::rmValidSignal
void rmValidSignal()
Definition: custom_entity.cpp:44
DYNAMIC_GRAPH_ENTITY_DEBUG_STREAM
#define DYNAMIC_GRAPH_ENTITY_DEBUG_STREAM(entity)
custom_entity.h
setup.name
name
Definition: setup.in.py:179
dynamicgraph::CustomEntity::update
double & update(double &res, const sigtime_t &inTime)
Definition: custom_entity.cpp:49
DYNAMIC_GRAPH_ENTITY_ERROR
#define DYNAMIC_GRAPH_ENTITY_ERROR(entity)
real-time-logger.h
DYNAMIC_GRAPH_ENTITY_WARNING
#define DYNAMIC_GRAPH_ENTITY_WARNING(entity)
DYNAMIC_GRAPH_ENTITY_ERROR_STREAM
#define DYNAMIC_GRAPH_ENTITY_ERROR_STREAM(entity)
dynamicgraph::Logger::stream
RTLoggerStream stream()
DYNAMIC_GRAPH_ENTITY_INFO
#define DYNAMIC_GRAPH_ENTITY_INFO(entity)
DYNAMIC_GRAPH_ENTITY_INFO_STREAM
#define DYNAMIC_GRAPH_ENTITY_INFO_STREAM(entity)
dynamicgraph::CustomEntity::addSignal
void addSignal()
Definition: custom_entity.cpp:40
dynamicgraph::Entity::signalDeregistration
void signalDeregistration(const std::string &name)
dynamicgraph::Entity::signalRegistration
void signalRegistration(const SignalArray< sigtime_t > &signals)
DYNAMIC_GRAPH_ENTITY_WARNING_STREAM
#define DYNAMIC_GRAPH_ENTITY_WARNING_STREAM(entity)


dynamic-graph-python
Author(s): Nicolas Mansard, Olivier Stasse
autogenerated on Fri Oct 27 2023 02:16:36