ns3::NetDeviceContainer Class Reference

holds a vector of ns3::NetDevice pointers More...

#include <net-device-container.h>

List of all members.

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< NetDeviceGet (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.

Detailed Description

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.


Constructor & Destructor Documentation

ns3::NetDeviceContainer::NetDeviceContainer (  ) 
ns3::NetDeviceContainer::NetDeviceContainer ( Ptr< NetDevice dev  ) 
Parameters:
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.

Parameters:
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 
)
Parameters:
a a device container
b another device container

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

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

Member Function Documentation

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

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

Parameters:
deviceName The name of the NetDevice Object to add to the container.
void ns3::NetDeviceContainer::Add ( Ptr< NetDevice device  ) 

Append a single Ptr<NetDevice> to this container.

Parameters:
device The Ptr<NetDevice> to append.
void ns3::NetDeviceContainer::Add ( NetDeviceContainer  other  ) 

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

Parameters:
other The NetDeviceContainer 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
     }
Returns:
an iterator which refers to the first NetDevice in the container.
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
     }
Returns:
an iterator which indicates an ending condition for a loop.
Ptr<NetDevice> ns3::NetDeviceContainer::Get ( uint32_t  i  )  const

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
     }
Parameters:
i the index of the requested device pointer.
Returns:
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
     }
Returns:
the number of Ptr<NetDevice> stored in this container.

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

Generated on 6 Jan 2011 for NS-3 by  doxygen 1.6.1