00001 00006 /*----------------------------------------------------------------------------*/ 00007 /* C Tool Box: Designed and implemented by: */ 00008 /* Walter F.J. Mueller Gesellschaft fuer Schwerionenforschung (GSI) */ 00009 /* Planckstrasse 1, D-64291 Darmstadt, Germany */ 00010 /* Email: W.F.J.Mueller@gsi.de */ 00011 /* WWW: http://www-kp3.gsi.de/www/kp3/people/mueller.html */ 00012 /*------------------------------------------+---------------------------------*/ 00013 00023 //------------------------------------------+----------------------------------- 00025 00026 inline CTBflags::CTBflags() 00027 : mi_flags(0) 00028 {} 00029 00030 //------------------------------------------+----------------------------------- 00032 00033 inline CTBflags::CTBflags(CTBuint32 i_flags) 00034 : mi_flags(i_flags) 00035 {} 00036 00037 //------------------------------------------+----------------------------------- 00039 00044 inline void CTBflags::SetBit(CTBuint32 i_flags) 00045 { 00046 mi_flags |= i_flags; 00047 return; 00048 } 00049 00050 //------------------------------------------+----------------------------------- 00052 00057 inline void CTBflags::SetBit(CTBuint32 i_flags, bool b_val) 00058 { 00059 if (b_val) { 00060 mi_flags |= i_flags; // to set: just or bits 00061 } else { 00062 mi_flags &= (~i_flags); // to clear: and with complement 00063 } 00064 return; 00065 } 00066 00067 //------------------------------------------+----------------------------------- 00069 00074 inline void CTBflags::ClearBit(CTBuint32 i_flags) 00075 { 00076 mi_flags &= (~i_flags); 00077 return; 00078 } 00079 00080 //------------------------------------------+----------------------------------- 00082 00087 inline bool CTBflags::TestSomeBits(CTBuint32 i_flags) const 00088 { 00089 return mi_flags & i_flags; 00090 } 00091 00092 //------------------------------------------+----------------------------------- 00094 00099 inline bool CTBflags::TestAllBits(CTBuint32 i_flags) const 00100 { 00101 return (mi_flags & i_flags) == i_flags; 00102 } 00103 00104 //------------------------------------------+----------------------------------- 00106 00107 inline CTBflags::operator CTBuint32() const 00108 { 00109 return mi_flags; 00110 } 00111 00112 //------------------------------------------+----------------------------------- 00114 00115 inline bool CTBflags::operator !() const 00116 { 00117 return mi_flags == 0; 00118 } 00119 00120 //------------------------------------------+----------------------------------- 00122 00123 inline CTBflags& CTBflags::operator=(const CTBuint32 i_flags) 00124 { 00125 mi_flags = i_flags; 00126 return *this; 00127 }
1.2.9-20010812 written by Dimitri van Heesch,
© 1997-2001