A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::ApplicationContainer Class Reference

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

#include "application-container.h"

+ Collaboration diagram for ns3::ApplicationContainer:

Public Types

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

Public Member Functions

 ApplicationContainer ()
 Create an empty ApplicationContainer.
 
 ApplicationContainer (Ptr< Application > application)
 Create an ApplicationContainer with exactly one application which has been previously instantiated.
 
 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.
 
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.
 
Iterator Begin () const
 Get an iterator which refers to the first Application in the container.
 
Iterator End () const
 Get an iterator which indicates past-the-last Application in the container.
 
Ptr< ApplicationGet (uint32_t i) const
 Get the Ptr<Application> stored in this container at a given index.
 
uint32_t GetN () const
 Get the number of Ptr<Application> stored in this container.
 
void Start (Time start) const
 Start all of the Applications in this container at the start time given as a parameter.
 
void StartWithJitter (Time start, Ptr< RandomVariableStream > rv) const
 Start all of the Applications in this container at the start time given as a parameter, plus some jitter.
 
void Stop (Time stop) const
 Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
 

Private Attributes

std::vector< Ptr< Application > > m_applications
 Applications smart pointers.
 

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.

Definition at line 32 of file application-container.h.

Member Typedef Documentation

◆ Iterator

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

Application container iterator.

Definition at line 59 of file application-container.h.

Constructor & Destructor Documentation

◆ ApplicationContainer() [1/3]

ns3::ApplicationContainer::ApplicationContainer ( )

Create an empty ApplicationContainer.

Definition at line 19 of file application-container.cc.

◆ ApplicationContainer() [2/3]

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
applicationThe Ptr<Application> to add to the container.

Definition at line 23 of file application-container.cc.

References m_applications.

◆ ApplicationContainer() [3/3]

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
nameThe name of the Application Object to add to the container.

Definition at line 28 of file application-container.cc.

References ns3::Names::Find(), and m_applications.

+ Here is the call graph for this function:

Member Function Documentation

◆ Add() [1/3]

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

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

Parameters
otherThe ApplicationContainer to append.

Definition at line 59 of file application-container.cc.

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

Referenced by BuildAppsTest(), BuildAppsTest(), CsmaStarTestCase::DoRun(), EpcS1uUlTestCase::DoRun(), LteRadioLinkFailureTestCase::DoRun(), experiment(), experiment(), LteAggregationThroughputScaleTestCase::GetThroughput(), ns3::ApplicationHelper::Install(), and ns3::DhcpHelper::InstallDhcpClient().

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

◆ Add() [2/3]

void ns3::ApplicationContainer::Add ( Ptr< Application > application)

Append a single Ptr<Application> to this container.

Parameters
applicationThe Ptr<Application> to append.

Definition at line 68 of file application-container.cc.

References m_applications.

◆ Add() [3/3]

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
nameThe name of the Application Object to add to the container.

Definition at line 74 of file application-container.cc.

References ns3::Names::Find(), and m_applications.

+ Here is the call graph for this function:

◆ Begin()

ApplicationContainer::Iterator ns3::ApplicationContainer::Begin ( ) 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

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

Definition at line 35 of file application-container.cc.

References m_applications.

Referenced by Add(), Start(), StartWithJitter(), and Stop().

+ Here is the caller graph for this function:

◆ End()

ApplicationContainer::Iterator ns3::ApplicationContainer::End ( ) 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

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

Definition at line 41 of file application-container.cc.

References m_applications.

Referenced by Add(), Start(), StartWithJitter(), and Stop().

+ Here is the caller graph for this function:

◆ Get()

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<Application>.

uint32_t nApplications = container.GetN ();
for (uint32_t i = 0 i < nApplications; ++i)
{
Ptr<Application> p = container.Get (i)
i->method (); // some Application method
}
Smart pointer class similar to boost::intrusive_ptr.
Parameters
ithe index of the requested application pointer.
Returns
the requested application pointer.

Definition at line 53 of file application-container.cc.

References m_applications.

Referenced by BriteTopologyFunctionTestCase::DoRun(), BulkSendBasicTestCase::DoRun(), BulkSendSeqTsSizeTestCase::DoRun(), DhcpTestCase::DoRun(), EpcS1uDlTestCase::DoRun(), EpcS1uUlTestCase::DoRun(), Issue211Test::DoRun(), LteEpcE2eDataTestCase::DoRun(), LteX2HandoverMeasuresTestCase::DoRun(), LteX2HandoverTestCase::DoRun(), WifiAcMappingTest::DoRun(), WifiMsduAggregatorThroughputTest::DoRun(), GetRxBytes(), Experiment::Run(), and NeighborCacheExample::Run().

+ Here is the caller graph for this function:

◆ GetN()

uint32_t ns3::ApplicationContainer::GetN ( ) 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.

Definition at line 47 of file application-container.cc.

References m_applications.

Referenced by GetRxBytes().

+ Here is the caller graph for this function:

◆ Start()

void ns3::ApplicationContainer::Start ( Time start) const

Start all of the Applications in this container at the start 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 Application::SetStartTime() methods with the provided Time.

Parameters
startThe Time at which each of the applications should start.

Definition at line 81 of file application-container.cc.

References Begin(), and End().

Referenced by Experiment::ApplicationSetup(), BuildAppsTest(), BuildAppsTest(), CreateBulkFlow(), CreateOnOffFlow(), BriteTopologyFunctionTestCase::DoRun(), BulkSendBasicTestCase::DoRun(), BulkSendSeqTsSizeTestCase::DoRun(), CsmaMulticastTestCase::DoRun(), CsmaPacketSocketTestCase::DoRun(), CsmaPingTestCase::DoRun(), CsmaRawIpSocketTestCase::DoRun(), CsmaStarTestCase::DoRun(), DhcpTestCase::DoRun(), EpcS1uDlTestCase::DoRun(), EpcS1uUlTestCase::DoRun(), Issue211Test::DoRun(), LteEpcE2eDataTestCase::DoRun(), LteIpv6RoutingTestCase::DoRun(), LteRadioLinkFailureTestCase::DoRun(), Ns3TcpCubicTestCase::DoRun(), Ns3TcpLossTestCase::DoRun(), Ns3TcpNoDelayTestCase::DoRun(), Ns3TcpSocketTestCaseCsma::DoRun(), Ns3TcpSocketTestCaseP2P::DoRun(), Ns3TcpStateTestCase::DoRun(), RadvdTestCase::DoRun(), UdpClientServerTestCase::DoRun(), UdpTraceClientServerTestCase::DoRun(), WifiAcMappingTest::DoRun(), WifiMsduAggregatorThroughputTest::DoRun(), experiment(), LteAggregationThroughputScaleTestCase::GetThroughput(), AodvExample::InstallApplications(), DsdvManetExample::InstallApplications(), TracerouteExample::InstallApplications(), InstallBulkSend(), InstallPacketSink(), Experiment::Run(), Experiment::Run(), Experiment::Run(), Experiment::Run(), NeighborCacheExample::Run(), NetAnimExperiment::Run(), and RoutingExperiment::Run().

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

◆ StartWithJitter()

void ns3::ApplicationContainer::StartWithJitter ( Time start,
Ptr< RandomVariableStream > rv ) const

Start all of the Applications in this container at the start time given as a parameter, plus some jitter.

This method iterates through the contained Applications and calls their Application::SetStartTime() methods with the provided start Time, plus a jitter value drawn from the provided random variable.

Parameters
startThe Time at which each of the applications should start.
rvThe random variable that adds jitter (units of seconds)

Definition at line 91 of file application-container.cc.

References Begin(), End(), NS_LOG_DEBUG, and ns3::Seconds().

+ Here is the call graph for this function:

◆ Stop()

void ns3::ApplicationContainer::Stop ( Time stop) const

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 Application::SetStopTime() methods with the provided Time.

Parameters
stopThe Time at which each of the applications should stop.

Definition at line 103 of file application-container.cc.

References Begin(), and End().

Referenced by Experiment::ApplicationSetup(), BuildAppsTest(), BuildAppsTest(), CreateBulkFlow(), CreateOnOffFlow(), BriteTopologyFunctionTestCase::DoRun(), BulkSendBasicTestCase::DoRun(), BulkSendSeqTsSizeTestCase::DoRun(), CsmaMulticastTestCase::DoRun(), CsmaPacketSocketTestCase::DoRun(), CsmaPingTestCase::DoRun(), CsmaRawIpSocketTestCase::DoRun(), CsmaStarTestCase::DoRun(), DhcpTestCase::DoRun(), EpcS1uDlTestCase::DoRun(), EpcS1uUlTestCase::DoRun(), Issue211Test::DoRun(), LteIpv6RoutingTestCase::DoRun(), Ns3TcpCubicTestCase::DoRun(), Ns3TcpLossTestCase::DoRun(), Ns3TcpNoDelayTestCase::DoRun(), Ns3TcpSocketTestCaseCsma::DoRun(), Ns3TcpSocketTestCaseP2P::DoRun(), Ns3TcpStateTestCase::DoRun(), RadvdTestCase::DoRun(), WifiAcMappingTest::DoRun(), WifiMsduAggregatorThroughputTest::DoRun(), experiment(), AodvExample::InstallApplications(), DsdvManetExample::InstallApplications(), TracerouteExample::InstallApplications(), InstallBulkSend(), InstallPacketSink(), Experiment::Run(), Experiment::Run(), Experiment::Run(), Experiment::Run(), NetAnimExperiment::Run(), and RoutingExperiment::Run().

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

Member Data Documentation

◆ m_applications

std::vector<Ptr<Application> > ns3::ApplicationContainer::m_applications
private

Applications smart pointers.

Definition at line 217 of file application-container.h.

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


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