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.11  2006/06/21 03:28:41  csoutheren
00031  * Various cleanups thanks for Frederic Heem
00032  *
00033  * Revision 1.10  2005/11/25 03:43:47  csoutheren
00034  * Fixed function argument comments to be compatible with Doxygen
00035  *
00036  * Revision 1.9  2002/09/16 01:08:59  robertj
00037  * Added #define so can select if #pragma interface/implementation is used on
00038  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00039  *
00040  * Revision 1.8  2001/09/10 02:51:22  robertj
00041  * Major change to fix problem with error codes being corrupted in a
00042  *   PChannel when have simultaneous reads and writes in threads.
00043  *
00044  * Revision 1.7  2001/05/22 12:49:32  robertj
00045  * Did some seriously wierd rewrite of platform headers to eliminate the
00046  *   stupid GNU compiler warning about braces not matching.
00047  *
00048  * Revision 1.6  2000/11/14 08:25:25  robertj
00049  * Added function to propagate the error text through to indirect channel.
00050  *
00051  * Revision 1.5  1999/06/17 13:38:11  robertj
00052  * Fixed race condition on indirect channel close, mutex needed in PIndirectChannel.
00053  *
00054  * Revision 1.4  1999/03/09 02:59:49  robertj
00055  * Changed comments to doc++ compatible documentation.
00056  *
00057  * Revision 1.3  1999/02/16 08:12:00  robertj
00058  * MSVC 6.0 compatibility changes.
00059  *
00060  * Revision 1.2  1998/09/23 06:20:41  robertj
00061  * Added open source copyright license.
00062  *
00063  * Revision 1.1  1996/09/14 13:00:56  robertj
00064  * Initial revision
00065  *
00066  */
00067 
00068 #ifndef _PINDIRECTCHANNEL
00069 #define _PINDIRECTCHANNEL
00070 
00071 #ifdef P_USE_PRAGMA
00072 #pragma interface
00073 #endif
00074 
00075 #include <ptlib/channel.h>
00076 
00077 
00083 class PIndirectChannel : public PChannel
00084 {
00085   PCLASSINFO(PIndirectChannel, PChannel);
00086 
00087   public:
00094     PIndirectChannel();
00095 
00097     ~PIndirectChannel();
00099 
00100 
00109     Comparison Compare(
00110       const PObject & obj   
00111     ) const;
00113 
00114 
00124     virtual PString GetName() const;
00125 
00132     virtual BOOL Close();
00133 
00141     virtual BOOL IsOpen() const;
00142 
00158     virtual BOOL Read(
00159       void * buf,   
00160       PINDEX len    
00161     );
00162 
00177     virtual BOOL Write(
00178       const void * buf, 
00179       PINDEX len        
00180     );
00181 
00190     virtual BOOL Shutdown(
00191       ShutdownValue option   
00192     );
00193 
00194 
00203     virtual PChannel * GetBaseReadChannel() const;
00204 
00213     virtual PChannel * GetBaseWriteChannel() const;
00214 
00220     virtual PString GetErrorText(
00221       ErrorGroup group = NumErrorGroups   
00222     ) const;
00224 
00234     BOOL Open(
00235       PChannel & channel   
00236     );
00237 
00248     BOOL Open(
00249       PChannel * channel,      
00250       BOOL autoDelete = TRUE   
00251     );
00252 
00264     BOOL Open(
00265       PChannel * readChannel,      
00266       PChannel * writeChannel,     
00267       BOOL autoDeleteRead = TRUE,  
00268       BOOL autoDeleteWrite = TRUE  
00269     );
00270 
00276     PChannel * GetReadChannel() const;
00277 
00283     BOOL SetReadChannel(
00284       PChannel * channel,      
00285       BOOL autoDelete = TRUE   
00286     );
00287 
00293     PChannel * GetWriteChannel() const;
00294 
00300     BOOL SetWriteChannel(
00301       PChannel * channel,      
00302       BOOL autoDelete = TRUE   
00303     );
00305 
00306 
00307   protected:
00317     virtual BOOL OnOpen();
00318 
00319 
00320   // Member variables
00322     PChannel * readChannel;
00323 
00325     BOOL readAutoDelete;
00326 
00328     PChannel * writeChannel;
00329 
00331     BOOL writeAutoDelete;
00332 
00334     PReadWriteMutex channelPointerMutex;
00335 };
00336 
00337 
00338 #endif // _PINDIRECTCHANNEL
00339 
00340 
00341 // End Of File ///////////////////////////////////////////////////////////////

Generated on Fri Mar 7 06:25:02 2008 for PTLib by  doxygen 1.5.1