io.hh

Go to the documentation of this file.
00001 #ifndef IO_HH
00002 #define IO_HH
00003 
00004 #include <assert.h>
00005 #include <string>
00006 #include <stdio.h>
00007 
00014 namespace io {
00015 
00017   struct Stream {
00018     
00020     Stream();
00021 
00023     Stream(std::string file_name, std::string mode = "r", 
00024            bool allow_close = true);
00025 
00027     Stream(const Stream &stream) 
00028     { 
00029       assert(!is_open());
00030     }
00031 
00034     ~Stream();
00035 
00050     void open(std::string file_name, std::string mode = "r", 
00051               bool allow_close = true);
00052 
00054     void close();
00055 
00057     operator FILE*() { return file; }
00058 
00060     bool is_open() { return file != NULL; }
00061     
00062 
00063     FILE *file; 
00064     bool is_pipe; 
00065     bool close_allowed; 
00066 
00067   private:
00068     
00069     const Stream &operator=(const Stream &stream) { abort(); }
00070 
00071   };
00072 
00073 };
00074 
00075 #endif /* IO_HH */

Generated on Mon Jan 8 15:51:03 2007 for bit by  doxygen 1.4.6