/home/msneddon/eclipse/galileoSR1_cpp/workspace/NFsim/src/NFscheduler/NFstream.h

Go to the documentation of this file.
00001 
00002 #ifndef _NFSTREAM_H_
00003 #define _NFSTREAM_H_
00004 
00005 #include <iostream>
00006 #include <fstream>
00007 #include <sstream>
00008 #include <string>
00009 
00010 using namespace std;
00011 
00012 class NFstream
00013 {
00014 public:
00015     NFstream();
00016     NFstream(const char* filename, ios_base::openmode mode = ios_base::out);
00017     NFstream(bool useFile);
00018     NFstream(string filename);
00019 
00020     ~NFstream();
00021 
00022     void setUseFile(bool useFile);
00023     string getStrName();
00024 
00025     void open(const char* filename, ios_base::openmode mode = ios_base::out);
00026     void close();
00027     ostream& write(const char* s , streamsize n);
00028     ostream& flush();
00029     bool is_open();
00030     string str() const;
00031 
00032     ios_base::fmtflags setf(ios_base::fmtflags fmtfl);
00033     ios_base::fmtflags setf(ios_base::fmtflags fmtfl, ios_base::fmtflags mask);
00034     streamsize precision() const;
00035     streamsize precision(streamsize prec);
00036 
00037     static void test();
00038 
00039     NFstream& operator<<(NFstream& (*func)(NFstream &));
00040 
00041     friend NFstream& endl (NFstream& nfstream);
00042 
00043     template<class T>
00044     friend NFstream& operator<< (NFstream& nfstream, const T& value);
00045     
00046 private:
00047     ofstream file_;
00048     stringstream str_;
00049 
00050     bool useFile_;
00051     string strname_;
00052 
00053     void check_mpi();
00054 };
00055 
00056 template<class T>
00057 NFstream& operator<< (NFstream& nfstream, const T& value);
00058 
00059 NFstream& endl (NFstream& nfstream);
00060 
00061 #endif /* _NFSTREAM_H_ */

Generated on Thu Dec 9 11:02:48 2010 for NFsim by  doxygen 1.5.4