Main Page   Reference Manual   Namespace List   Compound List   Namespace Members   Compound Members   File Members  

class_fatal_channel.h
Go to the documentation of this file.
1 // $Header$
2 //
3 // Copyright (C) 2000 - 2004, by
4 //
5 // Carlo Wood, Run on IRC <carlo@alinoe.com>
6 // RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt
7 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61
8 //
9 // This file may be distributed under the terms of the Q Public License
10 // version 1.0 as appearing in the file LICENSE.QPL included in the
11 // packaging of this file.
12 //
13 
18 #ifndef LIBCWD_CLASS_FATAL_CHANNEL_H
19 #define LIBCWD_CLASS_FATAL_CHANNEL_H
20 
21 #ifndef LIBCWD_CONFIG_H
22 #include <libcwd/config.h>
23 #endif
24 #ifndef LIBCWD_MAX_LABEL_LEN_H
25 #include <libcwd/max_label_len.h>
26 #endif
27 #ifndef LIBCWD_CONTROL_FLAG_H
28 #include <libcwd/control_flag.h>
29 #endif
30 
31 namespace libcwd {
32 
33 //===================================================================================================
34 // class fatal_channel_ct
35 //
36 // A debug channel with a special characteristic: It terminates the application.
37 //
38 
39 class fatal_channel_ct {
40 private:
41  char WNS_label[max_label_len_c + 1]; // +1 for zero termination.
42  // A reference name for the represented debug channel
43  // This label will be printed in front of each output written to
44  // this debug channel.
45 
46  control_flag_t WNS_maskbit;
47  // The mask that contains the control bit.
48 
49 public:
50  //-------------------------------------------------------------------------------------------------
51  // Constructor
52  //
53 
54  // MT: All channel objects must be global so that `WNS_maskbit' is zero
55  // at the start of the program and initialization occurs before other
56  // threads share the object.
57  explicit fatal_channel_ct(char const* lbl, control_flag_t maskbit);
58  // Construct a special debug channel with label `lbl' and control bit `cb'.
59 
60  // MT: May only be called from the constructors of global objects (or single threaded functions).
61  void NS_initialize(char const* lbl, control_flag_t maskbit LIBCWD_COMMA_TSD_PARAM);
62  // Force initialization in case the constructor of this global object
63  // wasn't called yet. Does nothing when the object was already initialized.
64 
65 public:
66  control_flag_t get_maskbit() const;
67  char const* get_label() const;
68 };
69 
70 } // namespace libcwd
71 
72 #endif // LIBCWD_CLASS_FATAL_CHANNEL_H
73 
namespace for libcwd.
Definition: debug.cc:87
unsigned short const max_label_len_c
The maximum number of characters that are allowed in a debug channel label.
Definition: max_label_len.h:24
unsigned int control_flag_t
Definition: control_flag.h:31
Copyright © 2001 - 2004 Carlo Wood.  All rights reserved.