1 | /* ======================================================================== *\
|
---|
2 | !
|
---|
3 | ! *
|
---|
4 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
5 | ! * Software. It is distributed to you in the hope that it can be a useful
|
---|
6 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
7 | ! * It is distributed WITHOUT ANY WARRANTY.
|
---|
8 | ! *
|
---|
9 | ! * Permission to use, copy, modify and distribute this software and its
|
---|
10 | ! * documentation for any purpose is hereby granted without fee,
|
---|
11 | ! * provided that the above copyright notice appear in all copies and
|
---|
12 | ! * that both that copyright notice and this permission notice appear
|
---|
13 | ! * in supporting documentation. It is provided "as is" without express
|
---|
14 | ! * or implied warranty.
|
---|
15 | ! *
|
---|
16 | !
|
---|
17 | !
|
---|
18 | ! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de)
|
---|
19 | !
|
---|
20 | ! Copyright: MAGIC Software Development, 2000-2001
|
---|
21 | !
|
---|
22 | !
|
---|
23 | \* ======================================================================== */
|
---|
24 |
|
---|
25 | #include "MLog.h"
|
---|
26 | #include "MLogManip.h"
|
---|
27 |
|
---|
28 | // ----------------------------------------------------------------
|
---|
29 | // Definitions of the manipulator functions
|
---|
30 | // ----------------------------------------------------------------
|
---|
31 |
|
---|
32 | ostream& __omanip_debug(ostream& lout, int i)
|
---|
33 | {
|
---|
34 | //
|
---|
35 | // get the streambuf of the stream
|
---|
36 | // get the pointer to the parent class by casting
|
---|
37 | // set the output level of the logging stream
|
---|
38 | //
|
---|
39 | // Be careful: This manipulator can only be used in MLogging
|
---|
40 | // streams - in other streams SetOutputLevel is a call
|
---|
41 | // of a non existing function
|
---|
42 | //
|
---|
43 | // Be careful 2: The change is valid for everything which is
|
---|
44 | // in the present buffer. This means it can also affect a
|
---|
45 | // part of the stream which is already in the stream but not flushed
|
---|
46 | // to the output device. A flush occures either if you tell a stream
|
---|
47 | // to flush (flush, endl) or if an buffer overflow occures, the
|
---|
48 | // last behaviour could be changed if someone want to have a dynamic
|
---|
49 | // buffer.
|
---|
50 | //
|
---|
51 | MLog *log=(MLog*)lout.rdbuf();
|
---|
52 | // cout << " -" << i << "- ";
|
---|
53 | log->SetOutputLevel(i);
|
---|
54 | return lout;
|
---|
55 | }
|
---|
56 |
|
---|
57 | ostream& __omanip_device(ostream& lout, int i)
|
---|
58 | {
|
---|
59 | //
|
---|
60 | // get the streambuf of the stream
|
---|
61 | // get the pointer to the parent class by casting
|
---|
62 | // set the output device of the logging stream, more than
|
---|
63 | // one output device can be ored together
|
---|
64 | //
|
---|
65 | // Be careful: This manipulator can only be used in MLogging
|
---|
66 | // streams - in other streams SetOutputLevel is a call
|
---|
67 | // of a non existing function
|
---|
68 | //
|
---|
69 | MLog *log=(MLog*)lout.rdbuf();
|
---|
70 | log->SetOutputDevice(i);
|
---|
71 | return lout;
|
---|
72 | }
|
---|
73 |
|
---|
74 | ostream& __omanip_edev(ostream& lout, int i)
|
---|
75 | {
|
---|
76 | //
|
---|
77 | // get the streambuf of the stream
|
---|
78 | // get the pointer to the parent class by casting
|
---|
79 | // Enable an output device of the logging stream, it should
|
---|
80 | // be possible to enable more than one output device at the
|
---|
81 | // same time by oring them together
|
---|
82 | //
|
---|
83 | // Be careful: This manipulator can only be used in MLogging
|
---|
84 | // streams - in other streams SetOutputLevel is a call
|
---|
85 | // of a non existing function
|
---|
86 | //
|
---|
87 | MLog *log=(MLog*)lout.rdbuf();
|
---|
88 | log->EnableOutputDevice((MLog::_flags)i);
|
---|
89 | return lout;
|
---|
90 | }
|
---|
91 |
|
---|
92 | ostream& __omanip_ddev(ostream& lout, int i)
|
---|
93 | {
|
---|
94 | //
|
---|
95 | // get the streambuf of the stream
|
---|
96 | // get the pointer to the parent class by casting
|
---|
97 | // Disable an output device of the logging stream, it should
|
---|
98 | // be possible to disable more than one output device at the
|
---|
99 | // same time by oring them together
|
---|
100 | //
|
---|
101 | // Be careful: This manipulator can only be used in MLogging
|
---|
102 | // streams - in other streams SetOutputLevel is a call
|
---|
103 | // of a non existing function
|
---|
104 | //
|
---|
105 | MLog *log=(MLog*)lout.rdbuf();
|
---|
106 | log->DisableOutputDevice((MLog::_flags)i);
|
---|
107 | return lout;
|
---|
108 | }
|
---|
109 |
|
---|