37 #define I_BESDebug_h 1
64 #define BESDEBUG( x, y ) do { if( BESDebug::IsSet( x ) ) *(BESDebug::GetStrm()) << "[" << BESDebug::GetPidStr() << "]["<< x << "] " << y ; } while( 0 )
83 #define BESISDEBUG( x ) BESDebug::IsSet( x )
88 typedef map<string,bool> DebugMap;
90 static DebugMap _debug_map ;
91 static ostream *_debug_strm ;
92 static bool _debug_strm_created ;
94 typedef DebugMap::iterator _debug_iter ;
114 static void Set(
const string &flagName,
bool value)
116 if (flagName ==
"all" && value)
118 _debug_iter i = _debug_map.begin();
119 _debug_iter e = _debug_map.end();
125 _debug_map[flagName] = value;
142 if (i == _debug_map.end())
144 if (a == _debug_map.end())
146 _debug_map[flagName] =
false;
150 _debug_map[flagName] =
true;
160 static bool IsSet(
const string &flagName)
163 if (i != _debug_map.end())
166 i = _debug_map.find(
"all");
167 if (i != _debug_map.end())
201 static void SetStrm(ostream *strm,
bool created)
203 if (_debug_strm_created && _debug_strm)
205 _debug_strm->flush();
209 else if (_debug_strm)
211 _debug_strm->flush();
216 _debug_strm_created =
false;
221 _debug_strm_created = created;
225 static void SetUp(
const string &values ) ;
226 static void Help( ostream &strm ) ;
231 #endif // I_BESDebug_h
static void SetUp(const string &values)
Sets up debugging for the bes.
static void Set(const string &flagName, bool value)
set the debug context to the specified value
static string GetPidStr()
return the pid as a string
static const DebugMap & debug_map()
static void Help(ostream &strm)
Writes help information for so that developers know what can be set for debugging.
static ostream * GetStrm()
return the debug stream
static string GetOptionsString()
This method looks at the current setting of the BESDebug object and builds a string that...
DebugMap::const_iterator debug_citer
static bool IsSet(const string &flagName)
see if the debug context flagName is set to true
static void SetStrm(ostream *strm, bool created)
set the debug output stream to the specified stream
static void Register(const string &flagName)
register the specified debug flag
static bool IsContextName(const string &name)