A Discrete-Event Network Simulator
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 
21 
22 #include <ns3/names.h>
23 
24 namespace ns3
25 {
26 
28 {
29 }
30 
32 {
33  m_devices.emplace_back(dev);
34 }
35 
37 {
38  Ptr<OFSwitch13Device> dev = Names::Find<OFSwitch13Device>(devName);
39  m_devices.emplace_back(dev);
40 }
41 
45 {
46  *this = a;
47  Add(b);
48 }
49 
52 {
53  return m_devices.begin();
54 }
55 
58 {
59  return m_devices.end();
60 }
61 
62 uint32_t
64 {
65  return m_devices.size();
66 }
67 
70 {
71  return m_devices[i];
72 }
73 
74 void
76 {
77  for (Iterator i = other.Begin(); i != other.End(); i++)
78  {
79  m_devices.emplace_back(*i);
80  }
81 }
82 
83 void
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
Holds a vector of ns3::OFSwitch13Device pointers.
OFSwitch13DeviceContainer()
Create an empty OFSwitch13DeviceContainer.
std::vector< Ptr< OFSwitch13Device > >::const_iterator Iterator
OFSwitch13Device container iterator.
void Add(OFSwitch13DeviceContainer other)
Append the contents of another OFSwitch13DeviceContainer to the end of this container.
std::vector< Ptr< OFSwitch13Device > > m_devices
OFSwitch13Device pointers.
Ptr< OFSwitch13Device > Get(uint32_t i) const
Get the Ptr<OFSwitch13Device> stored in this container at a given index.
uint32_t GetN() const
Get the number of Ptr<OFSwitch13Device> stored in this container.
Iterator Begin() const
Get an iterator which refers to the first OpenFlow device in the container.
Iterator End() const
Get an iterator which indicates past-the-last OpenFlow device in the container.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
Every class exported by the ns3 library is enclosed in the ns3 namespace.