convert use of <cassert> to "ns3/assert.h"
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Fri, 16 Feb 2007 09:56:21 +0100
changeset 286 57e6a2006962
parent 285 56866666cc24
child 287 692ddac3794c
convert use of <cassert> to "ns3/assert.h"
samples/main-callback.cc
samples/main-ptr.cc
src/common/buffer.cc
src/common/buffer.h
src/common/data-writer.cc
src/common/header.cc
src/common/packet.cc
src/common/tags.cc
src/common/tags.h
src/common/trace-container.cc
src/common/trace-container.h
src/common/trailer.cc
src/core/debug.cc
src/core/ptr.h
src/core/reference-list.h
src/core/unix-system-file.cc
src/node/arp-cache.cc
src/node/arp-header.cc
src/node/arp.cc
src/node/ipv4-header.cc
src/node/ipv4-route.cc
src/node/ipv4.cc
src/node/llc-snap-header.cc
src/node/mac-address.cc
src/node/net-device.cc
src/node/queue.cc
src/node/udp-socket.cc
src/node/udp.cc
src/simulator/high-precision-double.cc
src/simulator/high-precision.cc
src/simulator/nstime.h
src/simulator/scheduler-heap.cc
src/simulator/scheduler-list.cc
src/simulator/scheduler-map.cc
src/simulator/scheduler.cc
src/simulator/simulator.cc
utils/replay-simulation.cc
--- a/samples/main-callback.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/samples/main-callback.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 #include "ns3/callback.h"
-#include <cassert>
+#include "ns3/assert.h"
 #include <iostream>
 
 using namespace ns3;
@@ -30,7 +30,7 @@
   // build callback instance which points to cbOne function
   one = MakeCallback (&CbOne);
   // this is not a null callback
-  assert (!one.IsNull ());
+  NS_ASSERT (!one.IsNull ());
   // invoke cbOne function through callback instance
   double retOne;
   retOne = one (10.0, 20.0);
@@ -42,7 +42,7 @@
   // build callback instance which points to MyCb::cbTwo
   two = MakeCallback (&MyCb::CbTwo, &cb);
   // this is not a null callback
-  assert (!two.IsNull ());
+  NS_ASSERT (!two.IsNull ());
   // invoke MyCb::cbTwo through callback instance
   int retTwo;
   retTwo = two (10.0);    
@@ -52,7 +52,7 @@
   // invoking a null function pointer:
   // it will crash.
   //int retTwoNull = two (20.0);
-  assert (two.IsNull ());
+  NS_ASSERT (two.IsNull ());
 
   return 0;
 }
--- a/samples/main-ptr.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/samples/main-ptr.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -51,7 +51,7 @@
     Ptr<A> a = new A ();
     a->Method ();
     Ptr<A> prev = StoreA (a);
-    assert (prev == 0);
+    NS_ASSERT (prev == 0);
   }
 
   {
--- a/src/common/buffer.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/common/buffer.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -19,7 +19,7 @@
  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
  */
 #include "buffer.h"
-#include <cassert>
+#include "ns3/assert.h"
 
 #include <iostream>
 //#define TRACE(x) std::cout << x << std::endl;
@@ -38,7 +38,7 @@
     {
       reqSize = 1;
     }
-  assert (reqSize >= 1);
+  NS_ASSERT (reqSize >= 1);
   uint32_t size = reqSize - 1 + sizeof (struct Buffer::BufferData);
   uint8_t *b = new uint8_t [size];
   struct BufferData *data = reinterpret_cast<struct Buffer::BufferData*>(b);
@@ -60,7 +60,7 @@
 void
 Buffer::Recycle (struct Buffer::BufferData *data)
 {
-  assert (data->m_count == 0);
+  NS_ASSERT (data->m_count == 0);
   /* get rid of it if it is too small for later reuse. */
   if (data->m_size < (Buffer::m_maxTotalAddStart + Buffer::m_maxTotalAddEnd)) 
     {
@@ -98,7 +98,7 @@
     }
   struct Buffer::BufferData *data = Buffer::Allocate (m_maxTotalAddStart+m_maxTotalAddEnd,
                               m_maxTotalAddStart);
-  assert (data->m_count == 1);
+  NS_ASSERT (data->m_count == 1);
   return data;
 }
 #else
@@ -119,7 +119,7 @@
 }; // namespace ns3
 
 
-#include <cassert>
+#include "ns3/assert.h"
 
 namespace ns3 {
 
@@ -127,7 +127,7 @@
 void 
 Buffer::AddAtStart (uint32_t start)
 {
-  assert (m_start <= m_data->m_initialStart);
+  NS_ASSERT (m_start <= m_data->m_initialStart);
   bool isDirty = m_data->m_count > 1 && m_start > m_data->m_dirtyStart;
   if (m_start >= start && !isDirty) 
     {
@@ -139,7 +139,7 @@
     {
       /* enough space but need to move data around to fit new data */
       memmove (m_data->m_data + start, GetStart (), m_size);
-      assert (start > m_start);
+      NS_ASSERT (start > m_start);
       m_data->m_initialStart += start;
       m_start = 0;
       m_size += start;
@@ -163,7 +163,7 @@
   else 
     {
       /* enough space in the buffer but it is dirty ! */
-      assert (isDirty);
+      NS_ASSERT (isDirty);
       struct Buffer::BufferData *newData = Buffer::Create ();
       memcpy (newData->m_data + m_start, GetStart (), m_size);
       newData->m_initialStart = m_data->m_initialStart;
@@ -200,7 +200,7 @@
 void 
 Buffer::AddAtEnd (uint32_t end)
 {
-  assert (m_start <= m_data->m_initialStart);
+  NS_ASSERT (m_start <= m_data->m_initialStart);
   bool isDirty = m_data->m_count > 1 &&
       m_start + m_size < m_data->m_dirtyStart + m_data->m_dirtySize;
   if (m_start + m_size + end <= m_data->m_size && !isDirty) 
@@ -213,7 +213,7 @@
       /* enough space but need to move data around to fit the extra data */
       uint32_t newStart = m_data->m_size - (m_size + end);
       memmove (m_data->m_data + newStart, GetStart (), m_size);
-      assert (newStart < m_start);
+      NS_ASSERT (newStart < m_start);
       m_data->m_initialStart -= m_start - newStart;
       m_start = newStart;
       m_size += end;
@@ -237,7 +237,7 @@
   else 
     {
       /* enough space in the buffer but it is dirty ! */
-      assert (isDirty);
+      NS_ASSERT (isDirty);
       struct Buffer::BufferData *newData = Buffer::Create ();
       memcpy (newData->m_data + m_start, GetStart (), m_size);
       newData->m_initialStart = m_data->m_initialStart;
@@ -290,7 +290,7 @@
     } 
   else 
     {
-      assert (m_data->m_initialStart >= m_start);
+      NS_ASSERT (m_data->m_initialStart >= m_start);
       uint32_t zeroStart = m_data->m_initialStart - m_start;
       uint32_t zeroEnd = zeroStart + m_zeroAreaSize;
       uint32_t dataEnd = m_size + m_zeroAreaSize;
@@ -306,7 +306,7 @@
           m_start += zeroStart;
           uint32_t zeroDelta = start - zeroStart;
           m_zeroAreaSize -= zeroDelta;
-          assert (zeroDelta <= start);
+          NS_ASSERT (zeroDelta <= start);
           m_size -= zeroStart;
         } 
       else if (start <= dataEnd) 
@@ -346,12 +346,12 @@
     } 
   else 
     {
-      assert (m_data->m_initialStart >= m_start);
+      NS_ASSERT (m_data->m_initialStart >= m_start);
       uint32_t zeroStart = m_data->m_initialStart - m_start;
       uint32_t zeroEnd = zeroStart + m_zeroAreaSize;
       uint32_t dataEnd = m_size + m_zeroAreaSize;
-      assert (zeroStart <= m_size);
-      assert (zeroEnd <= m_size + m_zeroAreaSize);
+      NS_ASSERT (zeroStart <= m_size);
+      NS_ASSERT (zeroEnd <= m_size + m_zeroAreaSize);
       if (dataEnd <= end) 
         {
           /* remove all buffer */
@@ -362,7 +362,7 @@
       else if (dataEnd - zeroStart <= end) 
         {
           /* remove end of buffer, zero area, part of start of buffer */
-          assert (end >= m_zeroAreaSize);
+          NS_ASSERT (end >= m_zeroAreaSize);
           m_size -= end - m_zeroAreaSize;
           m_zeroAreaSize = 0;
         } 
@@ -406,8 +406,8 @@
 {
   if (m_zeroAreaSize != 0) 
     {
-      assert (m_data->m_initialStart >= m_start);
-      assert (m_size >= (m_data->m_initialStart - m_start));
+      NS_ASSERT (m_data->m_initialStart >= m_start);
+      NS_ASSERT (m_size >= (m_data->m_initialStart - m_start));
       Buffer tmp;
       tmp.AddAtStart (m_zeroAreaSize);
       tmp.Begin ().WriteU8 (0, m_zeroAreaSize);
--- a/src/common/buffer.h	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/common/buffer.h	Fri Feb 16 09:56:21 2007 +0100
@@ -361,7 +361,7 @@
    need to be inline for performance reasons.
  *************************************************/
 
-#include <cassert>
+#include "ns3/assert.h"
 
 namespace ns3 {
 
@@ -375,7 +375,7 @@
     {
       m_start = 0;
     }
-  assert (m_start <= m_data->m_size);
+  NS_ASSERT (m_start <= m_data->m_size);
 }
 
 Buffer::Buffer (uint32_t dataSize)
@@ -388,7 +388,7 @@
     {
       m_start = 0;
     }
-  assert (m_start <= m_data->m_size);
+  NS_ASSERT (m_start <= m_data->m_size);
 }
 
 
@@ -399,7 +399,7 @@
     m_size (o.m_size)
 {
   m_data->m_count++;
-  assert (m_start <= m_data->m_size);
+  NS_ASSERT (m_start <= m_data->m_size);
 }
 
 Buffer &
@@ -419,7 +419,7 @@
   m_zeroAreaSize = o.m_zeroAreaSize;
   m_start = o.m_start;
   m_size = o.m_size;
-  assert (m_start <= m_data->m_size);
+  NS_ASSERT (m_start <= m_data->m_size);
   return *this;
 }
 
@@ -475,31 +475,31 @@
 void 
 Buffer::Iterator::Next (void)
 {
-  assert (m_current + 1 <= m_dataEnd);
+  NS_ASSERT (m_current + 1 <= m_dataEnd);
   m_current++;
 }
 void 
 Buffer::Iterator::Prev (void)
 {
-  assert (m_current >= 1);
+  NS_ASSERT (m_current >= 1);
   m_current--;
 }
 void 
 Buffer::Iterator::Next (uint32_t delta)
 {
-  assert (m_current + delta <= m_dataEnd);
+  NS_ASSERT (m_current + delta <= m_dataEnd);
   m_current += delta;
 }
 void 
 Buffer::Iterator::Prev (uint32_t delta)
 {
-  assert (m_current >= delta);
+  NS_ASSERT (m_current >= delta);
   m_current -= delta;
 }
 int32_t
 Buffer::Iterator::GetDistanceFrom (Iterator const &o) const
 {
-  assert (m_data == o.m_data);
+  NS_ASSERT (m_data == o.m_data);
   int32_t start = m_current;
   int32_t end = o.m_current;
   return end - start;
@@ -519,7 +519,7 @@
 uint32_t
 Buffer::Iterator::GetIndex (uint32_t n)
 {
-  assert ( 
+  NS_ASSERT ( 
       (m_current + n <= m_dataEnd) &&
       ((m_current + n <= m_zeroStart) ||
        (m_current >= m_zeroEnd))
@@ -540,9 +540,9 @@
 void 
 Buffer::Iterator::Write (Iterator start, Iterator end)
 {
-  assert (start.m_data == end.m_data);
-  assert (start.m_current <= end.m_current);
-  assert (m_data != start.m_data);
+  NS_ASSERT (start.m_data == end.m_data);
+  NS_ASSERT (start.m_current <= end.m_current);
+  NS_ASSERT (m_data != start.m_data);
   uint32_t size = end.m_current - start.m_current;
   uint8_t *src = start.m_data + start.GetIndex (size);
   uint8_t *dest = m_data + GetIndex (size);
--- a/src/common/data-writer.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/common/data-writer.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -25,7 +25,7 @@
 #include <sys/poll.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <cassert>
+#include "ns3/assert.h"
 #include <string.h>
 #include <list>
 
@@ -71,7 +71,7 @@
 DataWriterPrivate::Open (char const *filename)
 {
   m_fd = ::Open (filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
-  assert (m_fd != -1);
+  NS_ASSERT (m_fd != -1);
 }
 
 #ifndef min
@@ -92,7 +92,7 @@
         {
           ssize_t written = 0;
           written = ::Write (m_fd, m_data, BUFFER_SIZE);
-          assert (written == BUFFER_SIZE);
+          NS_ASSERT (written == BUFFER_SIZE);
           m_current = 0;
         }
     }
--- a/src/common/header.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/common/header.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -20,7 +20,7 @@
  */
 
 #include "header.h"
-#include <cassert>
+#include "ns3/assert.h"
 
 namespace ns3 {
 
--- a/src/common/packet.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/common/packet.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -19,7 +19,7 @@
  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
  */
 #include "packet.h"
-#include <cassert>
+#include "ns3/assert.h"
 
 namespace ns3 {
 
@@ -81,7 +81,7 @@
 void 
 Packet::Remove (Header const &header)
 {
-  assert (header.IsDeserialized ());
+  NS_ASSERT (header.IsDeserialized ());
   m_buffer.RemoveAtStart (header.GetSize ());
 }
 void 
@@ -102,7 +102,7 @@
 void 
 Packet::Remove (Trailer const &trailer)
 {
-  assert (trailer.IsDeserialized ());
+  NS_ASSERT (trailer.IsDeserialized ());
   m_buffer.RemoveAtEnd (trailer.GetSize ());
 }
 
@@ -123,7 +123,7 @@
 void 
 Packet::AddAtEnd (Packet packet, uint32_t start, uint32_t size)
 {
-  assert (packet.GetSize () <= start + size);
+  NS_ASSERT (packet.GetSize () <= start + size);
   Buffer src = packet.m_buffer;
   m_buffer.AddAtEnd (src.GetSize ());
   Buffer::Iterator destStart = m_buffer.End ();
--- a/src/common/tags.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/common/tags.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -30,7 +30,7 @@
 void 
 TagRegistry::Record (std::string uuid, PrettyPrinter prettyPrinter)
 {
-  assert (!m_sorted);
+  NS_ASSERT (!m_sorted);
   m_registry.push_back (make_pair (uuid, prettyPrinter));
 }
 uint32_t 
@@ -41,7 +41,7 @@
   	std::sort (m_registry.begin (), m_registry.end ());
   	m_sorted = true;
     }
-  assert (m_sorted);
+  NS_ASSERT (m_sorted);
   uint32_t uid = 1;
   for (TagsDataCI i = m_registry.begin (); i != m_registry.end (); i++) 
     {
@@ -52,14 +52,14 @@
   	uid++;
     }
   // someone asked for a uid for an unregistered uuid.
-  assert (!"You tried to use unregistered tag: make sure you create an instance of type TagRegistration<YouTagType>.");
+  NS_ASSERT (!"You tried to use unregistered tag: make sure you create an instance of type TagRegistration<YouTagType>.");
   // quiet compiler
   return 0;
 }
 void 
 TagRegistry::PrettyPrint (uint32_t uid, uint8_t buf[Tags::SIZE], std::ostream &os)
 {
-  assert (m_registry.size () > uid);
+  NS_ASSERT (m_registry.size () > uid);
   PrettyPrinter prettyPrinter = m_registry[uid].second;
   if (prettyPrinter != 0) 
     {
--- a/src/common/tags.h	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/common/tags.h	Fri Feb 16 09:56:21 2007 +0100
@@ -109,7 +109,7 @@
 /**************************************************************
    An implementation of the templates defined above
  *************************************************************/
-#include <cassert>
+#include "ns3/assert.h"
 #include <string>
 
 namespace ns3 {
@@ -179,7 +179,7 @@
 template <typename T>
 TagRegistration<T>::TagRegistration (std::string uuid, void (*prettyPrinter) (T const*, std::ostream &))
 {
-  assert (sizeof (T) <= Tags::SIZE);
+  NS_ASSERT (sizeof (T) <= Tags::SIZE);
   m_prettyPrinter  = prettyPrinter;
   TagRegistry::Record (uuid, &TagRegistration<T>::PrettyPrinterCb);
   TypeUid<T>::Record (uuid);
@@ -188,7 +188,7 @@
 void 
 TagRegistration<T>::PrettyPrinterCb (uint8_t *buf, std::ostream &os)
 {
-  assert (sizeof (T) <= Tags::SIZE);
+  NS_ASSERT (sizeof (T) <= Tags::SIZE);
   T *tag = reinterpret_cast<T *> (buf);
   (*m_prettyPrinter) (tag, os);
 }
@@ -203,12 +203,12 @@
 void 
 Tags::Add (T const&tag)
 {
-  assert (sizeof (T) <= Tags::SIZE);
+  NS_ASSERT (sizeof (T) <= Tags::SIZE);
   uint8_t const*buf = reinterpret_cast<uint8_t const*> (&tag);
   // ensure this id was not yet added
   for (struct TagData *cur = m_next; cur != 0; cur = cur->m_next) 
     {
-      assert (cur->m_id != TypeUid<T>::GetUid ());
+      NS_ASSERT (cur->m_id != TypeUid<T>::GetUid ());
     }
   struct TagData *newStart = AllocData ();
   newStart->m_count = 1;
@@ -223,7 +223,7 @@
 bool
 Tags::Remove (T &tag)
 {
-  assert (sizeof (T) <= Tags::SIZE);
+  NS_ASSERT (sizeof (T) <= Tags::SIZE);
   return Remove (TypeUid<T>::GetUid ());
 }
 
@@ -231,7 +231,7 @@
 bool
 Tags::Peek (T &tag) const
 {
-  assert (sizeof (T) <= Tags::SIZE);
+  NS_ASSERT (sizeof (T) <= Tags::SIZE);
   uint8_t *buf = reinterpret_cast<uint8_t *> (&tag);
   for (struct TagData *cur = m_next; cur != 0; cur = cur->m_next) 
     {
--- a/src/common/trace-container.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/common/trace-container.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -22,7 +22,7 @@
 #include "trace-container.h"
 #include "stream-tracer.h"
 #include <utility>
-#include <cassert>
+#include "ns3/assert.h"
 
 namespace ns3 {
 
@@ -46,7 +46,7 @@
           return;
         }
     }
-  assert (false);
+  NS_ASSERT (false);
 }
 void 
 TraceContainer::SetSiVariableCallback (char const *name, Callback<void,int64_t, int64_t> callback)
@@ -59,12 +59,12 @@
           return;
         }
     }
-  assert (false);
+  NS_ASSERT (false);
 }
 void 
 TraceContainer::SetFVariableCallback (char const *name, Callback<void,double, double> callback)
 {
-  assert (false);
+  NS_ASSERT (false);
 }
 void 
 TraceContainer::SetStream (char const *name, std::ostream *os)
@@ -77,7 +77,7 @@
           return;
         }
     }
-  assert (false);
+  NS_ASSERT (false);
 }
 
 void 
@@ -111,7 +111,7 @@
 void 
 TraceContainer::RegisterFVariable (char const *name, FVariableTracerBase *var)
 {
-  assert (false);
+  NS_ASSERT (false);
 }
 
 void 
--- a/src/common/trace-container.h	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/common/trace-container.h	Fri Feb 16 09:56:21 2007 +0100
@@ -196,7 +196,7 @@
 
 }; // namespace ns3
 
-#include <cassert>
+#include "ns3/assert.h"
 
 namespace ns3 {
 
@@ -215,11 +215,11 @@
             }
           else
             {
-              assert (!"non-matching callback");
+              NS_ASSERT (!"non-matching callback");
             }
         }
     }
-  assert (false);
+  NS_ASSERT (false);
 }
 template <typename T1, typename T2>
 void 
@@ -236,11 +236,11 @@
             }
           else
             {
-              assert (!"non-matching callback");
+              NS_ASSERT (!"non-matching callback");
             }
         }
     }
-  assert (false);
+  NS_ASSERT (false);
 }
 template <typename T1, typename T2, typename T3>
 void 
@@ -257,11 +257,11 @@
             }
           else
             {
-              assert (!"non-matching callback");
+              NS_ASSERT (!"non-matching callback");
             }
         }
     }
-  assert (false);
+  NS_ASSERT (false);
 }
 template <typename T1, typename T2, typename T3, typename T4>
 void 
@@ -278,11 +278,11 @@
             }
           else
             {
-              assert (!"non-matching callback");
+              NS_ASSERT (!"non-matching callback");
             }
         }
     }
-  assert (false);
+  NS_ASSERT (false);
 }
 template <typename T1, typename T2, typename T3, typename T4, typename T5>
 void 
@@ -299,11 +299,11 @@
             }
           else
             {
-              assert (!"non-matching callback");
+              NS_ASSERT (!"non-matching callback");
             }
         }
     }
-  assert (false);
+  NS_ASSERT (false);
 }
 
 
--- a/src/common/trailer.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/common/trailer.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -20,7 +20,7 @@
  */
 
 #include "trailer.h"
-#include <cassert>
+#include "ns3/assert.h"
 
 namespace ns3 {
 
--- a/src/core/debug.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/core/debug.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -18,11 +18,11 @@
  *
  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
  */
-#include <cassert>
 #include <list>
 #include <utility>
 #include <iostream>
 #include "debug.h"
+#include "assert.h"
 #include "ns3/core-config.h"
 
 #ifdef HAVE_STDLIB_H
@@ -103,7 +103,7 @@
        i != g_components.end ();
        i++)
     {
-      assert (i->first.compare (name) != 0);
+      NS_ASSERT (i->first.compare (name) != 0);
     }
   g_components.push_back (std::make_pair (name, this));
 }
--- a/src/core/ptr.h	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/core/ptr.h	Fri Feb 16 09:56:21 2007 +0100
@@ -23,7 +23,7 @@
 #define PTR_H
 
 #include <stdint.h>
-#include <cassert>
+#include "assert.h"
 
 namespace ns3 {
 
@@ -246,7 +246,7 @@
 T *
 Ptr<T>::Remove (void) 
 {
-  assert ((*m_count) == 1);
+  NS_ASSERT ((*m_count) == 1);
   T *retval = m_ptr;
   m_ptr = 0;
   return retval;
--- a/src/core/reference-list.h	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/core/reference-list.h	Fri Feb 16 09:56:21 2007 +0100
@@ -101,7 +101,7 @@
   void RemoveFromList (void) {
       if (m_prev == this) 
         {
-          //assert (m_next == this);
+          //NS_ASSERT (m_next == this);
           delete m_objPtr;
           m_objPtr = OBJ_PTR ();
         }
--- a/src/core/unix-system-file.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/core/unix-system-file.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -25,10 +25,11 @@
 #include <sys/poll.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include <cassert>
 #include <string.h>
 #include <list>
 
+#include "assert.h"
+
 #define noTRACE_SYS_FILE 1
 
 #ifdef TRACE_SYS_FILE
@@ -71,7 +72,7 @@
 SystemFilePrivate::Open (char const *filename)
 {
   m_fd = ::open (filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
-  assert (m_fd != -1);
+  NS_ASSERT (m_fd != -1);
 }
 
 #ifndef min
@@ -92,7 +93,7 @@
         {
           ssize_t written = 0;
           written = ::write (m_fd, m_data, BUFFER_SIZE);
-          assert (written == BUFFER_SIZE);
+          NS_ASSERT (written == BUFFER_SIZE);
           m_current = 0;
         }
     }
--- a/src/node/arp-cache.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/node/arp-cache.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -18,7 +18,7 @@
  *
  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
  */
-#include <cassert>
+#include "ns3/assert.h"
 
 #include "ns3/packet.h"
 #include "ns3/simulator.h"
@@ -153,14 +153,14 @@
 ArpCache::Entry::MarkDead (void) 
 {
   m_state = DEAD;
-  //assert (m_waiting != 0);
+  //NS_ASSERT (m_waiting != 0);
   UpdateSeen ();
 }
 Packet 
 ArpCache::Entry::MarkAlive (MacAddress macAddress) 
 {
-  assert (m_state == WAIT_REPLY);
-  //assert (m_waiting != 0);
+  NS_ASSERT (m_state == WAIT_REPLY);
+  //NS_ASSERT (m_waiting != 0);
   m_macAddress = macAddress;
   m_state = ALIVE;
   UpdateSeen ();
@@ -172,7 +172,7 @@
 Packet 
 ArpCache::Entry::UpdateWaitReply (Packet waiting)
 {
-  assert (m_state == WAIT_REPLY);
+  NS_ASSERT (m_state == WAIT_REPLY);
   /* We are already waiting for an answer so
    * we dump the previously waiting packet and
    * replace it with this one.
@@ -184,8 +184,8 @@
 void 
 ArpCache::Entry::MarkWaitReply (Packet waiting)
 {
-  assert (m_state == ALIVE || m_state == DEAD);
-  //assert (m_waiting == 0);
+  NS_ASSERT (m_state == ALIVE || m_state == DEAD);
+  //NS_ASSERT (m_waiting == 0);
   m_state = WAIT_REPLY;
   m_waiting = waiting;
   UpdateSeen ();
@@ -194,7 +194,7 @@
 MacAddress
 ArpCache::Entry::GetMacAddress (void)
 {
-  assert (m_state == ALIVE);
+  NS_ASSERT (m_state == ALIVE);
   return m_macAddress;
 }
 bool 
@@ -212,7 +212,7 @@
     timeout = m_arp->GetAliveTimeout ();
     break;
   default:
-    assert (false);
+    NS_ASSERT (false);
     timeout = Seconds (0);
     /* NOTREACHED */
     break;
--- a/src/node/arp-header.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/node/arp-header.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -19,7 +19,7 @@
  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
  */
 
-#include <cassert>
+#include "ns3/assert.h"
 #include "arp-header.h"
 #include "header-utils.h"
 
@@ -96,7 +96,7 @@
     } 
   else 
     {
-      assert (IsReply ());
+      NS_ASSERT (IsReply ());
       os << " source mac: " << m_macSource
           << " source ipv4: " << m_ipv4Source
           << " dest mac: " << m_macDest
@@ -114,7 +114,7 @@
 ArpHeader::SerializeTo (Buffer::Iterator start) const
 {
   Buffer::Iterator i = start;
-  assert (m_macSource.GetLength () == m_macDest.GetLength ());
+  NS_ASSERT (m_macSource.GetLength () == m_macDest.GetLength ());
 
   /* ethernet */
   i.WriteHtonU16 (0x0001);
--- a/src/node/arp.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/node/arp.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -61,7 +61,7 @@
     }
   Ipv4Interface *interface = m_node->GetIpv4 ()->FindInterfaceForDevice (device);
   ArpCache * cache = new ArpCache (device, interface);
-  assert (device->IsBroadcast ());
+  NS_ASSERT (device->IsBroadcast ());
   device->SetLinkChangeCallback (MakeCallback (&ArpCache::Flush, cache));
   m_cacheList.push_back (cache);
   return cache;
--- a/src/node/ipv4-header.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/node/ipv4-header.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -19,7 +19,7 @@
  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
  */
 
-#include <cassert>
+#include "ns3/assert.h"
 #include "ns3/header.h"
 #include "ipv4-header.h"
 
@@ -137,13 +137,13 @@
 void 
 Ipv4Header::SetFragmentOffset (uint16_t offset)
 {
-  assert (!(offset & (~0x3fff)));
+  NS_ASSERT (!(offset & (~0x3fff)));
   m_fragmentOffset = offset;
 }
 uint16_t 
 Ipv4Header::GetFragmentOffset (void) const
 {
-  assert (!(m_fragmentOffset & (~0x3fff)));
+  NS_ASSERT (!(m_fragmentOffset & (~0x3fff)));
   return m_fragmentOffset;
 }
 
@@ -272,7 +272,7 @@
   uint8_t verIhl = i.ReadU8 ();
   uint8_t ihl = verIhl & 0x0f; 
   uint16_t headerSize = ihl * 4;
-  assert ((verIhl >> 4) == 4);
+  NS_ASSERT ((verIhl >> 4) == 4);
   m_tos = i.ReadU8 ();
   uint16_t size = i.ReadNtohU16 ();
   m_payloadSize = size - headerSize;
--- a/src/node/ipv4-route.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/node/ipv4-route.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -20,7 +20,7 @@
  */
 
 #include "ipv4-route.h"
-#include <cassert>
+#include "ns3/assert.h"
 
 namespace ns3 {
 
@@ -180,7 +180,7 @@
 {
   if (route.IsDefault ())
     {
-      assert (route.IsGateway ());
+      NS_ASSERT (route.IsGateway ());
       os << "default out=" << route.GetInterface () << ", next hop=" << route.GetGateway ();
     }
   else if (route.IsHost ())
@@ -215,7 +215,7 @@
     }
   else
     {
-      assert (false);
+      NS_ASSERT (false);
     }
   return os;
 }
--- a/src/node/ipv4.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/node/ipv4.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -129,7 +129,7 @@
        i != m_hostRoutes.end (); 
        i++) 
     {
-      assert ((*i)->IsHost ());
+      NS_ASSERT ((*i)->IsHost ());
       if ((*i)->GetDest ().IsEqual (dest)) 
         {
           return (*i);
@@ -139,7 +139,7 @@
        j != m_networkRoutes.end (); 
        j++) 
     {
-      assert ((*j)->IsNetwork ());
+      NS_ASSERT ((*j)->IsNetwork ());
       Ipv4Mask mask = (*j)->GetDestNetworkMask ();
       Ipv4Address entry = (*j)->GetDestNetwork ();
       if (mask.IsMatch (dest, entry)) 
@@ -149,7 +149,7 @@
     }
   if (m_defaultRoute != 0) 
     {
-      assert (m_defaultRoute->IsDefault ());
+      NS_ASSERT (m_defaultRoute->IsDefault ());
       return m_defaultRoute;
     }
   return 0;
@@ -204,7 +204,7 @@
         }
       tmp++;
     }
-  assert (false);
+  NS_ASSERT (false);
   // quiet compiler.
   return 0;
 }
@@ -250,7 +250,7 @@
         }
       tmp++;
     }
-  assert (false);
+  NS_ASSERT (false);
 }
 
 
@@ -365,7 +365,7 @@
   Packet packet = p;
   packet.Add (ip);
   Ipv4Interface *outInterface = GetInterface (route.GetInterface ());
-  assert (packet.GetSize () <= outInterface->GetMtu ());
+  NS_ASSERT (packet.GetSize () <= outInterface->GetMtu ());
   // XXX log trace here.
   if (route.IsGateway ()) 
     {
--- a/src/node/llc-snap-header.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/node/llc-snap-header.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -19,7 +19,7 @@
  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
  */
 
-#include <cassert>
+#include "ns3/assert.h"
 
 #include "llc-snap-header.h"
 
--- a/src/node/mac-address.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/node/mac-address.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -21,7 +21,7 @@
 
 #include <iostream>
 #include <iomanip>
-#include <cassert>
+#include "ns3/assert.h"
 #include "mac-address.h"
 
 #define ASCII_a (0x41)
@@ -56,7 +56,7 @@
 
 MacAddress::MacAddress (uint8_t const *address, uint8_t len)
 {
-  assert(len <= MacAddress::MAX_LEN);
+  NS_ASSERT (len <= MacAddress::MAX_LEN);
   for (int i=0; i < len; i++) 
     {
       m_address[i] = address[i];
@@ -164,7 +164,7 @@
         uint8_t b_p[MacAddress::MAX_LEN];
         a.Peek (a_p);
         b.Peek (b_p);
-        assert(a.GetLength() == b.GetLength());
+        NS_ASSERT (a.GetLength() == b.GetLength());
         for (uint8_t i = 0; i < a.GetLength(); i++) 
           {
             if (a_p[i] < b_p[i]) 
--- a/src/node/net-device.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/node/net-device.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -20,7 +20,7 @@
  */
 
 #include <iostream>
-#include <cassert>
+#include "ns3/assert.h"
 
 #include "net-device.h"
 #include "l3-demux.h"
@@ -93,7 +93,7 @@
 MacAddress const &
 NetDevice::GetBroadcast (void) const
 {
-  assert (m_isBroadcast);
+  NS_ASSERT (m_isBroadcast);
   return m_broadcast;
 }
 
--- a/src/node/queue.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/node/queue.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -69,8 +69,8 @@
       m_nBytes -= p.GetSize ();
       m_nPackets--;
 
-      assert(m_nBytes >= 0);
-      assert(m_nPackets >= 0);
+      NS_ASSERT (m_nBytes >= 0);
+      NS_ASSERT (m_nPackets >= 0);
 
       NS_DEBUG("Queue::Deque (): m_traceDeque (p)")
       m_traceDeque ("+ <timestamp> ", static_cast<const Packet &>(p));
@@ -84,7 +84,7 @@
 {
   NS_DEBUG("Queue::DequeAll ()")
 
-  assert (!"Don't know what to do with dequeued packets!");
+  NS_ASSERT (!"Don't know what to do with dequeued packets!");
 }
 
   uint32_t 
--- a/src/node/udp-socket.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/node/udp-socket.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -30,7 +30,7 @@
   : m_endPoint (0),
     m_node (node)
 {
-  assert (GetUdp () != 0);
+  NS_ASSERT (GetUdp () != 0);
 }
 UdpSocket::~UdpSocket ()
 {
--- a/src/node/udp.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/node/udp.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -19,7 +19,7 @@
  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
  */
 
-#include <cassert>
+#include "ns3/assert.h"
 #include "ns3/packet.h"
 #include "udp.h"
 #include "udp-header.h"
@@ -95,7 +95,7 @@
     }
   UdpSocket *socket = endPoint->GetSocket ();
   socket->ForwardUp (packet, source, udpHeader.GetSource ());
-  assert (socket != 0);
+  NS_ASSERT (socket != 0);
 }
 
 void
--- a/src/simulator/high-precision-double.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/simulator/high-precision-double.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -21,7 +21,7 @@
 #include "high-precision-double.h"
 
 #include <cmath>
-#include <cassert>
+#include "ns3/assert.h"
 
 
 namespace ns3 {
--- a/src/simulator/high-precision.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/simulator/high-precision.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -21,7 +21,7 @@
 #include "high-precision.h"
 
 #include <cmath>
-#include <cassert>
+#include "ns3/assert.h"
 
 
 namespace ns3 {
--- a/src/simulator/nstime.h	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/simulator/nstime.h	Fri Feb 16 09:56:21 2007 +0100
@@ -22,7 +22,7 @@
 #define TIME_H
 
 #include <stdint.h>
-#include <cassert>
+#include "ns3/assert.h"
 #include <ostream>
 #include "high-precision.h"
 
--- a/src/simulator/scheduler-heap.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/simulator/scheduler-heap.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -34,7 +34,7 @@
 
 #include "scheduler-heap.h"
 #include "event-impl.h"
-#include <cassert>
+#include "ns3/assert.h"
 
 #define noTRACE_HEAP 1
 
@@ -112,7 +112,7 @@
 void
 SchedulerHeap::Exch (uint32_t a, uint32_t b) 
 {
-  assert (b < m_heap.size () && a < m_heap.size ());
+  NS_ASSERT (b < m_heap.size () && a < m_heap.size ());
   TRACE ("Exch " << a << ", " << b);
   std::pair<EventImpl*, Scheduler::EventKey> tmp (m_heap[a]);
   m_heap[a] = m_heap[b];
@@ -191,7 +191,7 @@
     {
       return;
     }
-  assert (!IsBottom (index));
+  NS_ASSERT (!IsBottom (index));
   uint32_t left = LeftChild (index);
   if (IsBottom (left)) 
     {
@@ -248,7 +248,7 @@
           return retval;
         }
     }
-  assert (false);
+  NS_ASSERT (false);
   // quiet compiler
   return 0;
 }
--- a/src/simulator/scheduler-list.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/simulator/scheduler-list.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -22,7 +22,7 @@
 #include "scheduler-list.h"
 #include "event-impl.h"
 #include <utility>
-#include <cassert>
+#include "ns3/assert.h"
 
 namespace ns3 {
 
@@ -93,14 +93,14 @@
       if (i->second.m_uid == id.GetUid ())
         {
           EventImpl *retval = i->first;
-          assert (id.GetEventImpl () == retval);
+          NS_ASSERT (id.GetEventImpl () == retval);
           key->m_ns = id.GetNs ();
           key->m_uid = id.GetUid ();
           m_events.erase (i);
           return retval;
         }
     }
-  assert (false);
+  NS_ASSERT (false);
   return 0;
 }
 
--- a/src/simulator/scheduler-map.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/simulator/scheduler-map.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -22,7 +22,7 @@
 
 #include "scheduler-map.h"
 #include "event-impl.h"
-#include <cassert>
+#include "ns3/assert.h"
 
 #define noTRACE_MAP 1
 
@@ -76,7 +76,7 @@
 {
   std::pair<EventMapI,bool> result;
   result = m_list.insert (std::make_pair (key, event));
-  assert (result.second);
+  NS_ASSERT (result.second);
   return EventId (event, key.m_ns, key.m_uid);
 }
 
@@ -90,14 +90,14 @@
 SchedulerMap::RealPeekNext (void) const
 {
   EventMapCI i = m_list.begin ();
-  assert (i != m_list.end ());
+  NS_ASSERT (i != m_list.end ());
   return (*i).second;
 }
 Scheduler::EventKey
 SchedulerMap::RealPeekNextKey (void) const
 {
   EventMapCI i = m_list.begin ();
-  assert (i != m_list.end ());
+  NS_ASSERT (i != m_list.end ());
   return (*i).first;
 }
 void
--- a/src/simulator/scheduler.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/simulator/scheduler.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -20,7 +20,7 @@
  */
 
 #include "scheduler.h"
-#include <cassert>
+#include "ns3/assert.h"
 
 namespace ns3 {
 
@@ -40,25 +40,25 @@
 EventImpl *
 Scheduler::PeekNext (void) const
 {
-  assert (!RealIsEmpty ());
+  NS_ASSERT (!RealIsEmpty ());
   return RealPeekNext ();
 }
 Scheduler::EventKey 
 Scheduler::PeekNextKey (void) const 
 {
-  assert (!RealIsEmpty ());
+  NS_ASSERT (!RealIsEmpty ());
   return RealPeekNextKey ();
 }
 void 
 Scheduler::RemoveNext (void)
 {
-  assert (!RealIsEmpty ());
+  NS_ASSERT (!RealIsEmpty ());
   return RealRemoveNext ();
 }
 EventImpl *
 Scheduler::Remove (EventId id, EventKey *key)
 {
-  assert (!RealIsEmpty ());
+  NS_ASSERT (!RealIsEmpty ());
   return RealRemove (id, key);
 }
 
--- a/src/simulator/simulator.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/src/simulator/simulator.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -24,7 +24,7 @@
 #include "event-impl.h"
 
 #include <math.h>
-#include <cassert>
+#include "ns3/assert.h"
 #include <fstream>
 #include <list>
 #include <vector>
@@ -147,7 +147,7 @@
 uint64_t
 SimulatorPrivate::NextNs (void) const
 {
-  assert (!m_events->IsEmpty ());
+  NS_ASSERT (!m_events->IsEmpty ());
   Scheduler::EventKey nextKey = m_events->PeekNextKey ();
   return nextKey.m_ns;
 }
@@ -179,14 +179,14 @@
 void 
 SimulatorPrivate::StopAt (Time const &at)
 {
-  assert (at.IsPositive ());
+  NS_ASSERT (at.IsPositive ());
   m_stopAt = at.GetNanoSeconds ();
 }
 EventId
 SimulatorPrivate::Schedule (Time const &time, EventImpl *event)
 {
-  assert (time.IsPositive ());
-  assert (time >= NanoSeconds (m_currentNs));
+  NS_ASSERT (time.IsPositive ());
+  NS_ASSERT (time >= NanoSeconds (m_currentNs));
   uint64_t ns = (uint64_t) time.GetNanoSeconds ();
   Scheduler::EventKey key = {ns, m_uid};
   if (m_logEnable) 
@@ -296,7 +296,7 @@
 void 
 Simulator::SetExternal (SchedulerFactory const*factory)
 {
-  assert (factory != 0);
+  NS_ASSERT (factory != 0);
   m_schedFactory = factory;
   m_listType = EXTERNAL;
 }
@@ -326,7 +326,7 @@
           events = m_schedFactory->Create ();
       default: // not reached
           events = 0;
-          assert (false); 
+          NS_ASSERT (false); 
           break;
       }
       m_priv = new SimulatorPrivate (events);
--- a/utils/replay-simulation.cc	Fri Feb 16 09:42:53 2007 +0100
+++ b/utils/replay-simulation.cc	Fri Feb 16 09:56:21 2007 +0100
@@ -206,7 +206,7 @@
           //std::cout << "exec insert remove" << std::endl;
           EventId id = Simulator::Schedule (NanoSeconds (cmd.insertRemove.m_evNs) - Now (),
                                             &LogReader::ExecuteLogCommands, this, m_uid);
-          assert (id.GetUid () == m_uid);
+          NS_ASSERT (id.GetUid () == m_uid);
           if (cmd.insertRemove.m_evLoc + 1 > m_removeEvents.size ())
             {
               uint32_t missing = cmd.insertRemove.m_evLoc + 1 - m_removeEvents.size ();
@@ -218,7 +218,7 @@
           m_uid++;
         } break;
       default:
-        assert (false);
+        NS_ASSERT (false);
         break;
       }
       cmd = *m_command;