A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
abort.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 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: Original author unknown
18 * Quincy Tse <quincy.tse@nicta.com.au>
19 */
20#ifndef NS3_ABORT_H
21#define NS3_ABORT_H
22
23#include "fatal-error.h"
24
49#define NS_ABORT_MSG(msg) \
50 do \
51 { \
52 std::cerr << "aborted. "; \
53 NS_FATAL_ERROR(msg); \
54 } while (false)
55
76#define NS_ABORT_IF(cond) \
77 do \
78 { \
79 if (cond) \
80 { \
81 std::cerr << "aborted. cond=\"" << #cond << ", "; \
82 NS_FATAL_ERROR_NO_MSG(); \
83 } \
84 } while (false)
85
108#define NS_ABORT_MSG_IF(cond, msg) \
109 do \
110 { \
111 if (cond) \
112 { \
113 std::cerr << "aborted. cond=\"" << #cond << "\", "; \
114 NS_FATAL_ERROR(msg); \
115 } \
116 } while (false)
117
129#define NS_ABORT_UNLESS(cond) NS_ABORT_IF(!(cond))
130
144#define NS_ABORT_MSG_UNLESS(cond, msg) NS_ABORT_MSG_IF(!(cond), msg)
145
146#endif /* NS3_ABORT_H */
NS_FATAL_x macro definitions.