A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
fatal-impl.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 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: Quincy Tse <quincy.tse@nicta.com.au>
18
*/
19
20
#ifndef FATAL_IMPL_H
21
#define FATAL_IMPL_H
22
23
#include <ostream>
24
25
/**
26
* \file
27
* \ingroup fatalimpl
28
* ns3::FatalImpl::RegisterStream(), ns3::FatalImpl::UnregisterStream(),
29
* and ns3::FatalImpl::FlushStreams() declarations.
30
*/
31
32
/**
33
* \ingroup fatal
34
* \defgroup fatalimpl Fatal Implementation.
35
*/
36
37
namespace
ns3
38
{
39
40
/**
41
* \ingroup fatalimpl
42
* \brief Implementation namespace for fatal error handlers.
43
*/
44
namespace
FatalImpl
45
{
46
47
/**
48
* \ingroup fatalimpl
49
*
50
* \brief Register a stream to be flushed on abnormal exit.
51
*
52
* If a \c std::terminate() call is encountered after the
53
* stream had been registered and before it has been
54
* unregistered, \c stream->flush() will be called. Users of
55
* this function should ensure the stream remains valid until
56
* it had been unregistered.
57
*
58
* \param [in] stream The stream to be flushed on abnormal exit.
59
*/
60
void
RegisterStream
(std::ostream* stream);
61
62
/**
63
* \ingroup fatalimpl
64
*
65
* \brief Unregister a stream for flushing on abnormal exit.
66
*
67
* After a stream had been unregistered, \c stream->flush()
68
* will no longer be called should abnormal termination be
69
* encountered.
70
*
71
* If the stream is not registered, nothing will happen.
72
*
73
* \param [in] stream The stream to be unregistered.
74
*/
75
void
UnregisterStream
(std::ostream* stream);
76
77
/**
78
* \ingroup fatalimpl
79
*
80
* \brief Flush all currently registered streams.
81
*
82
* This function iterates through each registered stream and
83
* unregisters them. The default \c SIGSEGV handler is overridden
84
* when this function is being executed, and will be restored
85
* when this function returns.
86
*
87
* If a \c SIGSEGV is encountered (most likely due to a bad \c ostream*
88
* being registered, or a registered \c osteam* pointing to an
89
* \c ostream that had already been destroyed), this function will
90
* skip the bad \c ostream* and continue to flush the next stream.
91
* The function will then terminate raising \c SIGIOT (aka \c SIGABRT)
92
*
93
* DO NOT call this function until the program is ready to crash.
94
*/
95
void
FlushStreams
();
96
97
}
// namespace FatalImpl
98
}
// namespace ns3
99
100
#endif
ns3::FatalImpl::UnregisterStream
void UnregisterStream(std::ostream *stream)
Unregister a stream for flushing on abnormal exit.
Definition:
fatal-impl.cc:143
ns3::FatalImpl::RegisterStream
void RegisterStream(std::ostream *stream)
Register a stream to be flushed on abnormal exit.
Definition:
fatal-impl.cc:136
ns3::FatalImpl::FlushStreams
void FlushStreams()
Flush all currently registered streams.
Definition:
fatal-impl.cc:187
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
core
model
fatal-impl.h
Generated on Tue May 28 2024 23:34:30 for ns-3 by
1.9.6