//------------------------------------------------------------------------------ // application global definitions -- // (C) Piero Giubilato 2007-2010, Berkeley Lab -- //------------------------------------------------------------------------------ //______________________________________________________________________________ // {Trace} // [File name] "global.h" // [Author] "Piero Giubilato" // [Version] "1.2" // [Modified by] "Piero Giubilato" // [Last revision] "10 Feb 2009" // [Language] "C++" // [Compiler] "Visual C++ 9" // [Member of] "Cool SEAL" // [Project] "SEAL" // [Description] "This header contains all the application global definitions." // [Key documentation] // "Visual C++ Reference Help" // {Trace} //______________________________________________________________________________ // Holds all the application-wide vars, directives & macros // Overloading check #if !defined global_H #define global_H // Keep ROOTCInt out of this! #ifndef __CINT__ // Applicatione-wide relative paths // -------------------------------- #define SRC_GRAPHICS "graphics/" // Applicatione-wide preprocessor directives // ----------------------------------------- #define DEBUG_MODE // Debug mode is ON when defined #define DEBUG_THR_MIN 4 // Debug threshold minimum (0 = Max verb, 10 = Lowest verb) #define DEBUG_THR_MAX 9 // Debug threshold maximum (0 = Max verb, 10 = Lowest verb) #define WINSDK // Windows SDK compiled (basically used for WIN32) // Tips on DEBUG_THR // While adding dbg_Print and dbg_Value statements, pay attention to the // thr parameter! Suggested implementation follows subsequents scale: // Levels 0 - 4 : different prog flow indicators (0 = ultra low level) // Levels 5 - 8 : different error conditions (managed errors) // Level 9 : unexpected or unmanaged error (to be seen always) #define DBG_LVL_ZERO 0 // Ground level (ctors, dtors) #define DBG_LVL_MAKE 1 // Ground level (setting up objects properties) #define DBG_LVL_STEP 2 // Inner/Inter function steps #define DBG_LVL_FLOW 3 // Function calls #define DBG_LVL_WARN 6 // Error tracking for application check #define DBG_LVL_PLAY 9 // Final user level // Function auto-naming #ifdef WINSDK #define DBG_WHERE __FUNCDNAME__ #else #define DBG_WHERE __LINE__ #endif; // Applicatione-wide inclusions (that you need for the macros to work) // ------------------------------------------------------------------- // Standard libraries #include #include // Applicatione-wide preprocessor macro definitions // ------------------------------------------------ // Debug print macros #ifdef DEBUG_MODE // Debug basic routine: simple print #define dbg_Print(text, thr) if (thr >= DEBUG_THR_MIN && thr <= DEBUG_THR_MAX) {\ std::cout << "DEBUG (" << thr <<"): ";\ for (int i=0; i < (thr - DEBUG_THR_MIN) * 1; i++) std::cout\ << " "; std::cout << #text << std::endl;} // Debug handy print routine: print a variable with its coded name #define dbg_Value(var, thr) if (thr >= DEBUG_THR_MIN && thr <= DEBUG_THR_MAX) {\ std::cout << "DEBUG (" << thr <<"): ";\ for (int i=0; i < (thr - DEBUG_THR_MIN) * 1; i++) std::cout\ << " "; std::cout << #var << " = " << (var) << std::endl;} // If no debug on, simply put an empty line #else #define dbg_Print(variable, threshold); #define dbg_Value(variable, threshold); #endif; // End of ROOT Cint check #endif // End of Overloading check #endif