Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Examples

pnamedpipe.h

Go to the documentation of this file.
00001 /*
00002  *   P::Classes - Portable C++ Application Framework
00003  *   Copyright (C) 2000-2003  Christian Prochnow <cproch@seculogix.de>
00004  *
00005  *   This library is free software; you can redistribute it and/or
00006  *   modify it under the terms of the GNU Lesser General Public
00007  *   License as published by the Free Software Foundation; either
00008  *   version 2 of the License, or (at your option) any later version.
00009  *
00010  *   This library is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *   Lesser General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU Lesser General Public
00016  *   License along with this library; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018  */
00019 
00020 #ifndef _pnamedpipe_h_
00021 #define _pnamedpipe_h_
00022 
00023 #include <pclasses/pexport.h>
00024 #include <pclasses/piodevice.h>
00025 #include <string>
00026 
00027 namespace P {
00028 
00029 class NamedPipe;
00030 
00032 
00040 class PCORE_EXPORT NamedPipeServer {
00041   public:
00042     friend class NamedPipe;
00043 
00045     NamedPipeServer() throw();
00046 
00048     NamedPipeServer(const char* name) throw(IOError);
00049 
00050     ~NamedPipeServer() throw();
00051 
00052     void listen(const char* name) throw(IOError);
00053 
00054     void close() throw(IOError);
00055 
00057 
00062     bool waitClient(unsigned int timeout) throw(IOError);
00063 
00064     inline const std::string& path() const throw()
00065     { return m_name; }
00066 
00067   protected:
00068 
00069     io_handle_t accept() throw(IOError);
00070 
00071   private:
00072     NamedPipeServer(const NamedPipeServer&);
00073     NamedPipeServer& operator=(const NamedPipeServer&);
00074 
00075     io_handle_t   m_handle;
00076     std::string   m_name;
00077 };
00078 
00080 
00087 class PCORE_EXPORT NamedPipe: public IODevice {
00088   public:
00090     NamedPipe() throw();
00091 
00093     NamedPipe(const char* name) throw(IOError);
00094 
00096     NamedPipe(NamedPipeServer& srv) throw(IOError);
00097 
00098     ~NamedPipe() throw();
00099 
00101     void connect(const char* name) throw(IOError);
00102 
00104     void close() throw(IOError);
00105 
00106     size_t peek(char* buffer, size_t count) throw(IOError);
00107 
00108     inline bool isSeekable() const throw()
00109     { return false; }
00110 
00111 };
00112 
00113 }
00114 
00115 #endif

Generated on Fri Mar 12 21:08:31 2004 for P::Classes by doxygen 1.3.3