50 dgDEBUG(15) <<
"Delete \"" << (iter->first) <<
"\"" << std::endl;
51 Entity *entity = iter->second;
61 Entities::iterator entkey =
entityMap.find(entname);
66 "Another entity already defined with the same name. ",
67 "Entity name is <%s>.", entname.c_str());
69 dgDEBUG(10) <<
"Register entity <" << entname <<
"> in the pool." 76 Entities::iterator entkey =
entityMap.find(entname);
80 "Entity not defined yet. ",
"Entity name is <%s>.",
83 dgDEBUG(10) <<
"Deregister entity <" << entname <<
"> from the pool." 94 dgDEBUG(25) <<
"Get <" << name <<
">" << std::endl;
95 Entities::iterator entPtr =
entityMap.find(name);
98 "Unknown entity.",
" (while calling <%s>)",
101 return *entPtr->second;
113 Entities::iterator entPtr =
entityMap.find(name);
117 ptr = entPtr->second;
124 std::list<Entity *> toDelete;
128 if (entPtr->second->getClassName() ==
name)
129 toDelete.push_back(entPtr->second);
131 for (std::list<Entity *>::iterator iter = toDelete.begin();
132 iter != toDelete.end(); ++iter)
146 size_t IdxPointFound = aFileName.rfind(
".");
147 std::string tmp1 = aFileName.substr(0, IdxPointFound);
148 size_t IdxSeparatorFound = aFileName.rfind(
"/");
149 std::string GenericName;
150 if (IdxSeparatorFound != std::string::npos)
151 GenericName = tmp1.substr(IdxSeparatorFound, tmp1.length());
158 struct tm ltimeformatted;
160 localtime_s(<imeformatted, <ime);
162 localtime_r(<ime, <imeformatted);
166 std::ofstream GraphFile(aFileName.c_str(), std::ofstream::out);
167 GraphFile <<
"/* This graph has been automatically generated. " << std::endl;
168 GraphFile <<
" " << 1900 + ltimeformatted.tm_year
169 <<
" Month: " << 1 + ltimeformatted.tm_mon
170 <<
" Day: " << ltimeformatted.tm_mday
171 <<
" Time: " << ltimeformatted.tm_hour <<
":" 172 << ltimeformatted.tm_min;
173 GraphFile <<
" */" << std::endl;
174 GraphFile <<
"digraph \"" << GenericName <<
"\" { ";
175 GraphFile <<
"\t graph [ label=\"" << GenericName
176 <<
"\" bgcolor = white rankdir=LR ]" << std::endl
177 <<
"\t node [ fontcolor = black, color = black," 178 <<
"fillcolor = gold1, style=filled, shape=box ] ; " << std::endl;
179 GraphFile <<
"\tsubgraph cluster_Entities { " << std::endl;
181 GraphFile <<
"\t} " << std::endl;
185 Entity *ent = iter->second;
186 GraphFile <<
"\"" << ent->
getName() <<
"\"" 187 <<
" [ label = \"" << ent->
getName() <<
"\" ," << std::endl
188 <<
" fontcolor = black, color = black, fillcolor=cyan," 189 <<
" style=filled, shape=box ]" << std::endl;
193 GraphFile <<
"}" << std::endl;
201 Entity *ent = iter->second;
207 std::string &funName) {
208 const int SIZE = 128;
211 cmdparse.getline(buffer, SIZE,
'.');
212 if (!cmdparse.good())
223 std::string objname, signame;
226 "Parse error in signal name");
void deregisterEntity(const std::string &entname)
Unregister an entity.
void writeGraph(const std::string &aFileName)
This method write a graph description on the file named FileName.
Singleton that keeps track of all the entities.
static bool objectNameParser(std::istringstream &cmdparse, std::string &objName, std::string &funName)
This class represents an entity, i.e. a generic computational unit that provides input and output sig...
static PoolStorage * instance_
#define dgDEBUGOUT(level)
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...
void registerEntity(const std::string &entname, Entity *ent)
Register an entity.
void writeCompletionList(std::ostream &os)
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...
bool existEntity(const std::string &name)
Test if the entity exists.
Entity & getEntity(const std::string &name)
Get an entity.
static PoolStorage * getInstance()
Get unique instance of the class.
static void destroy()
Destroy the unique instance of the class.
const std::string & getName() const
std::map< std::string, Entity * > Entities
Sorted set of entities with unique key (name).
const Entities & getEntityMap() const
Const access to entity map.
~PoolStorage()
Default destructor.
SignalBase< int > & getSignal(const std::string &signalName)
Provides a reference to the signal named signalName.
SignalBase< int > & getSignal(std::istringstream &sigpath)
Get a signal by name.
void clearPlugin(const std::string &name)
Disallocate an entity.
#define dgDEBUGIN(level)
VP_DEBUG.
Entities entityMap
Set of basic objects of the SoT.