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 void
Application::DoDispose (void) Application::DoDispose (void)
{ {
if (m_node != 0) m_node = 0;
{
m_node = 0;
}
if (m_start) if (m_start)
{ {
Simulator::Cancel(m_startEvent); Simulator::Cancel(m_startEvent);
@ -137,16 +134,8 @@ void Application::Stop(const RandomVariable& stopVar)
m_stopVar = stopVar.Copy(); m_stopVar = stopVar.Copy();
ScheduleStop(); 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; return m_node;
} }

View File

@ -102,10 +102,8 @@ void Start(const RandomVariable&);
// \brief Attaches an application to a specific node // \brief Attaches an application to a specific node
// Specifies which node object this application is associated with. // Specifies which node object this application is associated with.
// \param Node object to associate with this application. // \param Node object to associate with this application.
void SetNode(Ptr<Node>);
// \brief Returns the pointer to the attached node. // \brief Returns the pointer to the attached node.
Ptr<Node> PeekNode() const; Ptr<Node> GetNode() const;
// Members // Members
Ptr<Node> m_node; // All applications have an associated node 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)); this));
#endif #endif
IUdp *udp = PeekNode ()->QueryInterface<IUdp> (IUdp::iid); IUdp *udp = GetNode ()->QueryInterface<IUdp> (IUdp::iid);
m_socket = udp->CreateSocket (); m_socket = udp->CreateSocket ();
udp->Unref (); udp->Unref ();
m_socket->Connect (m_peerIP, m_peerPort); m_socket->Connect (m_peerIP, m_peerPort);