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

Last change on this file since 2124 was 2120, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 2.9 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 all debug(0) // use this for output in any case
60#define err debug(1) // use this for fatal errors (red)
61#define warn debug(2) // use this for wrnings (yellow)
62#define inf debug(3) // use this for informations (green)
63#define dbg debug(4) // use this for debug messages (blue)
64#endif
65//
66// flush the old buffer, set a new debug level
67// and output the debug information code
68//
69// Be careful: Only use them with a MLogging stream facility.
70// Remark: All this is compiled into the code.
71//
72/*
73#ifndef __CINT__
74#define DEBUG(lvl) flush << debug(lvl) << dbginf
75#endif
76*/
77/*
78class SMANIP(T) {
79 ios& (*fct)(ios&,T) ;
80 T arg ;
81public:
82 SMANIP(T)(ios& (*f)(ios&, T), T a) :
83 fct(f), arg(a) { }
84 friend istream& operator>>(istream& i, const SMANIP(T)& m)
85 {
86 ios* s = &i ;
87 (*m.fct)(*s,m.arg) ; return i ;
88 }
89 friend ostream& operator<<(ostream& o, const SMANIP(T)& m)
90 {
91 ios* s = &o ;
92 (*m.fct)(*s,m.arg) ; return o ;
93 }
94} ;
95*/
96
97#endif
Note: See TracBrowser for help on using the repository browser.