A Discrete-Event Network Simulator
API
ns3::OFSwitch13DeviceContainer Class Reference

Holds a vector of ns3::OFSwitch13Device pointers. More...

#include "ofswitch13-device-container.h"

+ Collaboration diagram for ns3::OFSwitch13DeviceContainer:

Public Types

typedef std::vector< Ptr< OFSwitch13Device > >::const_iterator Iterator
 OFSwitch13Device container iterator. More...
 

Public Member Functions

 OFSwitch13DeviceContainer ()
 Create an empty OFSwitch13DeviceContainer. More...
 
 OFSwitch13DeviceContainer (const OFSwitch13DeviceContainer &a, const OFSwitch13DeviceContainer &b)
 Create a device container which is a concatenation of the two input OFSwitch13DeviceContainers. More...
 
 OFSwitch13DeviceContainer (Ptr< OFSwitch13Device > dev)
 Create a OFSwitch13DeviceContainer with exactly one device that has previously been instantiated. More...
 
 OFSwitch13DeviceContainer (std::string devName)
 Create a OFSwitch13DeviceContainer with exactly one device. More...
 
void Add (OFSwitch13DeviceContainer other)
 Append the contents of another OFSwitch13DeviceContainer to the end of this container. More...
 
void Add (Ptr< OFSwitch13Device > device)
 Append a single Ptr<OFSwitch13Device> to this container. More...
 
void Add (std::string deviceName)
 Append to this container the single Ptr<OFSwitch13Device> referred to via its object name service registered name. More...
 
Iterator Begin () const
 Get an iterator which refers to the first OpenFlow device in the container. More...
 
Iterator End () const
 Get an iterator which indicates past-the-last OpenFlow device in the container. More...
 
Ptr< OFSwitch13DeviceGet (uint32_t i) const
 Get the Ptr<OFSwitch13Device> stored in this container at a given index. More...
 
uint32_t GetN () const
 Get the number of Ptr<OFSwitch13Device> stored in this container. More...
 

Private Attributes

std::vector< Ptr< OFSwitch13Device > > m_devices
 OFSwitch13Device pointers. More...
 

Detailed Description

Holds a vector of ns3::OFSwitch13Device pointers.

Typically OpenFlow Devices are aggregated to nodes using the OFSwitch13Helper. The helper InstallSwitch* methods takes a NodeContainer which holds some number of Ptr<Node>. For each of the Nodes in the NodeContainer the helper will instantiate an OpenFlow device and aggregate it to the node. For each of the devices, the helper also adds the device into a Container for later use by the caller. This is that container used to hold the Ptr<OFSwitch13Device> which are instantiated by the device helper.

Definition at line 44 of file ofswitch13-device-container.h.

Member Typedef Documentation

◆ Iterator

typedef std::vector<Ptr<OFSwitch13Device> >::const_iterator ns3::OFSwitch13DeviceContainer::Iterator

OFSwitch13Device container iterator.

Definition at line 48 of file ofswitch13-device-container.h.

Constructor & Destructor Documentation

◆ OFSwitch13DeviceContainer() [1/4]

ns3::OFSwitch13DeviceContainer::OFSwitch13DeviceContainer ( )

Create an empty OFSwitch13DeviceContainer.

Definition at line 27 of file ofswitch13-device-container.cc.

◆ OFSwitch13DeviceContainer() [2/4]

ns3::OFSwitch13DeviceContainer::OFSwitch13DeviceContainer ( Ptr< OFSwitch13Device dev)

Create a OFSwitch13DeviceContainer with exactly one device that has previously been instantiated.

Parameters
devAn OpenFlow device to add to the container.

Definition at line 31 of file ofswitch13-device-container.cc.

References m_devices.

◆ OFSwitch13DeviceContainer() [3/4]

ns3::OFSwitch13DeviceContainer::OFSwitch13DeviceContainer ( std::string  devName)

Create a OFSwitch13DeviceContainer with exactly one device.

Create a OFSwitch13DeviceContainer with exactly one device which has been previously instantiated and assigned a name using the Object name service. This OpenFlow device is specified by its assigned name.

Parameters
devNameThe name of the device to add to the container.

Definition at line 36 of file ofswitch13-device-container.cc.

References m_devices.

◆ OFSwitch13DeviceContainer() [4/4]

ns3::OFSwitch13DeviceContainer::OFSwitch13DeviceContainer ( const OFSwitch13DeviceContainer a,
const OFSwitch13DeviceContainer b 
)

Create a device container which is a concatenation of the two input OFSwitch13DeviceContainers.

Note
A frequently seen idiom that uses these constructors involves the implicit conversion by constructor of Ptr<OFSwitch13Device>. When used, two Ptr<OFSwitch13Device> will be passed to this constructor instead of OFSwitch13DeviceContainer&. C++ will notice the implicit conversion path that goes through the OFSwitch13DeviceContainer (Ptr<OFSwitch13Device> dev) constructor above. Using this conversion one may provide optionally provide arguments of Ptr<OFSwitch13Device> to these constructors.
Parameters
aA device container
bAnother device container

Definition at line 42 of file ofswitch13-device-container.cc.

References Add().

+ Here is the call graph for this function:

Member Function Documentation

◆ Add() [1/3]

void ns3::OFSwitch13DeviceContainer::Add ( OFSwitch13DeviceContainer  other)

Append the contents of another OFSwitch13DeviceContainer to the end of this container.

Parameters
otherThe OFSwitch13DeviceContainer to append.

Definition at line 75 of file ofswitch13-device-container.cc.

References Begin(), End(), and m_devices.

Referenced by OFSwitch13DeviceContainer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Add() [2/3]

void ns3::OFSwitch13DeviceContainer::Add ( Ptr< OFSwitch13Device device)

Append a single Ptr<OFSwitch13Device> to this container.

Parameters
deviceThe Ptr<OFSwitch13Device> to append.

Definition at line 84 of file ofswitch13-device-container.cc.

References m_devices.

◆ Add() [3/3]

void ns3::OFSwitch13DeviceContainer::Add ( std::string  deviceName)

Append to this container the single Ptr<OFSwitch13Device> referred to via its object name service registered name.

Parameters
deviceNameThe name of the OFSwitch13Device object to add to the container.

Definition at line 90 of file ofswitch13-device-container.cc.

References m_devices.

◆ Begin()

OFSwitch13DeviceContainer::Iterator ns3::OFSwitch13DeviceContainer::Begin ( ) const

Get an iterator which refers to the first OpenFlow device in the container.

OpenFlow devices can be retrieved from the container in two ways. First, directly by an index into the container, and second, using an iterator. This method is used in the iterator method and is typically used in a for-loop to run through the devices.

for (i = container.Begin (); i != container.End (); ++i)
{
(*i)->method (); // some OFSwitch13Device method
}
std::vector< Ptr< OFSwitch13Device > >::const_iterator Iterator
OFSwitch13Device container iterator.
Returns
an iterator which refers to the first device in the container.

Definition at line 51 of file ofswitch13-device-container.cc.

References m_devices.

Referenced by Add().

+ Here is the caller graph for this function:

◆ End()

OFSwitch13DeviceContainer::Iterator ns3::OFSwitch13DeviceContainer::End ( ) const

Get an iterator which indicates past-the-last OpenFlow device in the container.

OpenFlow devices can be retrieved from the container in two ways. First, directly by an index into the container, and second, using an iterator. This method is used in the iterator method and is typically used in a for-loop to run through the devices

for (i = container.Begin (); i != container.End (); ++i)
{
(*i)->method (); // some OFSwitch13Device method
}
Returns
an iterator which indicates an ending condition for a loop.

Definition at line 57 of file ofswitch13-device-container.cc.

References m_devices.

Referenced by Add().

+ Here is the caller graph for this function:

◆ Get()

Ptr< OFSwitch13Device > ns3::OFSwitch13DeviceContainer::Get ( uint32_t  i) const

Get the Ptr<OFSwitch13Device> stored in this container at a given index.

OpenFlow devices can be retrieved from the container in two ways.First, directly by an index into the container, and second, using an iterator. This method is used in the direct method and is used to retrieve the indexed Ptr<OFSwitch13Device>.

uint32_t nDevices = container.GetN ();
for (uint32_t i = 0 i < nDevices; ++i)
{
Ptr<OFSwitch13Device> p = container.Get (i);
p->method (); // some OFSwitch13Device method
}
Parameters
ithe index of the requested device pointer.
Returns
the requested device pointer.

Definition at line 69 of file ofswitch13-device-container.cc.

References m_devices.

◆ GetN()

uint32_t ns3::OFSwitch13DeviceContainer::GetN ( ) const

Get the number of Ptr<OFSwitch13Device> stored in this container.

OpenFlow devices can be retrieved from the container in two ways. First, directly by an index into the container, and second, using an iterator. This method is used in the direct method and is typically used to define an ending condition in a for-loop that runs through the stored devices

uint32_t nDevices = container.GetN ();
for (uint32_t i = 0 i < nDevices; ++i)
{
Ptr<OFSwitch13Device> p = container.Get (i);
p->method (); // some OFSwitch13Device method
}
Returns
the number of Ptr<OFSwitch13Device> stored in this container.

Definition at line 63 of file ofswitch13-device-container.cc.

References m_devices.

Member Data Documentation

◆ m_devices

std::vector<Ptr<OFSwitch13Device> > ns3::OFSwitch13DeviceContainer::m_devices
private

OFSwitch13Device pointers.

Definition at line 204 of file ofswitch13-device-container.h.

Referenced by OFSwitch13DeviceContainer(), Add(), Begin(), End(), Get(), and GetN().


The documentation for this class was generated from the following files: