From bf89dfdff33a102d9c7cf2fe14de687df40c49df Mon Sep 17 00:00:00 2001 From: Alexander Afanasyev Date: Mon, 12 Dec 2011 18:01:12 -0800 Subject: [PATCH] topology-read: Several extensions of TopologyReader --- src/topology-read/model/topology-reader.cc | 17 +++++++ src/topology-read/model/topology-reader.h | 56 ++++++++++++++-------- 2 files changed, 53 insertions(+), 20 deletions(-) diff --git a/src/topology-read/model/topology-reader.cc b/src/topology-read/model/topology-reader.cc index b531a6d98..82a834394 100644 --- a/src/topology-read/model/topology-reader.cc +++ b/src/topology-read/model/topology-reader.cc @@ -106,12 +106,23 @@ TopologyReader::Link::Link () { } +void +TopologyReader::Link::SetNetDevices (Ptr from, Ptr to) +{ + m_fromNetDevice = from; + m_toNetDevice = to; +} Ptr TopologyReader::Link::GetFromNode (void) const { return m_fromPtr; } +Ptr TopologyReader::Link::GetFromNetDevice (void) const +{ + return m_fromNetDevice; +} + std::string TopologyReader::Link::GetFromNodeName (void) const { @@ -124,6 +135,12 @@ TopologyReader::Link::GetToNode (void) const return m_toPtr; } +Ptr +TopologyReader::Link::GetToNetDevice (void) const +{ + return m_toNetDevice; +} + std::string TopologyReader::Link::GetToNodeName (void) const { diff --git a/src/topology-read/model/topology-reader.h b/src/topology-read/model/topology-reader.h index 3707e1548..bccfea40e 100644 --- a/src/topology-read/model/topology-reader.h +++ b/src/topology-read/model/topology-reader.h @@ -32,6 +32,8 @@ namespace ns3 { +class NetDevice; + /** * \ingroup topology * @@ -53,10 +55,10 @@ public: */ class Link { -public: - /** - * \brief Constant iterator to scan the map of link attributes. - */ + public: + /** + * \brief Constant iterator to scan the map of link attributes. + */ typedef std::map::const_iterator ConstAttributesIterator; /** @@ -66,13 +68,26 @@ public: * \param toPtr Ptr to the node the link is directed to * \param toName name of the node the link is directed to */ - Link ( Ptr fromPtr, const std::string &fromName, Ptr toPtr, const std::string &toName ); + Link (Ptr fromPtr, const std::string &fromName, Ptr toPtr, const std::string &toName); + /** + * \brief Set netdevices associated with the link + * \param from NetDevice associated with From node + * \param to NetDevice associated with To node + */ + void + SetNetDevices (Ptr from, Ptr to); + /** * \brief Returns a Ptr to the "from" node of the link * \return a Ptr to the "from" node of the link */ Ptr GetFromNode (void) const; + /** + * \brief Returns a Ptr of the "from" node of the link + * \return a Ptr of the "from" node of the link + */ + Ptr GetFromNetDevice (void) const; /** * \brief Returns the name of the "from" node of the link * \return the name of the "from" node of the link @@ -83,6 +98,11 @@ public: * \return a Ptr to the "to" node of the link */ Ptr GetToNode (void) const; + /** + * \brief Returns a Ptr of the "to" node of the link + * \return a Ptr of the "to" node of the link + */ + Ptr GetToNetDevice (void) const; /** * \brief Returns the name of the "to" node of the link * \return the name of the "to" node of the link @@ -123,11 +143,13 @@ public: private: Link (); - std::string m_fromName; //!< Name of the node the links originates from - Ptr< Node > m_fromPtr; //!< The node the links originates from - std::string m_toName; //!< Name of the node the links is directed to - Ptr< Node > m_toPtr; //!< The node the links is directed to - std::map m_linkAttr; ///< Container of the link attributes (if any) + std::string m_fromName; + Ptr< Node > m_fromPtr; + std::string m_toName; + Ptr< Node > m_toPtr; + Ptr< NetDevice > m_fromNetDevice; + Ptr< NetDevice > m_toNetDevice; + std::map m_linkAttr; }; /** @@ -199,6 +221,10 @@ private: */ void AddLink (Link link); +protected: + std::string m_fileName; + std::list m_linksList; + private: /** @@ -215,16 +241,6 @@ private: */ TopologyReader& operator= (const TopologyReader&); - /** - * the name of the input file - */ - std::string m_fileName; - - /** - * the container of the links between the nodes - */ - std::list m_linksList; - // end class TopologyReader };