00001
00002
00003
00004
00005 #ifndef SG_PROCESS_H
00006 #define SG_PROCESS_H
00007
00008 #include <ext/stdio_filebuf.h>
00009 #include <iosfwd>
00010 #include <memory>
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 class SgProcess
00021 {
00022 public:
00023
00024
00025
00026 SgProcess(const std::string& command);
00027
00028 ~SgProcess();
00029
00030 std::istream& Input();
00031
00032 std::ostream& Output();
00033
00034 private:
00035 std::auto_ptr<__gnu_cxx::stdio_filebuf<char> > m_bufIn;
00036
00037 std::auto_ptr<__gnu_cxx::stdio_filebuf<char> > m_bufOut;
00038
00039 std::auto_ptr<std::istream> m_in;
00040
00041 std::auto_ptr<std::ostream> m_out;
00042 };
00043
00044 inline std::istream& SgProcess::Input()
00045 {
00046 return *m_in;
00047 }
00048
00049 inline std::ostream& SgProcess::Output()
00050 {
00051 return *m_out;
00052 }
00053
00054
00055
00056 #endif // SG_PROCESS_H