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.10  2005/11/25 03:43:47  csoutheren
00031  * Fixed function argument comments to be compatible with Doxygen
00032  *
00033  * Revision 1.9  2002/09/16 01:08:59  robertj
00034  * Added #define so can select if #pragma interface/implementation is used on
00035  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00036  *
00037  * Revision 1.8  2001/09/10 02:51:22  robertj
00038  * Major change to fix problem with error codes being corrupted in a
00039  *   PChannel when have simultaneous reads and writes in threads.
00040  *
00041  * Revision 1.7  2001/05/22 12:49:32  robertj
00042  * Did some seriously wierd rewrite of platform headers to eliminate the
00043  *   stupid GNU compiler warning about braces not matching.
00044  *
00045  * Revision 1.6  2000/11/14 08:25:25  robertj
00046  * Added function to propagate the error text through to indirect channel.
00047  *
00048  * Revision 1.5  1999/06/17 13:38:11  robertj
00049  * Fixed race condition on indirect channel close, mutex needed in PIndirectChannel.
00050  *
00051  * Revision 1.4  1999/03/09 02:59:49  robertj
00052  * Changed comments to doc++ compatible documentation.
00053  *
00054  * Revision 1.3  1999/02/16 08:12:00  robertj
00055  * MSVC 6.0 compatibility changes.
00056  *
00057  * Revision 1.2  1998/09/23 06:20:41  robertj
00058  * Added open source copyright license.
00059  *
00060  * Revision 1.1  1996/09/14 13:00:56  robertj
00061  * Initial revision
00062  *
00063  */
00064 
00065 #ifndef _PINDIRECTCHANNEL
00066 #define _PINDIRECTCHANNEL
00067 
00068 #ifdef P_USE_PRAGMA
00069 #pragma interface
00070 #endif
00071 
00072 
00078 class PIndirectChannel : public PChannel
00079 {
00080   PCLASSINFO(PIndirectChannel, PChannel);
00081 
00082   public:
00089     PIndirectChannel();
00090 
00092     ~PIndirectChannel();
00094 
00095 
00104     Comparison Compare(
00105       const PObject & obj   
00106     ) const;
00108 
00109 
00119     virtual PString GetName() const;
00120 
00127     virtual BOOL Close();
00128 
00136     virtual BOOL IsOpen() const;
00137 
00153     virtual BOOL Read(
00154       void * buf,   
00155       PINDEX len    
00156     );
00157 
00172     virtual BOOL Write(
00173       const void * buf, 
00174       PINDEX len        
00175     );
00176 
00185     virtual BOOL Shutdown(
00186       ShutdownValue option   
00187     );
00188 
00189 
00198     virtual PChannel * GetBaseReadChannel() const;
00199 
00208     virtual PChannel * GetBaseWriteChannel() const;
00209 
00215     virtual PString GetErrorText(
00216       ErrorGroup group = NumErrorGroups   
00217     ) const;
00219 
00229     BOOL Open(
00230       PChannel & channel   
00231     );
00232 
00243     BOOL Open(
00244       PChannel * channel,      
00245       BOOL autoDelete = TRUE   
00246     );
00247 
00259     BOOL Open(
00260       PChannel * readChannel,      
00261       PChannel * writeChannel,     
00262       BOOL autoDeleteRead = TRUE,  
00263       BOOL autoDeleteWrite = TRUE  
00264     );
00265 
00271     PChannel * GetReadChannel() const;
00272 
00278     BOOL SetReadChannel(
00279       PChannel * channel,      
00280       BOOL autoDelete = TRUE   
00281     );
00282 
00288     PChannel * GetWriteChannel() const;
00289 
00295     BOOL SetWriteChannel(
00296       PChannel * channel,      
00297       BOOL autoDelete = TRUE   
00298     );
00300 
00301 
00302   protected:
00312     virtual BOOL OnOpen();
00313 
00314 
00315   // Member variables
00317     PChannel * readChannel;
00318 
00320     BOOL readAutoDelete;
00321 
00323     PChannel * writeChannel;
00324 
00326     BOOL writeAutoDelete;
00327 
00329     PReadWriteMutex channelPointerMutex;
00330 };
00331 
00332 
00333 #endif // _PINDIRECTCHANNEL
00334 
00335 
00336 // End Of File ///////////////////////////////////////////////////////////////

Generated on Fri Sep 21 14:40:11 2007 for PWLib by  doxygen 1.5.3