From 3d6e4532aeffb4e8e03d63b6f81a1c69ee6ab6a0 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Tue, 8 Jul 2008 14:27:45 -0700 Subject: [PATCH 1/2] avoid direct access to Object::m_tid. Use ObjectBase::GetInstanceTypeId instead. --- src/core/object.cc | 7 ++++--- src/core/object.h | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core/object.cc b/src/core/object.cc index 1b11fc782..9640d158b 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -113,7 +113,7 @@ Object::DoGetObject (TypeId tid) const const Object *currentObject = this; do { NS_ASSERT (currentObject != 0); - TypeId cur = currentObject->m_tid; + TypeId cur = currentObject->GetInstanceTypeId (); while (cur != tid && cur != Object::GetTypeId ()) { cur = cur.GetParent (); @@ -146,10 +146,11 @@ Object::AggregateObject (Ptr o) NS_ASSERT (CheckLoose ()); NS_ASSERT (o->CheckLoose ()); - if (DoGetObject (o->m_tid)) + if (DoGetObject (o->GetInstanceTypeId ())) { NS_FATAL_ERROR ("Object::AggregateObject(): " - "Multiple aggregation of objects of type " << o->m_tid.GetName ()); + "Multiple aggregation of objects of type " << + o->GetInstanceTypeId ().GetName ()); } Object *other = PeekPointer (o); diff --git a/src/core/object.h b/src/core/object.h index c28c3d6c8..225ef652a 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -379,7 +379,7 @@ template Ptr CopyObject (Ptr object) { Ptr p = Ptr (new T (*PeekPointer (object)), false); - NS_ASSERT (p->m_tid == object->m_tid); + NS_ASSERT (p->GetInstanceTypeId () == object->GetInstanceTypeId ()); return p; } @@ -387,7 +387,7 @@ template Ptr CopyObject (Ptr object) { Ptr p = Ptr (new T (*PeekPointer (object)), false); - NS_ASSERT (p->m_tid == object->m_tid); + NS_ASSERT (p->GetInstanceTypeId () == object->GetInstanceTypeId ()); return p; } From 5f9b651ba845d389b2218df26c5f9ed708012dcd Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Wed, 9 Jul 2008 18:34:42 +0100 Subject: [PATCH 2/2] Don't re-declare pure virtual methods from the parent Socket class. Fixes bug #249. --- src/node/tcp-socket.h | 17 ----------------- src/node/udp-socket.h | 16 ---------------- 2 files changed, 33 deletions(-) diff --git a/src/node/tcp-socket.h b/src/node/tcp-socket.h index 0a813b76b..413d87f62 100644 --- a/src/node/tcp-socket.h +++ b/src/node/tcp-socket.h @@ -51,23 +51,6 @@ public: TcpSocket (void); virtual ~TcpSocket (void); - virtual enum Socket::SocketErrno GetErrno (void) const = 0; - virtual Ptr GetNode (void) const = 0; - virtual int Bind () = 0; - virtual int Close (void) = 0; - virtual int ShutdownSend (void) = 0; - virtual int ShutdownRecv (void) = 0; - virtual int Connect (const Address &address) = 0; - virtual uint32_t GetTxAvailable (void) const = 0; - virtual int Send (Ptr p, uint32_t flags) = 0; - virtual int SendTo (Ptr p, uint32_t flags, - const Address &toAddress) = 0; - virtual uint32_t GetRxAvailable (void) const = 0; - virtual Ptr Recv (uint32_t maxSize, uint32_t flags) = 0; - virtual Ptr RecvFrom (uint32_t maxSize, uint32_t flags, - Address &fromAddress) = 0; - - private: // Indirect the attribute setting and getting through private virtual methods virtual void SetSndBufSize (uint32_t size) = 0; diff --git a/src/node/udp-socket.h b/src/node/udp-socket.h index fa20b885d..afe17774e 100644 --- a/src/node/udp-socket.h +++ b/src/node/udp-socket.h @@ -50,22 +50,6 @@ public: UdpSocket (void); virtual ~UdpSocket (void); - virtual enum Socket::SocketErrno GetErrno (void) const = 0; - virtual Ptr GetNode (void) const = 0; - virtual int Bind () = 0; - virtual int Close (void) = 0; - virtual int ShutdownSend (void) = 0; - virtual int ShutdownRecv (void) = 0; - virtual int Connect (const Address &address) = 0; - virtual uint32_t GetTxAvailable (void) const = 0; - virtual int Send (Ptr p, uint32_t flags) = 0; - virtual int SendTo (Ptr p, uint32_t flags, - const Address &toAddress) = 0; - virtual uint32_t GetRxAvailable (void) const = 0; - virtual Ptr Recv (uint32_t maxSize, uint32_t flags) = 0; - virtual Ptr RecvFrom (uint32_t maxSize, uint32_t flags, - Address &fromAddress) = 0; - private: // Indirect the attribute setting and getting through private virtual methods virtual void SetRcvBufSize (uint32_t size) = 0;