NAMD
InfoStream.h
Go to the documentation of this file.
1 
7 /*
8  Defines a new stream: iout, for "i"nforming consoles.
9 */
10 
11 #ifndef INFOSTREAM_H
12 #define INFOSTREAM_H
13 
14 #include <iostream>
15 #include <sstream>
16 class Vector;
17 class Tensor;
18 
19 class infostream : public std::ostringstream
20 {
21  public:
22  static infostream& access_iout_obj();
23 
24  infostream();
25  ~infostream();
26  void endi();
27 
28  /* define how to use the remaining << args */
30  infostream& operator<<(std::ostream& (*f)(std::ostream&));
33 
34  #define LOCALMOD(type) infostream& operator<<(type x)
35 
36  LOCALMOD(char);
37  LOCALMOD(unsigned char);
38  LOCALMOD(const char *);
40  LOCALMOD(int);
41  LOCALMOD(long);
42  LOCALMOD(short);
43  LOCALMOD(unsigned int);
44  LOCALMOD(unsigned long);
45  LOCALMOD(unsigned short);
46 #ifdef _MSC_VER
47  LOCALMOD(__int64);
48  LOCALMOD(unsigned __int64);
49 #else
50  LOCALMOD(long long);
51  LOCALMOD(unsigned long long);
52 #endif
53 
54  LOCALMOD(float);
55  LOCALMOD(double);
57  LOCALMOD(void *);
58  LOCALMOD(std::streambuf *);
59  #undef LOCALMOD
60 };
61 
62 std::ostream& operator<<(std::ostream& strm, const Vector &v1);
63 infostream& operator<<(infostream& strm, const Vector &v1);
64 
65 std::ostream& operator<<(std::ostream& strm, const Tensor &t1);
66 infostream& operator<<(infostream& strm, const Tensor &t1);
67 
70 
75 std::ostream& iINFO (std::ostream& s);
76 std::ostream& iWARN (std::ostream& s);
77 std::ostream& iERROR(std::ostream& s);
78 std::ostream& iDEBUG(std::ostream& s);
79 std::ostream& iPE(std::ostream& s); // outlined because of CkMyPe()
80 
81 #define iFILE __FILE__<<'('<<__LINE__<<"): "
82 #define iINFOF iINFO << iFILE
83 #define iWARNF iWARN << iFILE
84 #define iERRORF iERROR << iFILE
85 #define iDEBUGF iDEBUG << iFILE
86 
87 #define iout infostream::access_iout_obj()
88 
89 #endif /* INFOSTREAM_H */
90 
std::ostream & iINFO(std::ostream &s)
Definition: InfoStream.C:107
Definition: Vector.h:64
std::ostream & iPE(std::ostream &s)
Definition: InfoStream.C:40
std::ostream & iWARN(std::ostream &s)
Definition: InfoStream.C:108
datastream & operator<<(datastream &strm, const Vector &v1)
Definition: DataStream.C:25
std::ostream & iDEBUG(std::ostream &s)
Definition: InfoStream.C:110
LOCALMOD(char)
void endi()
Definition: InfoStream.C:28
static infostream & access_iout_obj()
Definition: InfoStream.C:19
infostream & operator<<(std::ostream &(*f)(std::ostream &))
Definition: InfoStream.C:71
Definition: Tensor.h:15
std::ostream & iERROR(std::ostream &s)
Definition: InfoStream.C:109
infostream & endi(infostream &s)
Definition: InfoStream.C:38