Public Types | Public Member Functions

ns3::ApplicationContainer Class Reference

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

#include <application-container.h>

List of all members.

Public Types

typedef std::vector< Ptr
< Application >
>::const_iterator 
Iterator

Public Member Functions

 ApplicationContainer ()
 ApplicationContainer (Ptr< Application > application)
 ApplicationContainer (std::string name)
Iterator Begin (void) const
 Get an iterator which refers to the first Application in the container.
Iterator End (void) const
 Get an iterator which indicates past-the-last Application in the container.
uint32_t GetN (void) const
 Get the number of Ptr<Application> stored in this container.
Ptr< ApplicationGet (uint32_t i) const
 Get the Ptr<Application> stored in this container at a given index.
void Add (ApplicationContainer other)
 Append the contents of another ApplicationContainer to the end of this container.
void Add (Ptr< Application > application)
 Append a single Ptr<Application> to this container.
void Add (std::string name)
 Append to this container the single Ptr<Application> referred to via its object name service registered name.
void Start (Time start)
 Arrange for all of the Applications in this container to Start() at the Time given as a parameter.
void Stop (Time stop)
 Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.

Detailed Description

holds a vector of ns3::Application pointers.

Typically ns-3 Applications are installed on nodes using an Application 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 an application, install it in a node and add a Ptr<Application> to that application into a Container for use by the caller. This is that container used to hold the Ptr<Application> which are instantiated by the Application helper.


Constructor & Destructor Documentation

ns3::ApplicationContainer::ApplicationContainer (  ) 

Create an empty ApplicationContainer.

ns3::ApplicationContainer::ApplicationContainer ( Ptr< Application application  ) 

Create an ApplicationContainer with exactly one application which has been previously instantiated. The single application is specified by a smart pointer.

Parameters:
application The Ptr<Application> to add to the container.
ns3::ApplicationContainer::ApplicationContainer ( std::string  name  ) 

Create an ApplicationContainer with exactly one application which has been previously instantiated and assigned a name using the Object Name Service. This Application is then specified by its assigned name.

Parameters:
name The name of the Application Object to add to the container.

Member Function Documentation

void ns3::ApplicationContainer::Add ( ApplicationContainer  other  ) 

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

Parameters:
other The ApplicationContainer to append.
void ns3::ApplicationContainer::Add ( Ptr< Application application  ) 

Append a single Ptr<Application> to this container.

Parameters:
application The Ptr<Application> to append.
void ns3::ApplicationContainer::Add ( std::string  name  ) 

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

Parameters:
name The name of the Application Object to add to the container.
Iterator ns3::ApplicationContainer::Begin ( void   )  const

Get an iterator which refers to the first Application in the container.

Applications 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 Applications

   ApplicationContainer::Iterator i;
   for (i = container.Begin (); i != container.End (); ++i)
     {
       (*i)->method ();  // some Application method
     }
Returns:
an iterator which refers to the first Application in the container.
Iterator ns3::ApplicationContainer::End ( void   )  const

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

Applications 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 Applications

   ApplicationContainer::Iterator i;
   for (i = container.Begin (); i != container.End (); ++i)
     {
       (*i)->method ();  // some Application method
     }
Returns:
an iterator which indicates an ending condition for a loop.
Ptr<Application> ns3::ApplicationContainer::Get ( uint32_t  i  )  const

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

Applications 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<Appliation>.

   uint32_t nApplications = container.GetN ();
   for (uint32_t i = 0 i < nApplications; ++i)
     {
       Ptr<Application> p = container.Get (i)
       i->method ();  // some Application method
     }
Parameters:
i the index of the requested application pointer.
Returns:
the requested application pointer.
uint32_t ns3::ApplicationContainer::GetN ( void   )  const

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

Applications 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 Applications

   uint32_t nApplications = container.GetN ();
   for (uint32_t i = 0 i < nApplications; ++i)
     {
       Ptr<Application> p = container.Get (i)
       i->method ();  // some Application method
     }
Returns:
the number of Ptr<Application> stored in this container.
void ns3::ApplicationContainer::Start ( Time  start  ) 

Arrange for all of the Applications in this container to Start() at the Time given as a parameter.

All Applications need to be provided with a starting simulation time and a stopping simulation time. The ApplicationContainer is a convenient place for allowing all of the contained Applications to be told to wake up and start doing their thing (Start) at a common time.

This method simply iterates through the contained Applications and calls their Start() methods with the provided Time.

Parameters:
start The Time at which each of the applications should start.
void ns3::ApplicationContainer::Stop ( Time  stop  ) 

Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.

All Applications need to be provided with a starting simulation time and a stopping simulation time. The ApplicationContainer is a convenient place for allowing all of the contained Applications to be told to shut down and stop doing their thing (Stop) at a common time.

This method simply iterates through the contained Applications and calls their Stop() methods with the provided Time.

Parameters:
stop The Time at which each of the applications should stop.

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