A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
assert.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2006 INRIA, 2010 NICTA
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18
* Quincy Tse <quincy.tse@nicta.com.au>
19
*/
20
#ifndef NS_ASSERT_H
21
#define NS_ASSERT_H
22
51
#ifdef NS3_ASSERT_ENABLE
52
53
#include "
fatal-error.h
"
54
55
#include <iostream>
56
66
#define NS_ASSERT(condition) \
67
do \
68
{ \
69
if (!(condition)) \
70
{ \
71
std::cerr << "assert failed. cond=\""
<< #condition << "\", "; \
72
NS_FATAL_ERROR_NO_MSG(); \
73
} \
74
} while (false)
75
86
#define NS_ASSERT_MSG(condition, message) \
87
do \
88
{ \
89
if (!(condition)) \
90
{ \
91
std::cerr << "assert failed. cond=\""
<< #condition << "\", "; \
92
NS_FATAL_ERROR(message); \
93
} \
94
} while (false)
95
96
#else
/* NS3_ASSERT_ENABLE */
97
98
#define NS_ASSERT(condition) \
99
do \
100
{ \
101
(void)sizeof(condition); \
102
} while (false)
103
104
#define NS_ASSERT_MSG(condition, message) \
105
do \
106
{ \
107
(void)sizeof(condition); \
108
} while (false)
109
110
#endif
/* NS3_ASSERT_ENABLE */
111
112
#endif
/* ASSERT_H */
fatal-error.h
NS_FATAL_x macro definitions.
src
core
model
assert.h
Generated on Tue Nov 1 2022 22:59:45 for ns-3 by
1.9.3