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

Last change on this file since 773 was 705, checked in by tbretz, 24 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#ifndef __CINT__
65#define DEBUG(lvl) flush << debug(lvl) << dbginf
66#endif
67
68/*
69class SMANIP(T) {
70 ios& (*fct)(ios&,T) ;
71 T arg ;
72public:
73 SMANIP(T)(ios& (*f)(ios&, T), T a) :
74 fct(f), arg(a) { }
75 friend istream& operator>>(istream& i, const SMANIP(T)& m)
76 {
77 ios* s = &i ;
78 (*m.fct)(*s,m.arg) ; return i ;
79 }
80 friend ostream& operator<<(ostream& o, const SMANIP(T)& m)
81 {
82 ios* s = &o ;
83 (*m.fct)(*s,m.arg) ; return o ;
84 }
85} ;
86*/
87
88#endif
Note: See TracBrowser for help on using the repository browser.