24 #include "ns3/names.h"
25 #include "ns3/node-container.h"
49 .SetGroupName(
"TopologyReader")
69 std::map<std::string, Ptr<Node>> nodeMap;
72 if (!topgen.is_open())
79 std::istringstream lineBuffer;
92 getline(topgen, line);
97 if ((!from.empty()) && (!to.empty()))
99 NS_LOG_INFO(linksNumber <<
" From: " << from <<
" to: " << to);
102 Ptr<Node> tmpNode = CreateObject<Node>();
103 std::string nodename =
"OrbisTopology/NodeName/" + from;
105 nodeMap[from] = tmpNode;
112 Ptr<Node> tmpNode = CreateObject<Node>();
113 std::string nodename =
"OrbisTopology/NodeName/" + to;
115 nodeMap[to] = tmpNode;
120 Link link(nodeMap[from], from, nodeMap[to], to);
126 NS_LOG_INFO(
"Orbis topology created with " << nodesNumber <<
" nodes and " << linksNumber
static void Add(std::string name, Ptr< Object > object)
Add the association between the string "name" and the Ptr<Object> obj.
keep track of a set of node pointers.
Topology file reader (Orbis-format type).
static TypeId GetTypeId()
Get the type ID.
NodeContainer Read() override
Main topology reading function.
~OrbisTopologyReader() override
Inner class holding the details about a link between two nodes.
Interface for input file readers management.
void AddLink(Link link)
Adds a link to the topology.
std::string GetFileName() const
Returns the input file name.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::OrbisTopologyReader declaration.