ostream.h

Go to the documentation of this file.
00001 
00040 #ifndef ABA_OSTREAM_H
00041 #define ABA_OSTREAM_H
00042 #include <iostream>
00043 #include <fstream>
00044 #include <iomanip>
00045 using namespace std;
00046 using ::endl;
00047 
00048 #include "abacus/abacusroot.h"
00049 class ABA_STRING;
00050 class ABA_HISTORY;
00051 class ABA_TIMER;
00052 class ABA_LP;
00053 class ABA_LPVARSTAT;
00054 class ABA_CSENSE;
00055 #ifdef ABACUS_PARALLEL
00056 class ABA_ID;
00057 #endif
00058 class ABA_OSTREAM;
00059 typedef ABA_OSTREAM&(*ABA_OSTREAM_MANIP)(ABA_OSTREAM&);  
00060 
00061 ABA_OSTREAM& flush(ABA_OSTREAM &o);
00062 ABA_OSTREAM& endl(ABA_OSTREAM &o);
00063 
00064 class  ABA_OSTREAM:public ostream,public ABA_ABACUSROOT{
00065     public:
00066 
00075       ABA_OSTREAM(ostream &out, const char *logStreamName = 0);
00076 
00078       ~ABA_OSTREAM();
00079 
00093       ABA_OSTREAM&operator<<(char o);
00094       ABA_OSTREAM&operator<<(unsigned char o);
00095       ABA_OSTREAM&operator<<(signed char o);
00096       ABA_OSTREAM&operator<<(short o);
00097       ABA_OSTREAM&operator<<(unsigned short o);
00098       ABA_OSTREAM&operator<<(int o);
00099       ABA_OSTREAM&operator<<(unsigned int o);
00100       ABA_OSTREAM&operator<<(long o);
00101       ABA_OSTREAM&operator<<(unsigned long o);
00102       ABA_OSTREAM&operator<<(float o);
00103       ABA_OSTREAM&operator<<(double o);
00104       ABA_OSTREAM&operator<<(const char *o);
00105        ABA_OSTREAM& operator<<(ABA_OSTREAM& (*pf)(ABA_OSTREAM&)) { return pf( *this ); }
00106 
00119       ABA_OSTREAM&operator<<(const ABA_STRING &o);
00120       ABA_OSTREAM&operator<<(const ABA_TIMER &o);
00121       ABA_OSTREAM&operator<<(const ABA_HISTORY &o);
00122       ABA_OSTREAM&operator<<(const ABA_LPVARSTAT &o);
00123       ABA_OSTREAM&operator<<(const ABA_CSENSE &o);
00124       ABA_OSTREAM&operator<<(const ABA_LP &o);
00125 #ifdef ABACUS_PARALLEL
00126       ABA_OSTREAM& operator<<(const ABA_ID &o);
00127 #endif
00128 
00131       void off();
00132 
00135       void on();
00136 
00139       void logOn();
00140 
00146       void logOn(const char *logStreamName);
00147 
00150       void logOff();
00151 
00155       bool isOn() const;
00156 
00160       bool isLogOn() const;
00161 
00164       ofstream* log() const;
00165 #ifdef ABACUS_PARALLEL
00166 
00171       void setPrompt(const char *prompt);
00172 #endif
00173 #if defined ABACUS_COMPILER_SUN
00174 
00185       void setFormatFlag(long flag);
00186 #else
00187 
00198       void setFormatFlag(fmtflags flag);
00199 #endif
00200 
00209       friend ABA_OSTREAM& flush(ABA_OSTREAM &o);
00210 
00219       friend ABA_OSTREAM& endl(ABA_OSTREAM &o);
00220 
00230       friend ABA_OSTREAM& _setWidth(ABA_OSTREAM &o, int w);
00231 
00241       friend ABA_OSTREAM& _setPrecision(ABA_OSTREAM &o, int p);
00242       
00243     private:
00244 
00248       ostream  &out_;
00249 
00253       bool      on_;
00254 
00258       bool      logOn_;
00259 
00262       ofstream *log_;
00263 #ifdef ABACUS_PARALLEL
00264       char     *prompt_;
00265       bool      firstPosition_;
00266 #endif
00267   };
00268 
00270 
00272   class ABA_OSTREAM_MANIP_INT {
00273     public:
00274 
00281       ABA_OSTREAM_MANIP_INT(ABA_OSTREAM &(*f)(ABA_OSTREAM &o, int i), int i);
00282 
00290       friend ABA_OSTREAM &operator<<(ABA_OSTREAM &o, const ABA_OSTREAM_MANIP_INT &m);
00291 
00292     private:
00293       int i_;
00294       ABA_OSTREAM &(*f_)(ABA_OSTREAM &o, int i);
00295   };
00296 
00312   ABA_OSTREAM_MANIP_INT setWidth(int w);
00313 
00324   ABA_OSTREAM_MANIP_INT setPrecision(int p);
00326 
00327 #endif // ABA_OSTREAM_H
00328 

Generated on Tue Aug 14 18:09:54 2007 for ABACUS by  doxygen 1.5.1