DataStream.h

Go to the documentation of this file.
00001 
00007 /*
00008     Defines a new stream: dout, for data logging.
00009 */
00010 
00011 #ifndef DATASTREAM_H
00012 #define DATASTREAM_H
00013 
00014 #include "InfoStream.h"
00015 
00016 class datastream : public std::ostringstream
00017 {
00018   public:
00019   datastream() {}
00020   ~datastream() {;}
00021 
00022   void endd();
00023 
00024   /* define how to use the remaining << args */
00026   datastream& operator<<(std::ostream& (*f)(std::ostream&)) { f(*this); return(*this); }
00028   datastream& operator<<(datastream& (*f)(datastream&)) { return f(*this); }
00029 
00030   #define LOCALMOD(type) datastream& operator<<(type x) \
00031                 { (std::ostream&)(*this) << x; return(*this); }
00032 
00033   LOCALMOD(char);
00034   LOCALMOD(unsigned char);
00035   LOCALMOD(const char *);
00037   LOCALMOD(int);
00038   LOCALMOD(long);
00039   LOCALMOD(short);
00040   LOCALMOD(unsigned int);
00041   LOCALMOD(unsigned long);
00042   LOCALMOD(unsigned short);
00044   LOCALMOD(float);
00045   LOCALMOD(double);
00047   LOCALMOD(void *);
00048   LOCALMOD(std::streambuf *);
00049   #undef LOCALMOD
00050 };
00051 
00052 datastream& operator<<(datastream& strm, const Vector &v1);
00053 
00054 datastream& operator<<(datastream& strm, const Tensor &t1);
00055 
00057 inline datastream& endd(datastream& s)  { s.endd(); return s; }
00058 
00059 #define iFILE __FILE__<<'('<<__LINE__<<"): "
00060 #define iINFOF  iINFO << iFILE
00061 #define iWARNF  iWARN << iFILE
00062 #define iERRORF  iERROR << iFILE
00063 #define iDEBUGF  iDEBUG << iFILE
00064 
00065 
00066 extern datastream dout;
00067 
00068 #endif /* DATASTREAM_H */
00069 

Generated on Fri Sep 22 01:17:12 2017 for NAMD by  doxygen 1.4.7