libcw
d
version 2.0.0
The C++ Debugging Support Library
Loading...
Searching...
No Matches
FatalChannel.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2000-2005, 2018, 2020, 2023, 2026 Carlo Wood
2
// SPDX-License-Identifier: MIT
3
4
#pragma once
5
9
10
#ifndef LIBCWD_CLASS_FATAL_CHANNEL_H
11
#define LIBCWD_CLASS_FATAL_CHANNEL_H
12
13
#include "
control_flag.h
"
14
#include "
max_label_len.h
"
15
#include "
libcwd/config.h
"
16
17
namespace
libcwd
{
18
19
namespace
_private_ {
20
struct
DebugChannels;
21
}
// namespace _private_
22
23
//===================================================================================================
24
// class FatalChannel
25
//
26
// A debug channel with a special characteristic: It terminates the application.
27
//
28
29
class
FatalChannel
30
{
31
friend
struct
_private_::DebugChannels;
32
33
private
:
34
char
label_[
max_label_len
+ 1];
// +1 for zero termination.
35
// Initialized before this channel is made visible to other threads and read-only
36
// afterward. A reference name for the represented debug channel This label will be
37
// printed in front of each output written to this debug channel.
38
39
control_flag_t
maskbit_;
40
// Written during initialization before this channel is made visible to other threads.
41
// The mask that contains the control bit.
42
43
public
:
44
//-------------------------------------------------------------------------------------------------
45
// Constructor
46
//
47
48
// MT: All channel objects must be global so that `maskbit_' is zero
49
// at the start of the program and initialization occurs before other
50
// threads share the object.
51
explicit
FatalChannel(
char
const
* lbl,
control_flag_t
maskbit);
52
// Construct a special debug channel with label `lbl' and control bit `cb'.
53
54
// MT: May only be called from the constructors of global objects (or single threaded functions).
55
void
NS_initialize(
char
const
* lbl,
control_flag_t
maskbit);
56
// Force initialization in case the constructor of this global object
57
// wasn't called yet. Does nothing when the object was already initialized.
58
59
public
:
60
control_flag_t
get_maskbit()
const
;
61
char
const
* get_label()
const
;
62
};
63
64
}
// namespace libcwd
65
66
#endif
// LIBCWD_CLASS_FATAL_CHANNEL_H
config.h
control_flag.h
libcwd::control_flag_t
unsigned int control_flag_t
Definition
control_flag.h:21
max_label_len.h
libcwd
namespace for libcwd.
libcwd::max_label_len
constexpr unsigned short max_label_len
The maximum number of characters that are allowed in a debug channel label.
Definition
max_label_len.h:16
libcwd
FatalChannel.h
Copyright © 2001-2004, 2026 Carlo Wood. All rights reserved. Generated by
1.16.1.