finish Dispose -> DoDispose rework

Mathieu Lacage 2007-05-03 13:24:43 +02:00
parent e89d1692e5
commit b15d1043d1
10 changed files with 20 additions and 29 deletions

View File

@ -56,8 +56,6 @@ PointToPointNetDevice::~PointToPointNetDevice()
{
NS_DEBUG ("PointToPointNetDevice::~PointToPointNetDevice ()");
Dispose ();
delete m_queue;
m_queue = 0;
}
@ -102,14 +100,14 @@ PointToPointNetDevice::PointToPointNetDevice (const PointToPointNetDevice& nd)
}
void PointToPointNetDevice::Dispose()
void PointToPointNetDevice::DoDispose()
{
if (m_channel != 0)
{
m_channel->Unref ();
m_channel = 0;
}
NetDevice::Dispose ();
NetDevice::DoDispose ();
}
//

View File

@ -96,10 +96,6 @@ public:
* This is the destructor for the PointToPointNetDevice.
*/
virtual ~PointToPointNetDevice();
/**
*Dispose method for refcounting
*/
virtual void Dispose();
/**
* Assignment Operator for a PointToPointNetDevice
*
@ -172,6 +168,7 @@ public:
*/
void Receive (Packet& p);
protected:
virtual void DoDispose (void);
/**
* Get a copy of the attached Queue.
*

View File

@ -34,7 +34,7 @@ ApplicationList::ApplicationList(Node* n)
{}
void
ApplicationList::Dispose (void)
ApplicationList::DoDispose (void)
{
for (std::vector<Application*>::const_iterator i = m_apps.begin();
i != m_apps.end(); ++i)
@ -44,12 +44,11 @@ ApplicationList::Dispose (void)
app->Unref ();
}
m_apps.clear ();
NsUnknown::DoDispose ();
}
ApplicationList::~ApplicationList()
{ // Destructor, nothing needed as the SmartSet destroys itself
Dispose ();
}
{}
ApplicationList* ApplicationList::Copy(Node * n) const
{ // Copy this app list

View File

@ -38,7 +38,6 @@ public:
// Copy constructor not needed, default one is correct
virtual ~ApplicationList();
// Inherited from Capabilty
virtual void Dispose (void);
virtual ApplicationList* Copy(Node*) const;
virtual void SetNode(Node *); // Sets the node for all apps
virtual void Add(Application*); // Add an already new'ed app
@ -53,6 +52,8 @@ public:
uint32_t Count() const; // Number of applications
Application* Get(uint32_t i) const; // Get app by index
protected:
virtual void DoDispose (void);
private:
std::vector<Application*> m_apps;
};

View File

@ -58,12 +58,10 @@ Application::Application(const Application& o)
// \brief Application Destructor
Application::~Application()
{
Dispose ();
}
{}
void
Application::Dispose (void)
Application::DoDispose (void)
{
if (m_node != 0)
{

View File

@ -64,8 +64,6 @@ public:
Application& operator=(const Application&); // Assignment operator
virtual ~Application();
virtual void Dispose (void);
virtual Application* Copy() const = 0; // All applications must provide
// \brief Specify application start time
@ -129,6 +127,7 @@ protected:
// subclasses.
virtual void StopApplication();
virtual void DoDispose (void);
private:
// Helpers
void ScheduleStart();

View File

@ -235,7 +235,7 @@ NetDevice::SetReceiveCallback (Callback<bool,NetDevice *,const Packet &,uint16_t
}
void
NetDevice::Dispose()
NetDevice::DoDispose()
{}
}; // namespace ns3

View File

@ -158,8 +158,6 @@ public:
void SetReceiveCallback (Callback<bool,NetDevice *,const Packet &,uint16_t> cb);
virtual void Dispose();
protected:
/**
* Enable broadcast support. This method should be
@ -218,6 +216,8 @@ public:
*/
bool ForwardUp (Packet& p);
virtual void DoDispose (void);
private:
/**
* \param p packet to send

View File

@ -87,12 +87,10 @@ OnOffApplication::OnOffApplication(Node * n, const OnOffApplication& c)
}
OnOffApplication::~OnOffApplication()
{
Dispose ();
}
{}
void
OnOffApplication::Dispose (void)
OnOffApplication::DoDispose (void)
{
if (m_socket != 0)
{
@ -106,7 +104,7 @@ OnOffApplication::Dispose (void)
m_offTime = 0;
// chain up
Application::Dispose ();
Application::DoDispose ();
}
#ifdef REMOVE_THIS

View File

@ -54,8 +54,6 @@ public:
virtual void StopApplication(); // Called at time specified by Stop
virtual OnOffApplication* Copy() const;// Make a copy of the application
virtual void Dispose (void);
// Event handlers
void StartSending();
void StopSending();
@ -63,6 +61,9 @@ public:
virtual void MaxBytes(uint32_t m) { m_maxBytes = m;}
protected:
virtual void DoDispose (void);
public: // Static methods
static void DefaultRate(uint64_t r) { g_defaultRate = r;}