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

/usr/src/libcwd/libcwd/include/libcwd/class_channel_set.h

Go to the documentation of this file.
00001 // $Header: /cvsroot/libcwd/libcwd/include/libcwd/class_channel_set.h,v 1.4 2004/06/03 12:23:07 libcw Exp $
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 // LibcwDoutFatal uses operator& while LibcwDout uses operator|.
00071 //
00072 // The return type is a cast of this object to
00073 // either a channel_set_st (the normal case) or a
00074 // continued_channel_set_st in the case that the
00075 // special debug channel dc::continued was used.
00076 //
00077 
00078 class channel_ct;
00079 class fatal_channel_ct;
00080 class continued_channel_ct;
00081 class always_channel_ct;
00082 struct channel_set_st;
00083 struct continued_channel_set_st;
00084 
00085 struct channel_set_bootstrap_st : public channel_set_data_st {
00086   // Warning: This struct may not have attributes of its own!
00087 public:
00088   channel_set_bootstrap_st(debug_tsd_st& do_tsd LIBCWD_COMMA_TSD_PARAM) { do_tsd_ptr = &do_tsd; }
00089 
00090   //-------------------------------------------------------------------------------------------------
00091   // Operators that combine channels/control bits.
00092   //
00093 
00094   channel_set_st& operator|(channel_ct const& dc);
00095   channel_set_st& operator|(always_channel_ct const& adc);
00096   channel_set_st& operator&(fatal_channel_ct const& fdc);  // Using operator& just to detect that we indeed used LibcwDoutFatal!
00097   continued_channel_set_st& operator|(continued_channel_ct const& cdc);
00098   channel_set_st& operator|(fatal_channel_ct const&);
00099   channel_set_st& operator&(channel_ct const&);
00100 };
00101 
00102 //===================================================================================================
00103 // struct channel_set_st
00104 //
00105 // The debug output target; a combination of channels and control bits.
00106 // The final result of a series of <channel>|<control flag>|...
00107 // is passed to struct_debug_tsd_st::start().
00108 //
00109 
00110 struct channel_set_st : public channel_set_data_st {
00111   // Warning: This struct may not have attributes of its own!
00112 public:
00113   channel_set_st& operator|(control_flag_t cf);
00114   channel_set_st& operator|(channel_ct const& dc);
00115   channel_set_st& operator|(fatal_channel_ct const& fdc);
00116   continued_channel_set_st& operator|(continued_cf_nt);
00117 };
00118 
00119 //===================================================================================================
00120 // struct continued_channel_set_st
00121 //
00122 // The channel set type used for a series that starts with dc::continued.
00123 //
00124 
00125 struct continued_channel_set_st : public channel_set_data_st {
00126   // Warning: This struct may not have attributes of its own!
00127 public:
00128   continued_channel_set_st& operator|(control_flag_t cf);
00129 };
00130 
00131 } // namespace libcwd
00132 
00133 #endif // LIBCWD_CLASS_CHANNEL_SET_H
00134 
Copyright © 2001 - 2004 Carlo Wood.  All rights reserved.