Go to the documentation of this file.
25 void Entity::entityRegistration() {
26 PoolStorage::getInstance()->registerEntity(
name,
this);
29 void Entity::entityDeregistration() {
30 PoolStorage::getInstance()->deregisterEntity(
name);
33 Entity::Entity(
const string &name__) :
name(name__) {
34 dgDEBUG(15) <<
"New entity <" << name__ <<
">" << endl;
35 if (
name.length() == 0) {
49 for (std::map<const std::string, Command *>::iterator it =
commandMap.begin();
60 for (
unsigned int i = 0; i < signals.getSize(); ++i) {
63 istringstream iss(
sig.getName());
64 const int SIZE = 4096;
67 iss.getline(buffer, SIZE,
':');
69 const string &signame(buffer);
71 SignalMap::iterator sigkey =
signalMap.find(signame);
74 dgERRORF(
"Key %s already exist in the signalMap.", signame.c_str());
75 if (sigkey->second != &
sig) {
78 "Another signal already defined with the same name. ",
79 "Signame is <%s>.", signame.c_str());
82 dgDEBUG(10) <<
"Register signal <" << signame <<
"> for entity <"
90 SignalMap::iterator sigkey =
signalMap.find(signame);
93 dgERRORF(
"Key %s does not exist in the signalMap.", signame.c_str());
95 "No signal defined with the given name. ",
96 " (while erasing <%s>).", signame.c_str());
98 dgDEBUG(10) <<
"Deregister signal <" << signame <<
"> for entity <"
105 std::string docString(
"No header documentation.");
114 SignalMap::iterator sigkey =
signalMap.find(signame);
118 "The requested signal is not registered",
": %s",
121 return *(sigkey->second);
125 SignalMap::const_iterator sigkey =
signalMap.find(signame);
129 "The requested signal is not registered",
": %s",
132 return *(sigkey->second);
136 os <<
"--- <" <<
getName() <<
"> signal list: " << endl;
137 const SignalMap::const_iterator iterend =
signalMap.end();
138 for (SignalMap::const_iterator iter =
signalMap.begin(); iterend != iter;
141 if ((++iter)-- == iterend)
145 os <<
"-- <" << *(iter->second) << endl;
151 const SignalMap::const_iterator iterend =
signalMap.end();
152 for (SignalMap::const_iterator iter =
signalMap.begin(); iterend != iter;
154 (*(iter->second)).writeGraph(os);
160 const SignalMap::const_iterator iterend =
signalMap.end();
161 for (SignalMap::const_iterator iter =
signalMap.begin(); iterend != iter;
163 os <<
getName() <<
"." << (*(iter->second)).shortName() << std::endl;
195 "Command " + inName +
" already registered in Entity.");
197 std::pair<const std::string, Command *> item(inName, command);
210 "Command <" + commandName +
"> is not registered in Entity.");
216 const std::string &lineId) {
DYNAMIC_GRAPH_DLLAPI std::ostream & operator<<(std::ostream &os, const dynamicgraph::Entity &ent)
bool hasSignal(const std::string &signame) const
Test if a signal of name signame is present.
static std::string Entity_COMMAND_LIST
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.
This class represents an entity, i.e. a generic computational unit that provides input and output sig...
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...
SignalMap getSignalMap() const
Provides a map of all the signals.
CommandMap_t getNewStyleCommandMap()
Provides the std::map where all the commands are registered.
std::ostream & displaySignalList(std::ostream &os) const
Display the list of signals of this entity in output stream os.
virtual std::string getDocString() const
Returns the Entity documentation.
std::map< std::string, SignalBase< sigtime_t > * > SignalMap
const std::string & getName() const
void dgERRORF(const int, const char *,...)
dynamicgraph::SignalArray_const< double > sig
virtual const std::string & getClassName() const
#define dgDEBUGOUT(level)
virtual void display(std::ostream &os) const
Display information on the entity inside the output stream os.
command::Command * getNewStyleCommand(const std::string &cmdName)
Provides the pointer towards the Command object cmdName.
const std::string & getCommandList() const
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.
void entityRegistration()
SignalBase< sigtime_t > & getSignal(const std::string &signalName)
Provides a reference to the signal named signalName.
void addCommand(const std::string &name, command::Command *command)
Add a command to Entity.
void signalDeregistration(const std::string &name)
void signalRegistration(const SignalArray< sigtime_t > &signals)
dynamic-graph
Author(s): Nicolas Mansard, Olivier Stasse
autogenerated on Fri Aug 2 2024 08:36:38