View | Details | Raw Unified | Return to bug 1684
Collapse All | Expand All

(-)a/src/network/helper/net-device-container.cc (+36 lines)
 Lines 21-26    Link Here 
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 ()
 Lines 83-86    Link Here 
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
(-)a/src/network/helper/net-device-container.h (+5 lines)
 Lines 194-199    Link Here 
194
   */
194
   */
195
  void Add (std::string deviceName);
195
  void Add (std::string deviceName);
196
196
197
  void Remove (Ptr<NetDevice> device);
198
  void Remove (std::string deviceName);
199
  
200
  bool operator== (const NetDeviceContainer &other) const;
201
197
private:
202
private:
198
  std::vector<Ptr<NetDevice> > m_devices;
203
  std::vector<Ptr<NetDevice> > m_devices;
199
};
204
};

Return to bug 1684