Routing support. The cTopology class was designed primarily to support routing in telecommunication or multiprocessor networks.
A cTopology object stores an abstract representation of the network in graph form:
- each cTopology node corresponds to a module (simple or compound), and
- each cTopology edge corresponds to a link or series of connecting links.
You can specify which modules (either simple or compound) you want to include in the graph. The graph will include all connections among the selected modules. In the graph, all nodes are at the same level, there is no submodule nesting. Connections which span across compound module boundaries are also represented as one graph edge. Graph edges are directed, just as module gates are.
- See also
- cTopology::Node, cTopology::Link, cTopology::LinkIn, cTopology::LinkOut
|
|
| cTopology (const char *name=nullptr) |
|
| cTopology (const cTopology &topo) |
|
virtual | ~cTopology () |
|
cTopology & | operator= (const cTopology &topo) |
|
|
virtual cTopology * | dup () const override |
|
virtual std::string | str () const override |
|
|
extract...() functions build topology from the model. User can select which modules to include. All connections between those modules will be in the topology. Connections can cross compound module boundaries.
|
virtual void | extractFromNetwork (bool(*selfunc)(cModule *, void *), void *userdata=nullptr) |
|
virtual void | extractFromNetwork (Predicate *predicate) |
|
virtual void | extractByModulePath (const std::vector< std::string > &fullPathPatterns) |
|
virtual void | extractByNedTypeName (const std::vector< std::string > &nedTypeNames) |
|
virtual void | extractByProperty (const char *propertyName, const char *value=nullptr) |
|
virtual void | extractByParameter (const char *paramName, const char *paramValue=nullptr) |
|
virtual void | clear () |
|
|
virtual int | addNode (Node *node) |
|
virtual void | deleteNode (Node *node) |
|
virtual void | addLink (Link *link, Node *srcNode, Node *destNode) |
|
virtual void | addLink (Link *link, cGate *srcGate, cGate *destGate) |
|
virtual void | deleteLink (Link *link) |
|
|
Users also need to rely on Node and Link member functions to explore the graph stored in the object.
|
virtual int | getNumNodes () const |
|
virtual Node * | getNode (int i) const |
|
virtual Node * | getNodeFor (cModule *mod) const |
|
| cOwnedObject () |
|
| cOwnedObject (const char *name, bool namepooling=true) |
|
| cOwnedObject (const cOwnedObject &obj) |
|
virtual | ~cOwnedObject () |
|
cOwnedObject & | operator= (const cOwnedObject &o) |
|
virtual cObject * | getOwner () const override |
|
virtual bool | isOwnedObject () const override |
|
| cNamedObject () |
|
| cNamedObject (const char *name, bool namepooling=true) |
|
| cNamedObject (const cNamedObject &obj) |
|
virtual | ~cNamedObject () |
|
cNamedObject & | operator= (const cNamedObject &o) |
|
virtual void | setName (const char *s) |
|
virtual const char * | getName () const override |
|
virtual void | setNamePooling (bool b) |
|
virtual bool | getNamePooling () |
|
| cObject () |
|
| cObject (const cObject &other)=default |
|
virtual | ~cObject () |
|
virtual const char * | getClassName () const |
|
bool | isName (const char *s) const |
|
virtual const char * | getFullName () const |
|
virtual std::string | getFullPath () const |
|
virtual std::string | getClassAndFullName () const |
|
virtual std::string | getClassAndFullPath () const |
|
const cObject * | getThisPtr () const |
|
virtual std::ostream & | printOn (std::ostream &os) const |
|
virtual bool | isSoftOwner () const |
|
virtual void | forEachChild (cVisitor *v) |
|
cObject * | findObject (const char *name, bool deep=true) |
|
virtual cClassDescriptor * | getDescriptor () const |
|
void | copyNotSupported () const |
|
virtual void extractByNedTypeName |
( |
const std::vector< std::string > & |
nedTypeNames | ) |
|
|
virtual |
Extracts model topology by the fully qualified NED type name of the modules. All modules whose getNedTypeName() is listed in the given string vector will get included.
Note: If you have all class names as a single, space-separated string, you can use cStringTokenizer to turn it into a string vector:
topo.extractByNedTypeName(cStringTokenizer("some.package.Host other.package.Router").asVector());
virtual void extractByProperty |
( |
const char * |
propertyName, |
|
|
const char * |
value = nullptr |
|
) |
| |
|
virtual |
Extracts model topology by a module property. All modules get included that have a property with the given name and the given value (more precisely, the first value of its default key being the specified value). If value is nullptr, the property's value may be anything except "false" (i.e. the first value of the default key may not be "false").
For example, topo.extractByProperty("node");
would extract all modules that contain the @node
property, like the following one:
module X {
@node;
}