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

Last change on this file since 951 was 936, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 2.4 KB
Line 
1#ifndef MLOGMANIP_H
2#define MLOGMANIP_H
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." << __LINE__ << ": "
56#endif
57//
58// flush the old buffer, set a new debug level
59// and output the debug information code
60//
61// Be careful: Only use them with a MLogging stream facility.
62// Remark: All this is compiled into the code.
63//
64/*
65#ifndef __CINT__
66#define DEBUG(lvl) flush << debug(lvl) << dbginf
67#endif
68*/
69/*
70class SMANIP(T) {
71 ios& (*fct)(ios&,T) ;
72 T arg ;
73public:
74 SMANIP(T)(ios& (*f)(ios&, T), T a) :
75 fct(f), arg(a) { }
76 friend istream& operator>>(istream& i, const SMANIP(T)& m)
77 {
78 ios* s = &i ;
79 (*m.fct)(*s,m.arg) ; return i ;
80 }
81 friend ostream& operator<<(ostream& o, const SMANIP(T)& m)
82 {
83 ios* s = &o ;
84 (*m.fct)(*s,m.arg) ; return o ;
85 }
86} ;
87*/
88
89#endif
Note: See TracBrowser for help on using the repository browser.