A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
ofswitch13-device-container.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015 University of Campinas (Unicamp)
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: Luciano Jerez Chaves <ljerezchaves@gmail.com>
18
*/
19
20
#include "
ofswitch13-device-container.h
"
21
22
#include <ns3/names.h>
23
24
namespace
ns3
25
{
26
27
OFSwitch13DeviceContainer::OFSwitch13DeviceContainer
()
28
{
29
}
30
31
OFSwitch13DeviceContainer::OFSwitch13DeviceContainer
(
Ptr<OFSwitch13Device>
dev)
32
{
33
m_devices
.emplace_back(dev);
34
}
35
36
OFSwitch13DeviceContainer::OFSwitch13DeviceContainer
(std::string devName)
37
{
38
Ptr<OFSwitch13Device>
dev = Names::Find<OFSwitch13Device>(devName);
39
m_devices
.emplace_back(dev);
40
}
41
42
OFSwitch13DeviceContainer::OFSwitch13DeviceContainer
(
43
const
OFSwitch13DeviceContainer
& a,
44
const
OFSwitch13DeviceContainer
& b)
45
{
46
*
this
= a;
47
Add
(b);
48
}
49
50
OFSwitch13DeviceContainer::Iterator
51
OFSwitch13DeviceContainer::Begin
()
const
52
{
53
return
m_devices
.begin();
54
}
55
56
OFSwitch13DeviceContainer::Iterator
57
OFSwitch13DeviceContainer::End
()
const
58
{
59
return
m_devices
.end();
60
}
61
62
uint32_t
63
OFSwitch13DeviceContainer::GetN
()
const
64
{
65
return
m_devices
.size();
66
}
67
68
Ptr<OFSwitch13Device>
69
OFSwitch13DeviceContainer::Get
(uint32_t i)
const
70
{
71
return
m_devices
[i];
72
}
73
74
void
75
OFSwitch13DeviceContainer::Add
(
OFSwitch13DeviceContainer
other)
76
{
77
for
(
Iterator
i = other.
Begin
(); i != other.
End
(); i++)
78
{
79
m_devices
.emplace_back(*i);
80
}
81
}
82
83
void
84
OFSwitch13DeviceContainer::Add
(
Ptr<OFSwitch13Device>
device)
85
{
86
m_devices
.emplace_back(device);
87
}
88
89
void
90
OFSwitch13DeviceContainer::Add
(std::string deviceName)
91
{
92
Ptr<OFSwitch13Device>
device = Names::Find<OFSwitch13Device>(deviceName);
93
m_devices
.emplace_back(device);
94
}
95
96
}
// namespace ns3
ns3::OFSwitch13DeviceContainer
Holds a vector of ns3::OFSwitch13Device pointers.
Definition:
ofswitch13-device-container.h:45
ns3::OFSwitch13DeviceContainer::OFSwitch13DeviceContainer
OFSwitch13DeviceContainer()
Create an empty OFSwitch13DeviceContainer.
Definition:
ofswitch13-device-container.cc:27
ns3::OFSwitch13DeviceContainer::Iterator
std::vector< Ptr< OFSwitch13Device > >::const_iterator Iterator
OFSwitch13Device container iterator.
Definition:
ofswitch13-device-container.h:48
ns3::OFSwitch13DeviceContainer::Add
void Add(OFSwitch13DeviceContainer other)
Append the contents of another OFSwitch13DeviceContainer to the end of this container.
Definition:
ofswitch13-device-container.cc:75
ns3::OFSwitch13DeviceContainer::m_devices
std::vector< Ptr< OFSwitch13Device > > m_devices
OFSwitch13Device pointers.
Definition:
ofswitch13-device-container.h:204
ns3::OFSwitch13DeviceContainer::Get
Ptr< OFSwitch13Device > Get(uint32_t i) const
Get the Ptr<OFSwitch13Device> stored in this container at a given index.
Definition:
ofswitch13-device-container.cc:69
ns3::OFSwitch13DeviceContainer::GetN
uint32_t GetN() const
Get the number of Ptr<OFSwitch13Device> stored in this container.
Definition:
ofswitch13-device-container.cc:63
ns3::OFSwitch13DeviceContainer::Begin
Iterator Begin() const
Get an iterator which refers to the first OpenFlow device in the container.
Definition:
ofswitch13-device-container.cc:51
ns3::OFSwitch13DeviceContainer::End
Iterator End() const
Get an iterator which indicates past-the-last OpenFlow device in the container.
Definition:
ofswitch13-device-container.cc:57
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:78
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ofswitch13-device-container.h
contrib
ofswitch13
helper
ofswitch13-device-container.cc
Generated on Fri Mar 31 2023 13:30:37 for ns-3 by
1.9.1