implement properly Application::DoDispose and rename Application::PeekNOde to Application::GetNode

Mathieu Lacage 2007-05-10 08:19:53 +02:00
parent f5451f5bce
commit 60734cd2db
3 changed files with 4 additions and 17 deletions

View File

@ -61,10 +61,7 @@ Application::~Application()
void
Application::DoDispose (void)
{
if (m_node != 0)
{
m_node = 0;
}
if (m_start)
{
Simulator::Cancel(m_startEvent);
@ -138,15 +135,7 @@ void Application::Stop(const RandomVariable& stopVar)
ScheduleStop();
}
// \brief Assign this application to a given node
// Called by the application manager capability when adding
// an application to a node.
void Application::SetNode(Ptr<Node> n)
{
m_node = n;
}
Ptr<Node> Application::PeekNode() const
Ptr<Node> Application::GetNode() const
{
return m_node;
}

View File

@ -102,10 +102,8 @@ void Start(const RandomVariable&);
// \brief Attaches an application to a specific node
// Specifies which node object this application is associated with.
// \param Node object to associate with this application.
void SetNode(Ptr<Node>);
// \brief Returns the pointer to the attached node.
Ptr<Node> PeekNode() const;
Ptr<Node> GetNode() const;
// Members
Ptr<Node> m_node; // All applications have an associated node

View File

@ -170,7 +170,7 @@ void OnOffApplication::StartApplication() // Called at time specified by Star
this));
#endif
IUdp *udp = PeekNode ()->QueryInterface<IUdp> (IUdp::iid);
IUdp *udp = GetNode ()->QueryInterface<IUdp> (IUdp::iid);
m_socket = udp->CreateSocket ();
udp->Unref ();
m_socket->Connect (m_peerIP, m_peerPort);