A Discrete-Event Network Simulator
API
fatal-error.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 NS3_FATAL_ERROR_H
21#define NS3_FATAL_ERROR_H
22
23#include "fatal-impl.h"
24#include "log.h" // NS_LOG_APPEND...
25
26#include <cstdlib>
27#include <exception>
28#include <iostream>
29
72#define NS_FATAL_ERROR_IMPL_NO_MSG(fatal) \
73 do \
74 { \
75 NS_LOG_APPEND_TIME_PREFIX_IMPL; \
76 NS_LOG_APPEND_NODE_PREFIX_IMPL; \
77 std::cerr << "file=" << __FILE__ << ", line=" << __LINE__ << std::endl; \
78 ::ns3::FatalImpl::FlushStreams(); \
79 if (fatal) \
80 std::terminate(); \
81 } while (false)
82
101#define NS_FATAL_ERROR_IMPL(msg, fatal) \
102 do \
103 { \
104 std::cerr << "msg=\"" << msg << "\", "; \
105 NS_FATAL_ERROR_IMPL_NO_MSG(fatal); \
106 } while (false)
107
123#define NS_FATAL_ERROR_NO_MSG() NS_FATAL_ERROR_IMPL_NO_MSG(true)
124
139#define NS_FATAL_ERROR_NO_MSG_CONT() NS_FATAL_ERROR_IMPL_NO_MSG(false)
140
160#define NS_FATAL_ERROR(msg) NS_FATAL_ERROR_IMPL(msg, true)
161
176#define NS_FATAL_ERROR_CONT(msg) NS_FATAL_ERROR_IMPL(msg, false)
177
178#endif /* FATAL_ERROR_H */
ns3::FatalImpl::RegisterStream(), ns3::FatalImpl::UnregisterStream(), and ns3::FatalImpl::FlushStream...
Debug message logging.