A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
net-device-container.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008 INRIA
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18
*/
19
20
#include "
net-device-container.h
"
21
22
#include "ns3/names.h"
23
24
namespace
ns3
25
{
26
27
NetDeviceContainer::NetDeviceContainer
()
28
{
29
}
30
31
NetDeviceContainer::NetDeviceContainer
(
Ptr<NetDevice>
dev)
32
{
33
m_devices
.push_back(dev);
34
}
35
36
NetDeviceContainer::NetDeviceContainer
(std::string devName)
37
{
38
Ptr<NetDevice>
dev = Names::Find<NetDevice>(devName);
39
m_devices
.push_back(dev);
40
}
41
42
NetDeviceContainer::NetDeviceContainer
(
const
NetDeviceContainer
& a,
const
NetDeviceContainer
& b)
43
{
44
*
this
= a;
45
Add
(b);
46
}
47
48
NetDeviceContainer::Iterator
49
NetDeviceContainer::Begin
()
const
50
{
51
return
m_devices
.begin();
52
}
53
54
NetDeviceContainer::Iterator
55
NetDeviceContainer::End
()
const
56
{
57
return
m_devices
.end();
58
}
59
60
uint32_t
61
NetDeviceContainer::GetN
()
const
62
{
63
return
m_devices
.size();
64
}
65
66
Ptr<NetDevice>
67
NetDeviceContainer::Get
(uint32_t i)
const
68
{
69
return
m_devices
[i];
70
}
71
72
void
73
NetDeviceContainer::Add
(
NetDeviceContainer
other)
74
{
75
for
(
auto
i = other.
Begin
(); i != other.
End
(); i++)
76
{
77
m_devices
.push_back(*i);
78
}
79
}
80
81
void
82
NetDeviceContainer::Add
(
Ptr<NetDevice>
device)
83
{
84
m_devices
.push_back(device);
85
}
86
87
void
88
NetDeviceContainer::Add
(std::string deviceName)
89
{
90
Ptr<NetDevice>
device = Names::Find<NetDevice>(deviceName);
91
m_devices
.push_back(device);
92
}
93
94
}
// namespace ns3
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition:
net-device-container.h:43
ns3::NetDeviceContainer::GetN
uint32_t GetN() const
Get the number of Ptr<NetDevice> stored in this container.
Definition:
net-device-container.cc:61
ns3::NetDeviceContainer::Iterator
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Definition:
net-device-container.h:46
ns3::NetDeviceContainer::Begin
Iterator Begin() const
Get an iterator which refers to the first NetDevice in the container.
Definition:
net-device-container.cc:49
ns3::NetDeviceContainer::Add
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Definition:
net-device-container.cc:73
ns3::NetDeviceContainer::m_devices
std::vector< Ptr< NetDevice > > m_devices
NetDevices smart pointers.
Definition:
net-device-container.h:200
ns3::NetDeviceContainer::End
Iterator End() const
Get an iterator which indicates past-the-last NetDevice in the container.
Definition:
net-device-container.cc:55
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:67
ns3::NetDeviceContainer::NetDeviceContainer
NetDeviceContainer()
Create an empty NetDeviceContainer.
Definition:
net-device-container.cc:27
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
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 Sun Mar 3 2024 17:11:05 for ns-3 by
1.9.1