LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2010 Universita' di Firenze, Italy | 3 * Copyright (c) 2010 Universita' di Firenze, Italy |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 22 matching lines...) Expand all Loading... |
33 TypeId TopologyReader::GetTypeId (void) | 33 TypeId TopologyReader::GetTypeId (void) |
34 { | 34 { |
35 static TypeId tid = TypeId ("ns3::TopologyReader") | 35 static TypeId tid = TypeId ("ns3::TopologyReader") |
36 .SetParent<Object> () | 36 .SetParent<Object> () |
37 ; | 37 ; |
38 return tid; | 38 return tid; |
39 } | 39 } |
40 | 40 |
41 TopologyReader::TopologyReader () | 41 TopologyReader::TopologyReader () |
42 { | 42 { |
43 NS_LOG_FUNCTION_NOARGS (); | 43 NS_LOG_FUNCTION (this); |
44 } | 44 } |
| 45 |
45 TopologyReader::~TopologyReader () | 46 TopologyReader::~TopologyReader () |
46 { | 47 { |
47 NS_LOG_FUNCTION_NOARGS (); | 48 NS_LOG_FUNCTION (this); |
48 } | |
49 void | |
50 TopologyReader::DoDispose () | |
51 { | |
52 NS_LOG_FUNCTION_NOARGS (); | |
53 | |
54 Object::DoDispose (); | |
55 // end TopologyReader::DoDispose | |
56 } | 49 } |
57 | 50 |
58 void | 51 void |
59 TopologyReader::SetTopoFileName (const std::string fileName) | 52 TopologyReader::SetFileName (const std::string fileName) |
60 { | 53 { |
61 m_fileName = fileName; | 54 m_fileName = fileName; |
62 } | 55 } |
63 | 56 |
64 std::string | 57 std::string |
65 TopologyReader::GetTopoFileName () const | 58 TopologyReader::GetFileName () const |
66 { | 59 { |
67 return m_fileName; | 60 return m_fileName; |
68 } | 61 } |
69 | 62 |
| 63 /* Manipulating the address block */ |
| 64 |
| 65 TopologyReader::ConstLinksIterator |
| 66 TopologyReader::LinksBegin (void) const |
| 67 { |
| 68 return m_linksList.begin (); |
| 69 } |
| 70 |
| 71 TopologyReader::ConstLinksIterator |
| 72 TopologyReader::LinksEnd (void) const |
| 73 { |
| 74 return m_linksList.end (); |
| 75 } |
| 76 |
| 77 int |
| 78 TopologyReader::LinksSize (void) const |
| 79 { |
| 80 return m_linksList.size (); |
| 81 } |
| 82 |
| 83 bool |
| 84 TopologyReader::LinksEmpty (void) const |
| 85 { |
| 86 return m_linksList.empty (); |
| 87 } |
| 88 |
| 89 void |
| 90 TopologyReader::AddLink (Link link) |
| 91 { |
| 92 m_linksList.push_back (link); |
| 93 return; |
| 94 } |
| 95 |
| 96 |
| 97 TopologyReader::Link::Link ( Ptr<Node> fromPtr, std::string fromName, Ptr<Node>
toPtr, std::string toName ) |
| 98 { |
| 99 m_fromPtr = fromPtr; |
| 100 m_fromName = fromName; |
| 101 m_toPtr = toPtr; |
| 102 m_toName = toName; |
| 103 } |
| 104 |
| 105 TopologyReader::Link::Link () |
| 106 { |
| 107 } |
| 108 |
| 109 |
| 110 Ptr<Node> TopologyReader::Link::GetFromNode (void) const |
| 111 { |
| 112 return m_fromPtr; |
| 113 } |
| 114 |
| 115 std::string |
| 116 TopologyReader::Link::GetFromNodeName (void) const |
| 117 { |
| 118 return m_fromName; |
| 119 } |
| 120 |
| 121 Ptr<Node> |
| 122 TopologyReader::Link::GetToNode (void) const |
| 123 { |
| 124 return m_toPtr; |
| 125 } |
| 126 |
| 127 std::string |
| 128 TopologyReader::Link::GetToNodeName (void) const |
| 129 { |
| 130 return m_toName; |
| 131 } |
| 132 |
| 133 std::string |
| 134 TopologyReader::Link::GetAttribute (std::string name) |
| 135 { |
| 136 NS_ASSERT_MSG (m_linkAttr.find ("name") == m_linkAttr.end (), "Requested topol
ogy link attribute not found"); |
| 137 return m_linkAttr[name]; |
| 138 } |
| 139 |
| 140 bool |
| 141 TopologyReader::Link::GetAttributeFailSafe (std::string name, std::string &value
) |
| 142 { |
| 143 if ( m_linkAttr.find ("name") == m_linkAttr.end () ) |
| 144 { |
| 145 return false; |
| 146 } |
| 147 value = m_linkAttr[name]; |
| 148 return true; |
| 149 } |
| 150 |
| 151 void |
| 152 TopologyReader::Link::SetAttribute (std::string name, std::string &value) |
| 153 { |
| 154 m_linkAttr[name] = value; |
| 155 } |
| 156 |
| 157 TopologyReader::Link::ConstAttributesIterator |
| 158 TopologyReader::Link::AttributesBegin (void) |
| 159 { |
| 160 return m_linkAttr.begin (); |
| 161 } |
| 162 TopologyReader::Link::ConstAttributesIterator |
| 163 TopologyReader::Link::AttributesEnd (void) |
| 164 { |
| 165 return m_linkAttr.end (); |
| 166 } |
| 167 |
| 168 |
70 } /* namespace ns3 */ | 169 } /* namespace ns3 */ |
LEFT | RIGHT |