log.h

Go to the documentation of this file.
00001 
00002 #ifndef LOG_H
00003 #define LOG_H
00004 
00005 #include "types.h"
00006 #include <fstream>
00007 
00008 class Statement;
00009 class Exp;
00010 class LocationSet;
00011 class RTL;
00012 class Range;
00013 class RangeMap;
00014 class Type;
00015 
00016 class Log 
00017 {
00018 public:
00019     Log() { }
00020     virtual Log &operator<<(const char *str) = 0;
00021     virtual Log &operator<<(Statement *s);
00022     virtual Log &operator<<(Exp *e);
00023     virtual Log &operator<<(Type *ty);
00024     virtual Log &operator<<(RTL *r);
00025     virtual Log &operator<<(Range *r);
00026     virtual Log &operator<<(Range &r);
00027     virtual Log &operator<<(RangeMap &r);
00028     virtual Log &operator<<(int i);
00029     virtual Log &operator<<(char c);
00030     virtual Log &operator<<(double d);
00031     virtual Log &operator<<(ADDRESS a);
00032     virtual Log &operator<<(LocationSet *l);
00033             Log &operator<<(std::string& s) {return operator<<(s.c_str());}
00034     virtual ~Log() {};
00035     virtual void tail();
00036 };
00037 
00038 class FileLogger : public Log {
00039 protected:
00040     std::ofstream out;
00041 public:
00042             FileLogger();       // Implemented in boomerang.cpp
00043     void    tail();
00044     virtual Log &operator<<(const char *str) { 
00045         out << str << std::flush;  
00046         return *this; 
00047     }
00048     virtual ~FileLogger() {};
00049 };
00050 
00051 // For older MSVC compilers
00052 #if defined(_MSC_VER) && (_MSC_VER <= 1200)
00053 static std::ostream& operator<<(std::ostream& s, QWord val)
00054 {
00055     char szTmp[42]; // overkill, but who counts
00056     sprintf(szTmp, "%I64u", val);
00057     s << szTmp;
00058     return s;
00059 }
00060 #endif
00061 
00062 #endif

Generated on Tue Sep 19 21:18:24 2006 for Boomerang by  doxygen 1.4.6