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_IO_ABSTRACTPIPE_ 00009 #define _SK_IO_ABSTRACTPIPE_ 00010 00011 #include <sk/io/Pipe.h> 00012 #include <sk/util/Holder.hxx> 00013 00014 namespace sk { 00015 namespace io { 00016 class FileDescriptor; 00017 00018 class AbstractPipe 00019 : public virtual sk::io::Pipe 00020 { 00021 public: 00022 // sk::util::Object re-implementation. 00023 const sk::util::Class getClass() const; 00024 00025 // sk::io::Pipe implementation. 00026 void close(); 00027 void closeInput(); 00028 void closeOutput(); 00029 FileDescriptorInputStream& inputStream() const; 00030 FileDescriptorOutputStream& outputStream() const; 00031 00032 protected: 00033 AbstractPipe(); 00034 virtual ~AbstractPipe(); 00035 00036 void setInputFileDescriptor(int fd); 00037 void setOutputFileDescriptor(int fd); 00038 void setInputFileDescriptor(const sk::io::FileDescriptor& descriptor); 00039 void setOutputFileDescriptor(const sk::io::FileDescriptor& descriptor); 00040 00041 private: 00042 sk::util::Holder<sk::io::FileDescriptorInputStream> _inputStreamHolder; 00043 sk::util::Holder<sk::io::FileDescriptorOutputStream> _outputStreamHolder; 00044 }; 00045 } 00046 } 00047 00048 #endif /* _SK_IO_ABSTRACTPIPE_ */