--- a/src/topology-read/model/topology-reader.cc Mon Dec 12 19:00:45 2011 +0300
+++ b/src/topology-read/model/topology-reader.cc Tue Dec 13 00:14:44 2011 +0100
@@ -49,7 +49,7 @@
}
void
-TopologyReader::SetFileName (const std::string fileName)
+TopologyReader::SetFileName (const std::string &fileName)
{
m_fileName = fileName;
}
@@ -94,7 +94,7 @@
}
-TopologyReader::Link::Link ( Ptr<Node> fromPtr, std::string fromName, Ptr<Node> toPtr, std::string toName )
+TopologyReader::Link::Link ( Ptr<Node> fromPtr, const std::string &fromName, Ptr<Node> toPtr, const std::string &toName )
{
m_fromPtr = fromPtr;
m_fromName = fromName;
@@ -131,14 +131,14 @@
}
std::string
-TopologyReader::Link::GetAttribute (std::string name) const
+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;
}
bool
-TopologyReader::Link::GetAttributeFailSafe (std::string name, std::string &value) const
+TopologyReader::Link::GetAttributeFailSafe (const std::string &name, std::string &value) const
{
if ( m_linkAttr.find (name) == m_linkAttr.end () )
{
@@ -149,7 +149,7 @@
}
void
-TopologyReader::Link::SetAttribute (std::string name, std::string &value)
+TopologyReader::Link::SetAttribute (const std::string &name, const std::string &value)
{
m_linkAttr[name] = value;
}
--- a/src/topology-read/model/topology-reader.h Mon Dec 12 19:00:45 2011 +0300
+++ b/src/topology-read/model/topology-reader.h Tue Dec 13 00:14:44 2011 +0100
@@ -57,7 +57,7 @@
/**
* \brief Constant iterator to scan the map of link attributes.
*/
- typedef std::map<std::string, std::string >::const_iterator ConstAttributesIterator;
+ typedef std::map<std::string, std::string>::const_iterator ConstAttributesIterator;
/**
* \brief Constructor
@@ -66,7 +66,7 @@
* \param toPtr Ptr to the node the link is directed to
* \param toName name of the node the link is directed to
*/
- Link ( Ptr<Node> fromPtr, std::string fromName, Ptr<Node> toPtr, std::string toName );
+ Link ( Ptr<Node> fromPtr, const std::string &fromName, Ptr<Node> toPtr, const std::string &toName );
/**
* \brief Returns a Ptr<Node> to the "from" node of the link
@@ -95,7 +95,7 @@
*
* \return the value of the attribute
*/
- std::string GetAttribute (std::string name) const;
+ std::string GetAttribute (const std::string &name) const;
/**
* \brief Returns the value of a link attribute.
* \param name the name of the attribute
@@ -103,13 +103,13 @@
*
* \return true if the attribute was defined, false otherwise.
*/
- bool GetAttributeFailSafe (std::string name, std::string &value) const;
+ bool GetAttributeFailSafe (const std::string &name, std::string &value) const;
/**
* \brief Sets an arbitrary link attribute.
* \param name the name of the attribute
* \param value the value of the attribute
*/
- void SetAttribute (std::string name, std::string &value);
+ void SetAttribute (const std::string &name, const std::string &value);
/**
* \brief Returns an iterator to the begin of the attributes.
* \return a const iterator to the first attribute of a link.
@@ -127,7 +127,7 @@
Ptr< Node > m_fromPtr;
std::string m_toName;
Ptr< Node > m_toPtr;
- std::map<std::string, std::string > m_linkAttr;
+ std::map<std::string, std::string> m_linkAttr;
};
/**
@@ -157,7 +157,7 @@
* \brief Sets the input file name.
* \param fileName the input file name.
*/
- void SetFileName (const std::string fileName);
+ void SetFileName (const std::string &fileName);
/**
* \brief Returns the input file name.