Bridge++
Ver. 1.1.x
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
bridgeIO.h
Go to the documentation of this file.
1
14
#ifndef BRIDGEIO_INCLUDED
15
#define BRIDGEIO_INCLUDED
16
17
#include <iostream>
18
#include <fstream>
19
#include <cstdarg>
20
21
//#include "commonParameters.h"
22
#include "
communicator.h
"
23
24
namespace
Bridge {
25
enum
VerboseLevel
26
{
27
CRUCIAL
,
28
GENERAL
,
29
DETAILED
,
30
PARANOIAC
31
};
32
33
class
BridgeIO
{
34
public
:
35
// Constructor
36
BridgeIO
() :
os_
(0),
ildg_os_
(0),
is_open_
(false) {}
37
~BridgeIO
() {}
38
39
// Constructor from a stream
40
void
init
(std::ostream& os)
41
{
42
os_
= &os;
43
is_open_
=
true
;
44
}
45
46
void
ildg_init
(std::ostream& os)
47
{
48
ildg_os_
= &os;
49
}
50
51
// verbose output for c style
52
// default verbose level, node 0
53
void
crucial
(
const
char
*format, ...);
54
void
general
(
const
char
*format, ...);
55
void
detailed
(
const
char
*format, ...);
56
void
paranoiac
(
const
char
*format, ...);
57
58
// input verbose level, node 0
59
void
crucial
(
VerboseLevel
vl
,
const
char
*format, ...);
60
void
general
(
VerboseLevel
vl
,
const
char
*format, ...);
61
void
detailed
(
VerboseLevel
vl
,
const
char
*format, ...);
62
void
paranoiac
(
VerboseLevel
vl
,
const
char
*format, ...);
63
64
// input verbose level, input node
65
void
crucial
(
VerboseLevel
vl
,
int
node,
const
char
*format, ...);
66
void
general
(
VerboseLevel
vl
,
int
node,
const
char
*format, ...);
67
void
detailed
(
VerboseLevel
vl
,
int
node,
const
char
*format, ...);
68
void
paranoiac
(
VerboseLevel
vl
,
int
node,
const
char
*format, ...);
69
70
void
ildg
(
const
char
*format, ...);
71
72
std::ostream&
getStream
() {
return
*
os_
; }
73
std::ostream&
getILDGStream
() {
return
*
ildg_os_
; }
74
75
// Is the stream open?
76
bool
isOpen
() {
return
is_open_
; }
77
78
static
VerboseLevel
set_verbose_level
(
const
std::string& str);
79
80
private
:
81
// main method for verbose output for c style
82
inline
void
print
(
VerboseLevel
level,
VerboseLevel
write_level,
83
int
node,
const
char
*format, va_list& arg)
84
{
85
if
((write_level <= level) && (
Communicator::nodeid
() == node)) {
86
//*os_ << Communicator::nodeid() << " " << node << " ";
87
vsprintf(
buff_
, format, arg);
88
*
os_
<<
buff_
;
89
}
90
}
91
92
// Hide copy constructor and =
93
BridgeIO
(
const
BridgeIO
&) {}
94
void
operator=
(
const
BridgeIO
&) {}
95
96
private
:
97
std::ostream *
os_
;
98
std::ostream *
ildg_os_
;
99
char
buff_
[1024];
100
bool
is_open_
;
101
};
102
103
extern
BridgeIO
vout
;
104
}
105
#endif //BRIDGE_IO_INCLUDED
src
IO
bridgeIO.h
Generated on Tue Jul 23 2013 10:48:49 for Bridge++ by
1.8.3.1