# 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: 26933 $
    00030  * $Author: rjongbloed $
    00031  * $Date: 2012-02-02 21:17:20 -0600 (Thu, 02 Feb 2012) $
    00032  */
    00033
    00034 #ifndef PTLIB_INDIRECTCHANNEL_H
    00035 #define PTLIB_INDIRECTCHANNEL_H
    00036
    00037 #ifdef P_USE_PRAGMA
    00038 #pragma interface
    00039 #endif
    00040
    00041 #include <ptlib/channel.h>
    00042 #include <ptlib/syncthrd.h>
    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
    00167     virtual bool SetLocalEcho(
    00168       bool localEcho
    00169     );
    00170
    00171
    00180     virtual PChannel * GetBaseReadChannel() const;
    00181
    00190     virtual PChannel * GetBaseWriteChannel() const;
    00191
    00197     virtual PString GetErrorText(
    00198       ErrorGroup group = NumErrorGroups
    00199     ) const;
    00201
    00211     PBoolean Open(
    00212       PChannel & channel
    00213     );
    00214
    00225     PBoolean Open(
    00226       PChannel * channel,
    00227       PBoolean autoDelete = true
    00228     );
    00229
    00241     PBoolean Open(
    00242       PChannel * readChannel,
    00243       PChannel * writeChannel,
    00244       PBoolean autoDeleteRead = true,
    00245       PBoolean autoDeleteWrite = true
    00246     );
    00247
    00253     PChannel * GetReadChannel() const;
    00254
    00260     bool SetReadChannel(
    00261       PChannel * channel,
    00262       bool autoDelete = true,
    00263       bool closeExisting = false
    00264     );
    00265
    00271     PChannel * GetWriteChannel() const;
    00272
    00278     PBoolean SetWriteChannel(
    00279       PChannel * channel,
    00280       bool autoDelete = true,
    00281       bool closeExisting = false
    00282     );
    00284
    00285
    00286   protected:
    00296     virtual PBoolean OnOpen();
    00297
    00298
    00299   // Member variables
    00301     PChannel * readChannel;
    00302
    00304     PBoolean readAutoDelete;
    00305
    00307     PChannel * writeChannel;
    00308
    00310     PBoolean writeAutoDelete;
    00311
    00313     PReadWriteMutex channelPointerMutex;
    00314 };
    00315
    00316
    00317 #endif // PTLIB_INDIRECTCHANNEL_H
    00318
    00319
    00320 // End Of File ///////////////////////////////////////////////////////////////