A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
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
9
#include "
net-device-container.h
"
10
11
#include "ns3/names.h"
12
13
namespace
ns3
14
{
15
16
NetDeviceContainer::NetDeviceContainer
()
17
{
18
}
19
20
NetDeviceContainer::NetDeviceContainer
(
Ptr<NetDevice>
dev)
21
{
22
m_devices
.push_back(dev);
23
}
24
25
NetDeviceContainer::NetDeviceContainer
(std::string devName)
26
{
27
Ptr<NetDevice>
dev =
Names::Find<NetDevice>
(devName);
28
m_devices
.push_back(dev);
29
}
30
31
NetDeviceContainer::NetDeviceContainer
(
const
NetDeviceContainer
& a,
const
NetDeviceContainer
& b)
32
{
33
*
this
= a;
34
Add
(b);
35
}
36
37
NetDeviceContainer::Iterator
38
NetDeviceContainer::Begin
()
const
39
{
40
return
m_devices
.begin();
41
}
42
43
NetDeviceContainer::Iterator
44
NetDeviceContainer::End
()
const
45
{
46
return
m_devices
.end();
47
}
48
49
uint32_t
50
NetDeviceContainer::GetN
()
const
51
{
52
return
m_devices
.size();
53
}
54
55
Ptr<NetDevice>
56
NetDeviceContainer::Get
(
uint32_t
i)
const
57
{
58
return
m_devices
[i];
59
}
60
61
void
62
NetDeviceContainer::Add
(
NetDeviceContainer
other)
63
{
64
for
(
auto
i = other.
Begin
(); i != other.
End
(); i++)
65
{
66
m_devices
.push_back(*i);
67
}
68
}
69
70
void
71
NetDeviceContainer::Add
(
Ptr<NetDevice>
device)
72
{
73
m_devices
.push_back(device);
74
}
75
76
void
77
NetDeviceContainer::Add
(std::string deviceName)
78
{
79
Ptr<NetDevice>
device =
Names::Find<NetDevice>
(deviceName);
80
m_devices
.push_back(device);
81
}
82
83
}
// namespace ns3
ns3::Names::Find
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
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition
net-device-container.h:32
ns3::NetDeviceContainer::GetN
uint32_t GetN() const
Get the number of Ptr<NetDevice> stored in this container.
Definition
net-device-container.cc:50
ns3::NetDeviceContainer::Iterator
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Definition
net-device-container.h:35
ns3::NetDeviceContainer::Begin
Iterator Begin() const
Get an iterator which refers to the first NetDevice in the container.
Definition
net-device-container.cc:38
ns3::NetDeviceContainer::Add
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Definition
net-device-container.cc:62
ns3::NetDeviceContainer::m_devices
std::vector< Ptr< NetDevice > > m_devices
NetDevices smart pointers.
Definition
net-device-container.h:189
ns3::NetDeviceContainer::End
Iterator End() const
Get an iterator which indicates past-the-last NetDevice in the container.
Definition
net-device-container.cc:44
ns3::NetDeviceContainer::Get
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
Definition
net-device-container.cc:56
ns3::NetDeviceContainer::NetDeviceContainer
NetDeviceContainer()
Create an empty NetDeviceContainer.
Definition
net-device-container.cc:16
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
net-device-container.h
src
network
helper
net-device-container.cc
Generated on Fri Nov 8 2024 13:59:04 for ns-3 by
1.11.0