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