make capabilities and sockets refcounted
parent
5528c400d0
commit
e5d10e4bf7
|
@ -37,7 +37,7 @@ ApplicationList::Dispose (void)
|
|||
{
|
||||
Application *app = *i;
|
||||
app->Dispose ();
|
||||
delete app;
|
||||
app->Unref ();
|
||||
}
|
||||
m_apps.clear ();
|
||||
}
|
||||
|
|
|
@ -25,17 +25,19 @@
|
|||
#define __APPLICATION_LIST_H__
|
||||
|
||||
#include "application.h"
|
||||
#include "ns3/object.h"
|
||||
#include <vector>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class ApplicationList {
|
||||
class ApplicationList : public Object
|
||||
{
|
||||
public:
|
||||
ApplicationList(Node*);
|
||||
// Copy constructor not needed, default one is correct
|
||||
virtual ~ApplicationList();
|
||||
// Inherited from Capabilty
|
||||
void Dispose (void);
|
||||
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
|
||||
|
|
|
@ -49,13 +49,15 @@
|
|||
|
||||
#include "ns3/event-id.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/object.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class Node;
|
||||
class RandomVariable;
|
||||
|
||||
class Application {
|
||||
class Application : public Object
|
||||
{
|
||||
public:
|
||||
Application(Node *);
|
||||
Application(const Application&); // Copy constructor
|
||||
|
|
|
@ -78,20 +78,20 @@ void InternetNode::Dispose()
|
|||
if (m_l3Demux != 0)
|
||||
{
|
||||
m_l3Demux->Dispose ();
|
||||
delete m_l3Demux;
|
||||
m_l3Demux->Unref ();
|
||||
m_l3Demux = 0;
|
||||
}
|
||||
if (m_ipv4L4Demux != 0)
|
||||
{
|
||||
m_ipv4L4Demux->Dispose ();
|
||||
delete m_ipv4L4Demux;
|
||||
m_ipv4L4Demux->Unref ();
|
||||
m_ipv4L4Demux = 0;
|
||||
}
|
||||
|
||||
if (m_applicationList != 0)
|
||||
{
|
||||
m_applicationList->Dispose ();
|
||||
delete m_applicationList;
|
||||
m_applicationList->Unref ();
|
||||
m_applicationList = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ Ipv4L4Demux::Dispose (void)
|
|||
for (L4List_t::const_iterator i = m_protocols.begin(); i != m_protocols.end(); ++i)
|
||||
{
|
||||
(*i)->Dispose ();
|
||||
delete *i;
|
||||
(*i)->Unref ();
|
||||
}
|
||||
m_protocols.clear ();
|
||||
if (m_node != 0)
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#define IPV4_L4_DEMUX_H
|
||||
|
||||
#include <list>
|
||||
|
||||
#include "ns3/object.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
@ -38,7 +38,8 @@ class TraceContext;
|
|||
/**
|
||||
* \brief L4 Ipv4 Demux
|
||||
*/
|
||||
class Ipv4L4Demux {
|
||||
class Ipv4L4Demux : public Object
|
||||
{
|
||||
public:
|
||||
typedef int Ipv4L4ProtocolTraceType;
|
||||
Ipv4L4Demux (Node *node);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#ifndef IPV4_L4_PROTOCOL_H
|
||||
#define IPV4_L4_PROTOCOL_H
|
||||
|
||||
#include "ns3/object.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
@ -44,7 +45,8 @@ class TraceContext;
|
|||
* If you want to implement a new L4 protocol, all you have to do is
|
||||
* implement a subclass of this base class and add it to an L4Demux.
|
||||
*/
|
||||
class Ipv4L4Protocol {
|
||||
class Ipv4L4Protocol : public Object
|
||||
{
|
||||
public:
|
||||
Ipv4L4Protocol(int protocolNumber, int version);
|
||||
virtual ~Ipv4L4Protocol ();
|
||||
|
|
|
@ -46,7 +46,7 @@ L3Demux::Dispose (void)
|
|||
for (L3Map_t::iterator i = m_protocols.begin(); i != m_protocols.end(); ++i)
|
||||
{
|
||||
i->second->Dispose ();
|
||||
delete i->second;
|
||||
i->second->Unref ();
|
||||
}
|
||||
m_protocols.clear ();
|
||||
if (m_node != 0)
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#define L3_DEMUX_H
|
||||
|
||||
#include <map>
|
||||
#include "ns3/object.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
|
@ -39,7 +40,7 @@ class TraceContext;
|
|||
/**
|
||||
* \brief L3 Demux
|
||||
*/
|
||||
class L3Demux
|
||||
class L3Demux : public Object
|
||||
{
|
||||
public:
|
||||
typedef int ProtocolTraceType;
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#ifndef L3_PROTOCOL_H
|
||||
#define L3_PROTOCOL_H
|
||||
|
||||
#include "ns3/object.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class Packet;
|
||||
|
@ -36,7 +38,7 @@ class TraceContext;
|
|||
/**
|
||||
* ::Send is always defined in subclasses.
|
||||
*/
|
||||
class L3Protocol {
|
||||
class L3Protocol : public Object {
|
||||
public:
|
||||
L3Protocol(int protocolNumber, int version);
|
||||
virtual ~L3Protocol ();
|
||||
|
|
|
@ -95,11 +95,14 @@ OnOffApplication::~OnOffApplication()
|
|||
void
|
||||
OnOffApplication::Dispose (void)
|
||||
{
|
||||
delete m_socket;
|
||||
if (m_socket != 0)
|
||||
{
|
||||
m_socket->Unref ();
|
||||
m_socket = 0;
|
||||
}
|
||||
delete m_onTime;
|
||||
delete m_offTime;
|
||||
|
||||
m_socket = 0;
|
||||
m_onTime = 0;
|
||||
m_offTime = 0;
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "ns3/callback.h"
|
||||
#include "ipv4-address.h"
|
||||
#include "ns3/object.h"
|
||||
#include <stdint.h>
|
||||
|
||||
namespace ns3 {
|
||||
|
@ -38,7 +39,8 @@ class Node;
|
|||
* to the BSD API to make it easier those who know the BSD API to use
|
||||
* this API.
|
||||
*/
|
||||
class Socket {
|
||||
class Socket : public Object
|
||||
{
|
||||
public:
|
||||
virtual ~Socket();
|
||||
|
||||
|
|
Loading…
Reference in New Issue