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  * $Revision: 20385 $
00030  * $Author: rjongbloed $
00031  * $Date: 2008-06-04 10:40:38 +0000 (Wed, 04 Jun 2008) $
00032  */
00033 
00034 #ifndef _PINDIRECTCHANNEL
00035 #define _PINDIRECTCHANNEL
00036 
00037 #ifdef P_USE_PRAGMA
00038 #pragma interface
00039 #endif
00040 
00041 #include <ptlib/channel.h>
00042 
00043 
00049 class PIndirectChannel : public PChannel
00050 {
00051   PCLASSINFO(PIndirectChannel, PChannel);
00052 
00053   public:
00060     PIndirectChannel();
00061 
00063     ~PIndirectChannel();
00065 
00066 
00075     Comparison Compare(
00076       const PObject & obj   
00077     ) const;
00079 
00080 
00090     virtual PString GetName() const;
00091 
00098     virtual PBoolean Close();
00099 
00107     virtual PBoolean IsOpen() const;
00108 
00124     virtual PBoolean Read(
00125       void * buf,   
00126       PINDEX len    
00127     );
00128 
00143     virtual PBoolean Write(
00144       const void * buf, 
00145       PINDEX len        
00146     );
00147 
00156     virtual PBoolean Shutdown(
00157       ShutdownValue option   
00158     );
00159 
00160 
00169     virtual PChannel * GetBaseReadChannel() const;
00170 
00179     virtual PChannel * GetBaseWriteChannel() const;
00180 
00186     virtual PString GetErrorText(
00187       ErrorGroup group = NumErrorGroups   
00188     ) const;
00190 
00200     PBoolean Open(
00201       PChannel & channel   
00202     );
00203 
00214     PBoolean Open(
00215       PChannel * channel,      
00216       PBoolean autoDelete = PTrue   
00217     );
00218 
00230     PBoolean Open(
00231       PChannel * readChannel,      
00232       PChannel * writeChannel,     
00233       PBoolean autoDeleteRead = PTrue,  
00234       PBoolean autoDeleteWrite = PTrue  
00235     );
00236 
00242     PChannel * GetReadChannel() const;
00243 
00249     PBoolean SetReadChannel(
00250       PChannel * channel,      
00251       PBoolean autoDelete = PTrue   
00252     );
00253 
00259     PChannel * GetWriteChannel() const;
00260 
00266     PBoolean SetWriteChannel(
00267       PChannel * channel,      
00268       PBoolean autoDelete = PTrue   
00269     );
00271 
00272 
00273   protected:
00283     virtual PBoolean OnOpen();
00284 
00285 
00286   // Member variables
00288     PChannel * readChannel;
00289 
00291     PBoolean readAutoDelete;
00292 
00294     PChannel * writeChannel;
00295 
00297     PBoolean writeAutoDelete;
00298 
00300     PReadWriteMutex channelPointerMutex;
00301 };
00302 
00303 
00304 #endif // _PINDIRECTCHANNEL
00305 
00306 
00307 // End Of File ///////////////////////////////////////////////////////////////

Generated on Mon Sep 15 01:21:35 2008 for PTLib by  doxygen 1.5.1