|
|
| 21 |
#include "net-device-container.h" |
21 |
#include "net-device-container.h" |
| 22 |
#include "ns3/names.h" |
22 |
#include "ns3/names.h" |
| 23 |
|
23 |
|
|
|
24 |
#include <algorithm> |
| 25 |
|
| 24 |
namespace ns3 { |
26 |
namespace ns3 { |
| 25 |
|
27 |
|
| 26 |
NetDeviceContainer::NetDeviceContainer () |
28 |
NetDeviceContainer::NetDeviceContainer () |
|
|
| 83 |
m_devices.push_back (device); |
85 |
m_devices.push_back (device); |
| 84 |
} |
86 |
} |
| 85 |
|
87 |
|
|
|
88 |
void |
| 89 |
NetDeviceContainer::Remove (Ptr<NetDevice> device) |
| 90 |
{ |
| 91 |
m_devices.erase (std::remove (m_devices.begin (), m_devices.end (), device), m_devices.end ()); |
| 92 |
} |
| 93 |
void |
| 94 |
NetDeviceContainer::Remove (std::string deviceName) |
| 95 |
{ |
| 96 |
Ptr<NetDevice> device = Names::Find<NetDevice> (deviceName); |
| 97 |
m_devices.erase (std::remove (m_devices.begin (), m_devices.end (), device), m_devices.end ()); |
| 98 |
} |
| 99 |
|
| 100 |
bool |
| 101 |
NetDeviceContainer::operator== (const NetDeviceContainer &other) const |
| 102 |
{ |
| 103 |
uint32_t nMatching = 0; |
| 104 |
if (GetN () != other.GetN ()) |
| 105 |
{ |
| 106 |
return false; |
| 107 |
} |
| 108 |
for (uint32_t i = 0; i < GetN (); i++) |
| 109 |
{ |
| 110 |
if (Get (i) == other.Get (i)) |
| 111 |
{ |
| 112 |
nMatching++; |
| 113 |
} |
| 114 |
} |
| 115 |
if (nMatching == GetN ()) |
| 116 |
{ |
| 117 |
return true; |
| 118 |
} |
| 119 |
return false; |
| 120 |
} |
| 121 |
|
| 86 |
} // namespace ns3 |
122 |
} // namespace ns3 |