The base class for all ns3 applications. More...
#include <application.h>
Public Member Functions | |
Application () | |
virtual | ~Application () |
void | Start (const Time &startTime) |
Specify application start time. | |
void | Start (const RandomVariable &startVariable) |
Specify application start time. | |
void | Stop (const Time &stopTime) |
Specify application stop time. | |
void | Stop (const RandomVariable &stopVariable) |
Specify application stop time. | |
Ptr< Node > | GetNode () const |
void | SetNode (Ptr< Node > node) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
This method returns the TypeId associated to ns3::Application. | |
Protected Member Functions | |
virtual void | DoDispose (void) |
Private Member Functions | |
virtual void | StartApplication (void) |
Application specific startup code. | |
virtual void | StopApplication (void) |
Application specific shutdown code. | |
void | ScheduleStart (const Time &time) |
void | ScheduleStop (const Time &time) |
Private Attributes | |
EventId | m_startEvent |
EventId | m_stopEvent |
Ptr< Node > | m_node |
The base class for all ns3 applications.
Definition at line 61 of file application.h.
ns3::Application::Application | ( | ) |
Definition at line 48 of file application.cc.
ns3::Application::~Application | ( | ) | [virtual] |
Definition at line 52 of file application.cc.
void ns3::Application::DoDispose | ( | void | ) | [protected, virtual] |
This method is called by Object::Dispose or by the object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e., for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose method.
Reimplemented from ns3::Object.
Reimplemented in ns3::OnOffApplication, ns3::PacketSink, ns3::UdpEchoClient, ns3::UdpEchoServer, and ns3::V4Ping.
Definition at line 56 of file application.cc.
References ns3::Simulator::Cancel(), m_node, m_startEvent, and m_stopEvent.
Definition at line 87 of file application.cc.
References m_node.
Referenced by ns3::UdpEchoServer::StartApplication(), ns3::UdpEchoClient::StartApplication(), ns3::PacketSink::StartApplication(), and ns3::OnOffApplication::StartApplication().
TypeId ns3::Application::GetTypeId | ( | void | ) | [static] |
This method returns the TypeId associated to ns3::Application.
This object is accessible through the following paths with Config::Set and Config::Connect:
No Attributes defined for this type.
No TraceSources defined for this type.
Reimplemented from ns3::Object.
Reimplemented in ns3::OnOffApplication, ns3::PacketSink, ns3::UdpEchoClient, ns3::UdpEchoServer, and ns3::V4Ping.
Definition at line 39 of file application.cc.
References ns3::TypeId::SetParent().
void ns3::Application::ScheduleStart | ( | const Time & | time | ) | [private] |
Definition at line 110 of file application.cc.
References m_startEvent, ns3::Simulator::Schedule(), and StartApplication().
Referenced by Start().
void ns3::Application::ScheduleStop | ( | const Time & | time | ) | [private] |
Definition at line 116 of file application.cc.
References m_stopEvent, ns3::Simulator::Schedule(), and StopApplication().
Referenced by Stop().
node | the node to which this Application object is attached. |
Definition at line 93 of file application.cc.
References m_node.
void ns3::Application::Start | ( | const RandomVariable & | startVariable | ) |
Specify application start time.
startVariable | the random variable to use to pick the real start time as a relative time, in units of seconds, relative to the current simulation time. |
Definition at line 69 of file application.cc.
References ns3::RandomVariable::GetValue(), ScheduleStart(), and ns3::Seconds().
void ns3::Application::Start | ( | const Time & | startTime | ) |
Specify application start time.
startTime | Start time for this application, relative to the current simulation time. |
Applications start at various times in the simulation scenario. The Start method specifies when the application should be started. The application subclasses should override the private "StartApplication" method defined below, which is called at the time specified, to cause the application to begin.
Definition at line 64 of file application.cc.
References ScheduleStart().
void ns3::Application::StartApplication | ( | void | ) | [private, virtual] |
Application specific startup code.
The StartApplication method is called at the start time specifed by Start This method should be overridden by all or most application subclasses.
Reimplemented in ns3::OnOffApplication, ns3::PacketSink, ns3::UdpEchoClient, ns3::UdpEchoServer, and ns3::V4Ping.
Definition at line 100 of file application.cc.
Referenced by ScheduleStart().
void ns3::Application::Stop | ( | const RandomVariable & | stopVariable | ) |
Specify application stop time.
stopVariable | the random variable to use to pick the real stop time, in units of seconds, relative to the current simulation time. |
Definition at line 81 of file application.cc.
References ns3::RandomVariable::GetValue(), ScheduleStop(), and ns3::Seconds().
void ns3::Application::Stop | ( | const Time & | stopTime | ) |
Specify application stop time.
stopTime | Stop time for this application, relative to the current simulation time. |
Once an application has started, it is sometimes useful to stop the application. The Stop method specifies when an application is to stop. The application subclasses should override the private StopApplication method, to be notified when that time has come.
Definition at line 76 of file application.cc.
References ScheduleStop().
void ns3::Application::StopApplication | ( | void | ) | [private, virtual] |
Application specific shutdown code.
The StopApplication method is called at the stop time specifed by Stop This method should be overridden by all or most application subclasses.
Reimplemented in ns3::OnOffApplication, ns3::PacketSink, ns3::UdpEchoClient, ns3::UdpEchoServer, and ns3::V4Ping.
Definition at line 104 of file application.cc.
Referenced by ScheduleStop().
Ptr<Node> ns3::Application::m_node [private] |
Definition at line 146 of file application.h.
Referenced by DoDispose(), GetNode(), and SetNode().
EventId ns3::Application::m_startEvent [private] |
Definition at line 144 of file application.h.
Referenced by DoDispose(), and ScheduleStart().
EventId ns3::Application::m_stopEvent [private] |
Definition at line 145 of file application.h.
Referenced by DoDispose(), and ScheduleStop().