holds a vector of ns3::NetDevice pointers More...
#include <net-device-container.h>
Public Types | |
typedef std::vector< Ptr < NetDevice > >::const_iterator | Iterator |
Public Member Functions | |
NetDeviceContainer () | |
NetDeviceContainer (Ptr< NetDevice > dev) | |
NetDeviceContainer (std::string devName) | |
NetDeviceContainer (const NetDeviceContainer &a, const NetDeviceContainer &b) | |
Iterator | Begin (void) const |
Get an iterator which refers to the first NetDevice in the container. | |
Iterator | End (void) const |
Get an iterator which indicates past-the-last NetDevice in the container. | |
uint32_t | GetN (void) const |
Get the number of Ptr<NetDevice> stored in this container. | |
Ptr< NetDevice > | Get (uint32_t i) const |
Get the Ptr<NetDevice> stored in this container at a given index. | |
void | Add (NetDeviceContainer other) |
Append the contents of another NetDeviceContainer to the end of this container. | |
void | Add (Ptr< NetDevice > device) |
Append a single Ptr<NetDevice> to this container. | |
void | Add (std::string deviceName) |
Append to this container the single Ptr<NetDevice> referred to via its object name service registered name. |
holds a vector of ns3::NetDevice pointers
Typically ns-3 NetDevices are installed on nodes using a net device helper. The helper Install method takes a NodeContainer which holds some number of Ptr<Node>. For each of the Nodes in the NodeContainer the helper will instantiate a net device, add a MAC address and a queue to the device and install 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<NetDevice> which are instantiated by the device helper.
ns3::NetDeviceContainer::NetDeviceContainer | ( | ) |
Create an empty NetDeviceContainer.
dev | a device to add to the container |
Create a NetDeviceContainer with exactly one net device that has previously been instantiated
ns3::NetDeviceContainer::NetDeviceContainer | ( | std::string | devName | ) |
Create a NetDeviceContainer with exactly one device which has been previously instantiated and assigned a name using the Object name service. This NetDevice is specified by its assigned name.
devName | The name of the device to add to the container |
Create a NetDeviceContainer with exactly one device
ns3::NetDeviceContainer::NetDeviceContainer | ( | const NetDeviceContainer & | a, | |
const NetDeviceContainer & | b | |||
) |
a | a device container | |
b | another device container |
Create a device container which is a concatenation of the two input NetDeviceContainers.
void ns3::NetDeviceContainer::Add | ( | NetDeviceContainer | other | ) |
Append the contents of another NetDeviceContainer to the end of this container.
other | The NetDeviceContainer to append. |
void ns3::NetDeviceContainer::Add | ( | std::string | deviceName | ) |
Append to this container the single Ptr<NetDevice> referred to via its object name service registered name.
Append a single Ptr<NetDevice> to this container.
device | The Ptr<NetDevice> to append. |
Iterator ns3::NetDeviceContainer::Begin | ( | void | ) | const |
Get an iterator which refers to the first NetDevice in the container.
NetDevices 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 NetDevices
NetDeviceContainer::Iterator i; for (i = container.Begin (); i != container.End (); ++i) { (*i)->method (); // some NetDevice method }
Iterator ns3::NetDeviceContainer::End | ( | void | ) | const |
Get an iterator which indicates past-the-last NetDevice in the container.
NetDevices 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 NetDevices
NetDeviceContainer::Iterator i; for (i = container.Begin (); i != container.End (); ++i) { (*i)->method (); // some NetDevice method }
Get the Ptr<NetDevice> stored in this container at a given index.
NetDevices 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<NetDevice>.
uint32_t nDevices = container.GetN (); for (uint32_t i = 0 i < nDevices; ++i) { Ptr<NetDevice> p = container.Get (i) i->method (); // some NetDevice method }
i | the index of the requested device pointer. |
uint32_t ns3::NetDeviceContainer::GetN | ( | void | ) | const |
Get the number of Ptr<NetDevice> stored in this container.
NetDevices 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 NetDevices
uint32_t nDevices = container.GetN (); for (uint32_t i = 0 i < nDevices; ++i) { Ptr<NetDevice> p = container.Get (i) i->method (); // some NetDevice method }