24 #include "topology-reader.h"
31 NS_OBJECT_ENSURE_REGISTERED (TopologyReader);
33 TypeId TopologyReader::GetTypeId (
void)
35 static TypeId tid = TypeId (
"ns3::TopologyReader")
41 TopologyReader::TopologyReader ()
46 TopologyReader::~TopologyReader ()
54 m_fileName = fileName;
68 return m_linksList.begin ();
74 return m_linksList.end ();
80 return m_linksList.size ();
86 return m_linksList.empty ();
92 m_linksList.push_back (link);
97 TopologyReader::Link::Link (
Ptr<Node> fromPtr,
const std::string &fromName,
Ptr<Node> toPtr,
const std::string &toName )
100 m_fromName = fromName;
105 TopologyReader::Link::Link ()
136 NS_ASSERT_MSG (m_linkAttr.find (name) != m_linkAttr.end (),
"Requested topology link attribute not found");
137 return m_linkAttr.find (name)->second;
143 if ( m_linkAttr.find (name) == m_linkAttr.end () )
147 value = m_linkAttr.find (name)->second;
154 m_linkAttr[name] = value;
160 return m_linkAttr.begin ();
165 return m_linkAttr.end ();
Ptr< Node > GetFromNode(void) const
Returns a Ptr<Node> to the "from" node of the link.
#define NS_LOG_FUNCTION(parameters)
ConstLinksIterator LinksBegin(void) const
Returns an iterator to the the first link in this block.
std::string GetFileName(void) const
Returns the input file name.
#define NS_LOG_COMPONENT_DEFINE(name)
std::string GetAttribute(const std::string &name) const
Returns the value of a link attribute. The attribute must exist.
bool LinksEmpty(void) const
Checks if the block contains any links.
void AddLink(Link link)
Adds a link to the topology.
std::string GetFromNodeName(void) const
Returns the name of the "from" node of the link.
Ptr< Node > GetToNode(void) const
Returns a Ptr<Node> to the "to" node of the link.
Inner class holding the details about a link between two nodes.
int LinksSize(void) const
Returns the number of links in this block.
ConstAttributesIterator AttributesBegin(void)
Returns an iterator to the begin of the attributes.
void SetFileName(const std::string &fileName)
Sets the input file name.
std::list< Link >::const_iterator ConstLinksIterator
Constant iterator to the list of the links.
std::map< std::string, std::string >::const_iterator ConstAttributesIterator
Constant iterator to scan the map of link attributes.
bool GetAttributeFailSafe(const std::string &name, std::string &value) const
Returns the value of a link attribute.
void SetAttribute(const std::string &name, const std::string &value)
Sets an arbitrary link attribute.
ConstAttributesIterator AttributesEnd(void)
Returns an iterator to the end of the attributes.
#define NS_ASSERT_MSG(condition, message)
std::string GetToNodeName(void) const
Returns the name of the "to" node of the link.
ConstLinksIterator LinksEnd(void) const
Returns an iterator to the the last link in this block.