6 #ifndef DYNAMIC_GRAPH_ENTITY_H
7 #define DYNAMIC_GRAPH_ENTITY_H
8 #include <dynamic-graph/dynamic-graph-api.h>
9 #include <dynamic-graph/exception-factory.h>
10 #include <dynamic-graph/logger.h>
11 #include <dynamic-graph/signal-array.h>
12 #include <dynamic-graph/signal-base.h>
14 #include <boost/noncopyable.hpp>
15 #include <dynamic-graph/fwd.hh>
38 #define DYNAMIC_GRAPH_ENTITY_DECL() \
40 virtual const std::string &getClassName() const { return CLASS_NAME; } \
41 static const std::string CLASS_NAME
52 class DYNAMIC_GRAPH_DLLAPI
Entity :
private boost::noncopyable {
54 typedef std::map<std::string, SignalBase<sigtime_t> *> SignalMap;
55 typedef std::map<const std::string, command::Command *> CommandMap_t;
57 explicit Entity(
const std::string &name);
60 const std::string &getName()
const {
return name; }
61 virtual const std::string &getClassName()
const {
62 static std::string ret(
"Entity");
98 virtual std::ostream &
writeGraph(std::ostream &os)
const;
115 const std::string &getCommandList()
const;
135 Logger &logger() {
return logger_; };
136 Logger const &logger()
const {
return logger_; };
141 const std::string &lineId =
"");
157 return logger_.setStreamPrintPeriod(t);
168 void entityRegistration();
169 void entityDeregistration();
172 void signalDeregistration(
const std::string &name);
176 CommandMap_t commandMap;
180 DYNAMIC_GRAPH_DLLAPI std::ostream &operator<<(std::ostream &os,
This class represents an entity, i.e. a generic computational unit that provides input and output sig...
virtual void display(std::ostream &os) const
Display information on the entity inside the output stream os.
double getTimeSample()
Get the time sample.
command::Command * getNewStyleCommand(const std::string &cmdName)
Provides the pointer towards the Command object cmdName.
CommandMap_t getNewStyleCommandMap()
Provides the std::map where all the commands are registered.
virtual std::ostream & writeGraph(std::ostream &os) const
This method is used to write down in os the edges of the graph by calling the signals writeGraph meth...
bool hasSignal(const std::string &signame) const
Test if a signal of name signame is present.
double getStreamPrintPeriod()
Get the period of the stream period.
void setLoggerVerbosityLevel(LoggerVerbosity lv)
Specify the verbosity level of the logger.
std::ostream & displaySignalList(std::ostream &os) const
Display the list of signals of this entity in output stream os.
bool setStreamPrintPeriod(double t)
Set the period of the stream period.
bool setTimeSample(double t)
Set the time sample.
virtual std::ostream & writeCompletionList(std::ostream &os) const
This method is used write in the output stream os the signals names and the commands of the entity.
SignalMap getSignalMap() const
Provides a map of all the signals.
virtual std::string getDocString() const
Returns the Entity documentation.
LoggerVerbosity getLoggerVerbosityLevel()
Get the logger's verbosity level.
void sendMsg(const std::string &msg, MsgType t=MSG_TYPE_INFO, const std::string &lineId="")
Send messages msg with level t. Add string file and line to message.
SignalBase< sigtime_t > & getSignal(const std::string &signalName)
Provides a reference to the signal named signalName.
const SignalBase< sigtime_t > & getSignal(const std::string &signalName) const
Provides a const reference to the signal named signalName.
Class for logging messages.
The base class for signals: not to be used as such.