00001 /* Copyright (c) 2006, Gennady Bystritsky <bystr@mac.com> 00002 * 00003 * Distributed under the MIT Licence. 00004 * This is free software. See 'LICENSE' for details. 00005 * You must read and accept the license prior to use. 00006 */ 00007 00008 #ifndef _SK_SYS_PIPEPROCESS_ 00009 #define _SK_SYS_PIPEPROCESS_ 00010 00011 #include <sk/util/Holder.hxx> 00012 #include <sk/sys/Process.h> 00013 #include <sk/sys/DelegatingExecutable.h> 00014 00015 #include <sk/io/InputStream.h> 00016 #include <sk/io/OutputStream.h> 00017 00018 namespace sk { 00019 namespace sys { 00020 class PipeProcess 00021 : public virtual sk::sys::DelegatingExecutable 00022 { 00023 public: 00024 PipeProcess(const sk::util::StringArray& cmdline); 00025 PipeProcess(sk::io::FileDescriptorInputStream& inputStream, const sk::util::StringArray& cmdline); 00026 virtual ~PipeProcess(); 00027 00028 sk::io::InputStream& inputStream() const; 00029 sk::io::InputStream& inputErrorStream() const; 00030 sk::io::OutputStream& outputStream() const; 00031 00032 const sk::util::StringArray& errors() const; 00033 00034 // sk::util::Object re-implementation. 00035 const sk::util::Class getClass() const; 00036 00037 private: 00038 PipeProcess(const PipeProcess& other); 00039 PipeProcess& operator = (const PipeProcess& other); 00040 00041 // sk::sys::DelegatingExecutable implementation. 00042 sk::sys::Executable& getExecutable(); 00043 const sk::sys::Executable& getExecutable() const; 00044 00045 struct Listener; 00046 00047 sk::util::Holder<Listener> _listenerHolder; 00048 sk::sys::Process _process; 00049 }; 00050 } 00051 } 00052 00053 #endif /* _SK_SYS_PIPEPROCESS_ */