ESyS-Particle
4.0.1
Main Page
Related Pages
Namespaces
Classes
Files
File List
Foundation
console.h
1
2
// //
3
// Copyright (c) 2003-2011 by The University of Queensland //
4
// Earth Systems Science Computational Centre (ESSCC) //
5
// http://www.uq.edu.au/esscc //
6
// //
7
// Primary Business: Brisbane, Queensland, Australia //
8
// Licensed under the Open Software License version 3.0 //
9
// http://www.opensource.org/licenses/osl-3.0.php //
10
// //
12
13
#ifndef _CONSOLE_H_
14
#define _CONSOLE_H_
15
16
//--project includes--
17
#include "Foundation/Matrix3.h"
18
#include "Foundation/vec3.h"
19
20
//--STL includes--
21
#include <string>
22
#include <sstream>
23
#include <fstream>
24
25
using
std::string;
26
using
std::ostringstream;
27
28
class
CCounter
;
29
class
CCounterList
;
30
39
class
BasicCon
40
{
41
public
:
42
enum
VerboseLevel { all=0, dbg, info, msg, warning, err, critical, silent } ;
43
44
protected
:
45
static
int
VLevel
;
46
static
bool
mute,
quiet
;
47
static
bool
timing;
48
49
char
*
CurBuffer
;
50
ostream *
os
;
51
52
virtual
void
process
(ostringstream *str_os) ;
53
virtual
void
show
(
char
*level,
bool
h) ;
54
55
public
:
56
BasicCon
();
57
BasicCon
(ostream *Ios);
58
virtual
~
BasicCon
() ;
59
60
inline
void
SetQuiet(
bool
Q) {
quiet
= Q ; };
61
inline
void
SetTiming(
bool
T) { timing = T ; };
62
static
void
SetVerbose
(
int
vl=all) ;
63
inline
static
int
GetVerbose() {
return
VLevel
; } ;
64
65
virtual
void
flush() ;
66
67
virtual
void
SetOStream(ostream *Ios);
68
69
BasicCon
&
Message
(
bool
h=
true
) ;
70
BasicCon
&
Error
(
bool
h=
true
) ;
71
BasicCon
&
Warning
(
bool
h=
true
) ;
72
BasicCon
&
Critical
(
bool
h=
true
) ;
73
BasicCon
&
Info
(
bool
h=
true
) ;
74
BasicCon
&
Debug
(
bool
h=
true
) ;
75
BasicCon
&
XDebug
(
bool
h=
true
) ;
76
BasicCon
&
Timing
(
bool
h=
true
) ;
77
78
BasicCon
& operator<<(
const
char
* s);
79
BasicCon
& operator<<(
char
s);
80
BasicCon
& operator<<(
short
s) ;
81
BasicCon
& operator<<(
int
s) ;
82
BasicCon
& operator<<(
long
s) ;
83
BasicCon
& operator<<(
float
s) ;
84
BasicCon
& operator<<(
double
s) ;
85
BasicCon
& operator<<(
unsigned
char
s) ;
86
BasicCon
& operator<<(
unsigned
short
s);
87
BasicCon
& operator<<(
unsigned
int
s);
88
BasicCon
& operator<<(
unsigned
long
s);
89
BasicCon
& operator<<(
void
* s) ;
90
BasicCon
& operator<<(
Vec3
s);
91
BasicCon
& operator<<(
const
Matrix3
&);
92
BasicCon
& operator<<(
CCounter
&s);
93
BasicCon
& operator<<(
CCounterList
&s);
94
BasicCon
& operator<<(
const
string
&);
95
} ;
96
101
class
ConsoleWindow
{
102
protected
:
103
static
ConsoleWindow
* Window ;
104
virtual
void
UpdateCon() = 0 ;
105
public
:
106
virtual
~
ConsoleWindow
() {}
107
static
bool
immediate ;
108
static
void
Update() ;
109
static
bool
IsOpen() {
return
Window!=NULL ; } ;
110
} ;
111
116
class
Con
:
public
BasicCon
{
117
private
:
118
int
CurCol ;
119
char
Buffer[4096] ;
120
protected
:
121
virtual
void
process
(ostringstream *str_os) ;
122
Con
();
123
124
public
:
125
Con
(ostream *Ios);
126
virtual
~
Con
() ;
127
virtual
char
*GetLast(
char
*buff) ;
128
} ;
129
134
class
FCon
:
public
Con
135
{
136
private
:
137
std::ofstream m_debugfile;
138
139
public
:
140
FCon
();
141
virtual
~
FCon
() ;
142
};
143
144
145
146
#ifdef _ENABLE_DEBUG_FILE
147
extern
FCon
console ;
148
#else
149
extern
Con
console ;
150
#endif // _ENABLE_DEBUG_FILE
151
extern
BasicCon
tconsole ;
152
153
154
#endif
Generated on Mon Jun 4 2012 22:48:20 for ESyS-Particle by
1.8.1