samples/main-debug.cc
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Tue, 13 Feb 2007 18:20:24 +0100
changeset 275 0732d4283cc2
parent 272 8639c0a2d309
child 276 58651aff818b
permissions -rw-r--r--
regex: s/NS3_/NS_/
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
268
a43b635230e8 test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
a43b635230e8 test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
#include "ns3/debug.h"
a43b635230e8 test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
275
0732d4283cc2 regex: s/NS3_/NS_/
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 272
diff changeset
     4
NS_DEBUG_COMPONENT_DEFINE ("MyComponentA");
268
a43b635230e8 test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
a43b635230e8 test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
// declare other function
a43b635230e8 test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
namespace foo {
a43b635230e8 test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
void OneFunction (void);
a43b635230e8 test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
}
a43b635230e8 test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
a43b635230e8 test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
int main (int argc, int argv)
a43b635230e8 test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
{
275
0732d4283cc2 regex: s/NS3_/NS_/
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 272
diff changeset
    13
  NS_DEBUG ("nargc="<<argc);
268
a43b635230e8 test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
a43b635230e8 test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
  foo::OneFunction ();
a43b635230e8 test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
275
0732d4283cc2 regex: s/NS3_/NS_/
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 272
diff changeset
    17
  NS_DEBUG ("other debug output");
269
c79be9d4110a add NS3_ASSERT and NS3_ASSERT_MSG
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 268
diff changeset
    18
272
8639c0a2d309 avoid warning in optimized builds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 269
diff changeset
    19
  int a;
8639c0a2d309 avoid warning in optimized builds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 269
diff changeset
    20
  a = 0;
269
c79be9d4110a add NS3_ASSERT and NS3_ASSERT_MSG
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 268
diff changeset
    21
275
0732d4283cc2 regex: s/NS3_/NS_/
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 272
diff changeset
    22
  NS_ASSERT (a == 0);
0732d4283cc2 regex: s/NS3_/NS_/
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 272
diff changeset
    23
  NS_ASSERT_MSG (a == 0, "my msg");
0732d4283cc2 regex: s/NS3_/NS_/
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 272
diff changeset
    24
  NS_ASSERT (a != 0)
0732d4283cc2 regex: s/NS3_/NS_/
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 272
diff changeset
    25
  NS_ASSERT_MSG (a != 0, "my 2 msg");
268
a43b635230e8 test and debug the debug support
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
}