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

class_channel_set.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_CHANNEL_SET_H
19 #define LIBCWD_CLASS_CHANNEL_SET_H
20 
21 #ifndef LIBCWD_CONFIG_H
22 #include <libcwd/config.h>
23 #endif
24 #ifndef LIBCWD_CONTROL_FLAG_H
25 #include <libcwd/control_flag.h>
26 #endif
27 #ifndef LIBCWD_PRIVATE_STRUCT_TSD_H
29 #endif
30 
31 namespace libcwd {
32 
33 class debug_ct;
34 struct debug_tsd_st;
35 class channel_ct;
36 class fatal_channel_ct;
37 
38 //===================================================================================================
39 // struct channel_set_data_st
40 //
41 // The attributes of channel_set_bootstrap_st, channel_set_st and continued_channel_set_st
42 //
43 
44 struct channel_set_data_st {
45 public:
46  char const* label;
47  // The label of the most left channel that is turned on.
48 
49  control_flag_t mask;
50  // The bit-wise OR mask of all control flags and special channels.
51 
52  bool on;
53  // Set if at least one of the provided channels is turned on.
54 
55  debug_tsd_st* do_tsd_ptr;
56  // Thread specific data of current debug object.
57 
58 #if CWDEBUG_DEBUG
59  channel_set_data_st() : do_tsd_ptr(NULL) { }
60 #endif
61 };
62 
63 //===================================================================================================
64 // struct channel_set_bootstrap_st
65 //
66 // This is the left-most type of channel 'control' series
67 // existing of <channel_set_bootstrap_st>|<one or more channels>|<optional control flags>.
68 // It is used in macro LibcwDoutScopeBegin.
69 //
70 // LibcwdDoutFatalScopeBegin uses channel_set_bootstrap_fatal_st,
71 // to make sure it was used with dc::fatal or dc::core.
72 //
73 // The return type is a cast of this object to
74 // either a channel_set_st (the normal case) or a
75 // continued_channel_set_st in the case that the
76 // special debug channel dc::continued was used.
77 //
78 
79 class channel_ct;
80 class fatal_channel_ct;
81 class continued_channel_ct;
82 class always_channel_ct;
83 struct channel_set_st;
84 struct continued_channel_set_st;
85 
86 struct channel_set_bootstrap_st : public channel_set_data_st {
87  // Warning: This struct may not have attributes of its own!
88 public:
89  channel_set_bootstrap_st(debug_tsd_st& do_tsd LIBCWD_COMMA_TSD_PARAM_UNUSED) { do_tsd_ptr = &do_tsd; }
90 
91  //-------------------------------------------------------------------------------------------------
92  // Operators that combine channels/control bits.
93  //
94 
95  channel_set_st& operator|(channel_ct const& dc);
96  channel_set_st& operator|(always_channel_ct const& adc);
97  continued_channel_set_st& operator|(continued_channel_ct const& cdc);
98 };
99 
100 struct channel_set_bootstrap_fatal_st : public channel_set_data_st {
101  // Warning: This struct may not have attributes of its own!
102 public:
103  channel_set_bootstrap_fatal_st(debug_tsd_st& do_tsd LIBCWD_COMMA_TSD_PARAM_UNUSED) { do_tsd_ptr = &do_tsd; }
104 
105  //-------------------------------------------------------------------------------------------------
106  // Operators that combine channels/control bits.
107  //
108  channel_set_st& operator|(fatal_channel_ct const& fdc);
109 };
110 
111 //===================================================================================================
112 // struct channel_set_st
113 //
114 // The debug output target; a combination of channels and control bits.
115 // The final result of a series of <channel>|<control flag>|...
116 // is passed to struct_debug_tsd_st::start().
117 //
118 
119 struct channel_set_st : public channel_set_data_st {
120  // Warning: This struct may not have attributes of its own!
121 public:
122  channel_set_st& operator|(control_flag_t cf);
123  channel_set_st& operator|(channel_ct const& dc);
124  channel_set_st& operator|(fatal_channel_ct const& fdc);
125  continued_channel_set_st& operator|(continued_cf_nt);
126 };
127 
128 //===================================================================================================
129 // struct continued_channel_set_st
130 //
131 // The channel set type used for a series that starts with dc::continued.
132 //
133 
134 struct continued_channel_set_st : public channel_set_data_st {
135  // Warning: This struct may not have attributes of its own!
136 public:
137  continued_channel_set_st& operator|(control_flag_t cf);
138 };
139 
140 } // namespace libcwd
141 
142 #endif // LIBCWD_CLASS_CHANNEL_SET_H
143 
continued_cf_nt
continued_cf has its own type for overloading purposes.
Definition: control_flag.h:75
namespace for libcwd.
Definition: debug.cc:87
unsigned int control_flag_t
Definition: control_flag.h:31
Copyright © 2001 - 2004 Carlo Wood.  All rights reserved.