Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

indchan.h

Go to the documentation of this file.
00001 /*
00002  * indchan.h
00003  *
00004  * Indirect I/O channel class.
00005  *
00006  * Portable Windows Library
00007  *
00008  * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
00009  *
00010  * The contents of this file are subject to the Mozilla Public License
00011  * Version 1.0 (the "License"); you may not use this file except in
00012  * compliance with the License. You may obtain a copy of the License at
00013  * http://www.mozilla.org/MPL/
00014  *
00015  * Software distributed under the License is distributed on an "AS IS"
00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00017  * the License for the specific language governing rights and limitations
00018  * under the License.
00019  *
00020  * The Original Code is Portable Windows Library.
00021  *
00022  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
00023  *
00024  * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
00025  * All Rights Reserved.
00026  *
00027  * Contributor(s): ______________________________________.
00028  *
00029  * $Log: indchan.h,v $
00030  * Revision 1.9  2002/09/16 01:08:59  robertj
00031  * Added #define so can select if #pragma interface/implementation is used on
00032  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00033  *
00034  * Revision 1.8  2001/09/10 02:51:22  robertj
00035  * Major change to fix problem with error codes being corrupted in a
00036  *   PChannel when have simultaneous reads and writes in threads.
00037  *
00038  * Revision 1.7  2001/05/22 12:49:32  robertj
00039  * Did some seriously wierd rewrite of platform headers to eliminate the
00040  *   stupid GNU compiler warning about braces not matching.
00041  *
00042  * Revision 1.6  2000/11/14 08:25:25  robertj
00043  * Added function to propagate the error text through to indirect channel.
00044  *
00045  * Revision 1.5  1999/06/17 13:38:11  robertj
00046  * Fixed race condition on indirect channel close, mutex needed in PIndirectChannel.
00047  *
00048  * Revision 1.4  1999/03/09 02:59:49  robertj
00049  * Changed comments to doc++ compatible documentation.
00050  *
00051  * Revision 1.3  1999/02/16 08:12:00  robertj
00052  * MSVC 6.0 compatibility changes.
00053  *
00054  * Revision 1.2  1998/09/23 06:20:41  robertj
00055  * Added open source copyright license.
00056  *
00057  * Revision 1.1  1996/09/14 13:00:56  robertj
00058  * Initial revision
00059  *
00060  */
00061 
00062 #ifndef _PINDIRECTCHANNEL
00063 #define _PINDIRECTCHANNEL
00064 
00065 #ifdef P_USE_PRAGMA
00066 #pragma interface
00067 #endif
00068 
00069 
00075 class PIndirectChannel : public PChannel
00076 {
00077   PCLASSINFO(PIndirectChannel, PChannel);
00078 
00079   public:
00086     PIndirectChannel();
00087 
00089     ~PIndirectChannel();
00091 
00092 
00101     Comparison Compare(
00102       const PObject & obj   
00103     ) const;
00105 
00106 
00116     virtual PString GetName() const;
00117 
00124     virtual BOOL Close();
00125 
00133     virtual BOOL IsOpen() const;
00134 
00150     virtual BOOL Read(
00151       void * buf,   
00152       PINDEX len    
00153     );
00154 
00169     virtual BOOL Write(
00170       const void * buf, 
00171       PINDEX len        
00172     );
00173 
00182     virtual BOOL Shutdown(
00183       ShutdownValue option   
00184     );
00185 
00186 
00195     virtual PChannel * GetBaseReadChannel() const;
00196 
00205     virtual PChannel * GetBaseWriteChannel() const;
00206 
00212     virtual PString GetErrorText(
00213       ErrorGroup group = NumErrorGroups   
00214     ) const;
00216 
00226     BOOL Open(
00227       PChannel & channel
00229     );
00230 
00241     BOOL Open(
00242       PChannel * channel,
00244       BOOL autoDelete = TRUE   
00245     );
00246 
00258     BOOL Open(
00259       PChannel * readChannel,
00260         // Channel to be used for both read operations.
00261       PChannel * writeChannel,
00262         // Channel to be used for both write operations.
00263       BOOL autoDeleteRead = TRUE,  // Automatically delete the read channel
00264       BOOL autoDeleteWrite = TRUE  // Automatically delete the write channel
00265     );
00266 
00272     PChannel * GetReadChannel() const;
00273 
00279     BOOL SetReadChannel(
00280       PChannel * channel,
00282       BOOL autoDelete = TRUE   
00283     );
00284 
00290     PChannel * GetWriteChannel() const;
00291 
00297     BOOL SetWriteChannel(
00298       PChannel * channel,
00300       BOOL autoDelete = TRUE   
00301     );
00303 
00304 
00305   protected:
00315     virtual BOOL OnOpen();
00316 
00317 
00318   // Member variables
00320     PChannel * readChannel;
00321 
00323     BOOL readAutoDelete;
00324 
00326     PChannel * writeChannel;
00327 
00329     BOOL writeAutoDelete;
00330 
00332     PReadWriteMutex channelPointerMutex;
00333 };
00334 
00335 
00336 #endif // _PINDIRECTCHANNEL
00337 
00338 
00339 // End Of File ///////////////////////////////////////////////////////////////

Generated on Wed Sep 28 10:27:33 2005 for PWLib by  doxygen 1.4.4