Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(821)

Unified Diff: src/topology-read/model/topology-reader.cc

Issue 15530043: New module pgbr (PGBR routing protocol) and extension of topology-read module
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/topology-read/model/topology-reader.h ('k') | src/topology-read/wscript » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/topology-read/model/topology-reader.cc
===================================================================
--- a/src/topology-read/model/topology-reader.cc
+++ b/src/topology-read/model/topology-reader.cc
@@ -33,8 +33,8 @@
TypeId TopologyReader::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::TopologyReader")
- .SetParent<Object> ()
- ;
+ .SetParent<Object> ()
+ ;
return tid;
}
@@ -133,18 +133,20 @@
std::string
TopologyReader::Link::GetAttribute (const std::string &name) const
{
- NS_ASSERT_MSG (m_linkAttr.find (name) != m_linkAttr.end (), "Requested topology link attribute not found");
- return m_linkAttr.find (name)->second;
+ std::map<std::string, std::string>::const_iterator it = m_linkAttr.find (name);
+ NS_ASSERT_MSG (it != m_linkAttr.end (), "Requested topology link attribute not found");
+ return it->second;
}
bool
TopologyReader::Link::GetAttributeFailSafe (const std::string &name, std::string &value) const
{
- if ( m_linkAttr.find (name) == m_linkAttr.end () )
+ std::map<std::string, std::string >::const_iterator it = m_linkAttr.find (name);
+ if (it == m_linkAttr.end () )
{
return false;
}
- value = m_linkAttr.find (name)->second;
+ value = it->second;
return true;
}
@@ -165,5 +167,96 @@
return m_linkAttr.end ();
}
+TopologyReader::ConstVerticesIterator
+TopologyReader::VerticesBegin (void) const
+{
+ return m_verticesList.begin ();
+}
+
+TopologyReader::ConstVerticesIterator
+TopologyReader::VerticesEnd (void) const
+{
+ return m_verticesList.end ();
+}
+
+int
+TopologyReader::VerticesSize (void) const
+{
+ return m_verticesList.size ();
+}
+
+bool
+TopologyReader::VerticesEmpty (void) const
+{
+ return m_verticesList.empty ();
+}
+
+void
+TopologyReader::AddVertex (Vertex vertex)
+{
+ m_verticesList.push_back (vertex);
+ return;
+}
+
+
+TopologyReader::Vertex::Vertex ( Ptr<Node> node, const std::string &nodeName)
+{
+ m_node = node;
+ m_nodeName = nodeName;
+}
+
+TopologyReader::Vertex::Vertex ()
+{
+}
+
+
+Ptr<Node> TopologyReader::Vertex::GetNode (void) const
+{
+ return m_node;
+}
+
+std::string
+TopologyReader::Vertex::GetNodeName (void) const
+{
+ return m_nodeName;
+}
+
+std::string
+TopologyReader::Vertex::GetAttribute (const std::string &name) const
+{
+ std::map<std::string, std::string>::const_iterator it = m_vertexAttr.find (name);
+ NS_ASSERT_MSG (it != m_vertexAttr.end (), "Requested topology vertex attribute not found");
+ return it->second;
+}
+
+bool
+TopologyReader::Vertex::GetAttributeFailSafe (std::string name, std::string &value) const
+{
+ std::map<std::string, std::string >::const_iterator it = m_vertexAttr.find (name);
+ if (it == m_vertexAttr.end () )
+ {
+ return false;
+ }
+ value = it->second;
+ return true;
+}
+
+void
+TopologyReader::Vertex::SetAttribute (const std::string &name, const std::string &value)
+{
+ m_vertexAttr[name] = value;
+}
+
+TopologyReader::Vertex::ConstAttributesIterator
+TopologyReader::Vertex::AttributesBegin (void)
+{
+ return m_vertexAttr.begin ();
+}
+TopologyReader::Vertex::ConstAttributesIterator
+TopologyReader::Vertex::AttributesEnd (void)
+{
+ return m_vertexAttr.end ();
+}
+
} /* namespace ns3 */
« no previous file with comments | « src/topology-read/model/topology-reader.h ('k') | src/topology-read/wscript » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b