00001 // $Header$ 00002 // 00003 // Copyright (C) 2000 - 2004, by 00004 // 00005 // Carlo Wood, Run on IRC <carlo@alinoe.com> 00006 // RSA-1024 0x624ACAD5 1997-01-26 Sign & Encrypt 00007 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6 F6 F6 55 DD 1C DC FF 61 00008 // 00009 // This file may be distributed under the terms of the Q Public License 00010 // version 1.0 as appearing in the file LICENSE.QPL included in the 00011 // packaging of this file. 00012 // 00013 00018 #ifndef LIBCWD_CLASS_CHANNEL_SET_H 00019 #define LIBCWD_CLASS_CHANNEL_SET_H 00020 00021 #ifndef LIBCWD_CONFIG_H 00022 #include <libcwd/config.h> 00023 #endif 00024 #ifndef LIBCWD_CONTROL_FLAG_H 00025 #include <libcwd/control_flag.h> 00026 #endif 00027 #ifndef LIBCWD_PRIVATE_STRUCT_TSD_H 00028 #include <libcwd/private_struct_TSD.h> 00029 #endif 00030 00031 namespace libcwd { 00032 00033 class debug_ct; 00034 struct debug_tsd_st; 00035 class channel_ct; 00036 class fatal_channel_ct; 00037 00038 //=================================================================================================== 00039 // struct channel_set_data_st 00040 // 00041 // The attributes of channel_set_bootstrap_st, channel_set_st and continued_channel_set_st 00042 // 00043 00044 struct channel_set_data_st { 00045 public: 00046 char const* label; 00047 // The label of the most left channel that is turned on. 00048 00049 control_flag_t mask; 00050 // The bit-wise OR mask of all control flags and special channels. 00051 00052 bool on; 00053 // Set if at least one of the provided channels is turned on. 00054 00055 debug_tsd_st* do_tsd_ptr; 00056 // Thread specific data of current debug object. 00057 00058 #if CWDEBUG_DEBUG 00059 channel_set_data_st(void) : do_tsd_ptr(NULL) { } 00060 #endif 00061 }; 00062 00063 //=================================================================================================== 00064 // struct channel_set_bootstrap_st 00065 // 00066 // This is the left-most type of channel 'control' series 00067 // existing of <channel_set_bootstrap_st>|<one or more channels>|<optional control flags>. 00068 // It is used in macro LibcwDoutScopeBegin. 00069 // 00070 // LibcwdDoutFatalScopeBegin uses channel_set_bootstrap_fatal_st, 00071 // to make sure it was used with dc::fatal or dc::core. 00072 // 00073 // The return type is a cast of this object to 00074 // either a channel_set_st (the normal case) or a 00075 // continued_channel_set_st in the case that the 00076 // special debug channel dc::continued was used. 00077 // 00078 00079 class channel_ct; 00080 class fatal_channel_ct; 00081 class continued_channel_ct; 00082 class always_channel_ct; 00083 struct channel_set_st; 00084 struct continued_channel_set_st; 00085 00086 struct channel_set_bootstrap_st : public channel_set_data_st { 00087 // Warning: This struct may not have attributes of its own! 00088 public: 00089 channel_set_bootstrap_st(debug_tsd_st& do_tsd LIBCWD_COMMA_TSD_PARAM_UNUSED) { do_tsd_ptr = &do_tsd; } 00090 00091 //------------------------------------------------------------------------------------------------- 00092 // Operators that combine channels/control bits. 00093 // 00094 00095 channel_set_st& operator|(channel_ct const& dc); 00096 channel_set_st& operator|(always_channel_ct const& adc); 00097 continued_channel_set_st& operator|(continued_channel_ct const& cdc); 00098 }; 00099 00100 struct channel_set_bootstrap_fatal_st : public channel_set_data_st { 00101 // Warning: This struct may not have attributes of its own! 00102 public: 00103 channel_set_bootstrap_fatal_st(debug_tsd_st& do_tsd LIBCWD_COMMA_TSD_PARAM_UNUSED) { do_tsd_ptr = &do_tsd; } 00104 00105 //------------------------------------------------------------------------------------------------- 00106 // Operators that combine channels/control bits. 00107 // 00108 channel_set_st& operator|(fatal_channel_ct const& fdc); 00109 }; 00110 00111 //=================================================================================================== 00112 // struct channel_set_st 00113 // 00114 // The debug output target; a combination of channels and control bits. 00115 // The final result of a series of <channel>|<control flag>|... 00116 // is passed to struct_debug_tsd_st::start(). 00117 // 00118 00119 struct channel_set_st : public channel_set_data_st { 00120 // Warning: This struct may not have attributes of its own! 00121 public: 00122 channel_set_st& operator|(control_flag_t cf); 00123 channel_set_st& operator|(channel_ct const& dc); 00124 channel_set_st& operator|(fatal_channel_ct const& fdc); 00125 continued_channel_set_st& operator|(continued_cf_nt); 00126 }; 00127 00128 //=================================================================================================== 00129 // struct continued_channel_set_st 00130 // 00131 // The channel set type used for a series that starts with dc::continued. 00132 // 00133 00134 struct continued_channel_set_st : public channel_set_data_st { 00135 // Warning: This struct may not have attributes of its own! 00136 public: 00137 continued_channel_set_st& operator|(control_flag_t cf); 00138 }; 00139 00140 } // namespace libcwd 00141 00142 #endif // LIBCWD_CLASS_CHANNEL_SET_H 00143