source: trunk/MagicSoft/Mars/mbase/MLogManip.h@ 2153

Last change on this file since 2153 was 2142, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 3.0 KB
Line 
1#ifndef MARS_MLogManip
2#define MARS_MLogManip
3
4#include <iomanip.h>
5
6// ----------------------------------------------------------------
7// Definitions of the manipulators
8// ----------------------------------------------------------------
9
10//
11// define a general simple macro for manipulator definitions (int)
12//
13#define MANIPULATOR0(name) \
14 extern ostream& ##name(ostream& lout);
15
16#ifndef OMANIP
17 #define MANIPULATOR1(name) \
18 extern ostream& __omanip_##name(ostream& lout, int i); \
19 inline omanip<int> ##name(int i) \
20 { \
21 return omanip<int>(__omanip_##name, i); \
22 }
23
24#else
25 #define MANIPULATOR1(name) \
26 extern ostream& __omanip_##name(ostream& lout, int i); \
27 inline OMANIP(int) ##name(int i) \
28 { \
29 return OMANIP(int)(__omanip_##name, i); \
30 }
31
32#endif
33
34//
35// definitions
36//
37MANIPULATOR0(underline); // underline output
38MANIPULATOR1(debug); // set debug level
39MANIPULATOR1(device); // set ouput devices
40MANIPULATOR1(edev); // enable additional output devices
41MANIPULATOR1(ddev); // disable given output
42//#ifndef __CINT__
43//__DEFINE_IOMANIP_FN1(smanip, int, debug); // set debug level
44//__DEFINE_IOMANIP_FN1(smanip, int, device); // set ouput devices
45//__DEFINE_IOMANIP_FN1(smanip, int, edev); // enable additional output devices
46//__DEFINE_IOMANIP_FN1(smanip, int, ddev); // disable given output
47//#endif
48
49// ----------------------------------------------------------------
50// Debug helper macros
51// ----------------------------------------------------------------
52
53//
54// Output debug information into the stream
55// - this can only be done by a macro
56//
57#ifndef __CINT__
58//#define dbginf dbg << __FILE__ << " l." << dec << __LINE__ << ": "
59#define dbginf __FILE__ << " l." << dec << __LINE__ << ": "
60#define all debug(0) // use this for output in any case
61#define err debug(1) // use this for fatal errors (red)
62#define warn debug(2) // use this for wrnings (yellow)
63#define inf debug(3) // use this for informations (green)
64#define dbg debug(4) // use this for debug messages (blue)
65#endif
66//
67// flush the old buffer, set a new debug level
68// and output the debug information code
69//
70// Be careful: Only use them with a MLogging stream facility.
71// Remark: All this is compiled into the code.
72//
73/*
74#ifndef __CINT__
75#define DEBUG(lvl) flush << debug(lvl) << dbginf
76#endif
77*/
78/*
79class SMANIP(T) {
80 ios& (*fct)(ios&,T) ;
81 T arg ;
82public:
83 SMANIP(T)(ios& (*f)(ios&, T), T a) :
84 fct(f), arg(a) { }
85 friend istream& operator>>(istream& i, const SMANIP(T)& m)
86 {
87 ios* s = &i ;
88 (*m.fct)(*s,m.arg) ; return i ;
89 }
90 friend ostream& operator<<(ostream& o, const SMANIP(T)& m)
91 {
92 ios* s = &o ;
93 (*m.fct)(*s,m.arg) ; return o ;
94 }
95} ;
96*/
97
98#endif
Note: See TracBrowser for help on using the repository browser.