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

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