InfoStream.h

Go to the documentation of this file.
00001 
00007 /*
00008     Defines a new stream: iout, for "i"nforming consoles.
00009 */
00010 
00011 #ifndef INFOSTREAM_H
00012 #define INFOSTREAM_H
00013 
00014 #include <iostream>
00015 #include <sstream>
00016 class Vector;
00017 class Tensor;
00018 
00019 class infostream : public std::ostringstream
00020 {
00021   public:
00022   static infostream& access_iout_obj();
00023 
00024   infostream();
00025   ~infostream();
00026   void endi();
00027 
00028   /* define how to use the remaining << args */
00030   infostream& operator<<(std::ostream& (*f)(std::ostream&));
00032   infostream& operator<<(infostream& (*f)(infostream&));
00033 
00034   #define LOCALMOD(type) infostream& operator<<(type x)
00035 
00036   LOCALMOD(char);
00037   LOCALMOD(unsigned char);
00038   LOCALMOD(const char *);
00040   LOCALMOD(int);
00041   LOCALMOD(long);
00042   LOCALMOD(short);
00043   LOCALMOD(unsigned int);
00044   LOCALMOD(unsigned long);
00045   LOCALMOD(unsigned short);
00046 #ifdef _MSC_VER
00047   LOCALMOD(__int64);
00048   LOCALMOD(unsigned __int64);
00049 #else
00050   LOCALMOD(long long);
00051   LOCALMOD(unsigned long long);
00052 #endif
00053 
00054   LOCALMOD(float);
00055   LOCALMOD(double);
00057   LOCALMOD(void *);
00058   LOCALMOD(std::streambuf *);
00059   #undef LOCALMOD
00060 };
00061 
00062 std::ostream& operator<<(std::ostream& strm, const Vector &v1);
00063 infostream& operator<<(infostream& strm, const Vector &v1);
00064 
00065 std::ostream& operator<<(std::ostream& strm, const Tensor &t1);
00066 infostream& operator<<(infostream& strm, const Tensor &t1);
00067 
00069 infostream& endi(infostream& s);
00070 
00075 std::ostream& iINFO (std::ostream& s);
00076 std::ostream& iWARN (std::ostream& s);
00077 std::ostream& iERROR(std::ostream& s);
00078 std::ostream& iDEBUG(std::ostream& s);
00079 std::ostream& iPE(std::ostream& s);  // outlined because of CkMyPe()
00080 
00081 #define iFILE __FILE__<<'('<<__LINE__<<"): "
00082 #define iINFOF  iINFO << iFILE
00083 #define iWARNF  iWARN << iFILE
00084 #define iERRORF  iERROR << iFILE
00085 #define iDEBUGF  iDEBUG << iFILE
00086 
00087 #define iout infostream::access_iout_obj()
00088 
00089 #endif /* INFOSTREAM_H */
00090 

Generated on Tue Nov 21 01:17:13 2017 for NAMD by  doxygen 1.4.7