A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
net-device-container.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8
10
11#include "ns3/names.h"
12
13namespace ns3
14{
15
19
24
26{
28 m_devices.push_back(dev);
29}
30
36
39{
40 return m_devices.begin();
41}
42
45{
46 return m_devices.end();
47}
48
51{
52 return m_devices.size();
53}
54
57{
58 return m_devices[i];
59}
60
61void
63{
64 for (auto i = other.Begin(); i != other.End(); i++)
65 {
66 m_devices.push_back(*i);
67 }
68}
69
70void
72{
73 m_devices.push_back(device);
74}
75
76void
77NetDeviceContainer::Add(std::string deviceName)
78{
79 Ptr<NetDevice> device = Names::Find<NetDevice>(deviceName);
80 m_devices.push_back(device);
81}
82
83} // namespace ns3
static Ptr< T > Find(std::string path)
Given a name path string, look to see if there's an object in the system with that associated to it.
Definition names.h:443
holds a vector of ns3::NetDevice pointers
uint32_t GetN() const
Get the number of Ptr<NetDevice> stored in this container.
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Iterator Begin() const
Get an iterator which refers to the first NetDevice in the container.
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
std::vector< Ptr< NetDevice > > m_devices
NetDevices smart pointers.
Iterator End() const
Get an iterator which indicates past-the-last NetDevice in the container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
NetDeviceContainer()
Create an empty NetDeviceContainer.
Smart pointer class similar to boost::intrusive_ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.