indchan.h
Go to the documentation of this file.
/*
* indchan.h
*
* Indirect I/O channel class.
*
* Portable Windows Library
*
* Copyright (c) 1993-1998 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Portable Windows Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Portions are Copyright (C) 1993 Free Software Foundation, Inc.
* All Rights Reserved.
*
* Contributor(s): ______________________________________.
*
* $Revision: 26933 $
* $Author: rjongbloed $
* $Date: 2012-02-02 21:17:20 -0600 (Thu, 02 Feb 2012) $
*/
#ifndef PTLIB_INDIRECTCHANNEL_H
#define PTLIB_INDIRECTCHANNEL_H
#ifdef P_USE_PRAGMA
#pragma interface
#endif
#include <ptlib/channel.h>
#include <ptlib/syncthrd.h>
class PIndirectChannel : public PChannel
{
PCLASSINFO(PIndirectChannel, PChannel);
public:
PIndirectChannel();
~PIndirectChannel();
Comparison Compare(
const PObject & obj
) const;
virtual PString GetName() const;
virtual PBoolean Close();
virtual PBoolean IsOpen() const;
virtual PBoolean Read(
void * buf,
PINDEX len
);
virtual PBoolean Write(
const void * buf,
PINDEX len
);
virtual PBoolean Shutdown(
ShutdownValue option
);
virtual bool SetLocalEcho(
bool localEcho
);
virtual PChannel * GetBaseReadChannel() const;
virtual PChannel * GetBaseWriteChannel() const;
virtual PString GetErrorText(
ErrorGroup group = NumErrorGroups
) const;
PBoolean Open(
PChannel & channel
);
PBoolean Open(
PChannel * channel,
PBoolean autoDelete = true
);
PBoolean Open(
PChannel * readChannel,
PChannel * writeChannel,
PBoolean autoDeleteRead = true,
PBoolean autoDeleteWrite = true
);
PChannel * GetReadChannel() const;
bool SetReadChannel(
PChannel * channel,
bool autoDelete = true,
bool closeExisting = false
);
PChannel * GetWriteChannel() const;
PBoolean SetWriteChannel(
PChannel * channel,
bool autoDelete = true,
bool closeExisting = false
);
protected:
virtual PBoolean OnOpen();
// Member variables
PChannel * readChannel;
PBoolean readAutoDelete;
PChannel * writeChannel;
PBoolean writeAutoDelete;
PReadWriteMutex channelPointerMutex;
};
#endif // PTLIB_INDIRECTCHANNEL_H
// End Of File ///////////////////////////////////////////////////////////////
PIndirectChannel::channelPointerMutex
PReadWriteMutex channelPointerMutex
Race condition prevention on closing channel.
Definition: indchan.h:313
PChannel::NumErrorGroups
Definition: channel.h:569
PIndirectChannel::GetErrorText
virtual PString GetErrorText(ErrorGroup group=NumErrorGroups) const
Get error message description.
PIndirectChannel::GetName
virtual PString GetName() const
Get the name of the channel.
PIndirectChannel::readAutoDelete
PBoolean readAutoDelete
Automatically delete read channel on destruction.
Definition: indchan.h:304
PObject::Comparison
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:1184
PIndirectChannel::IsOpen
virtual PBoolean IsOpen() const
Determine if the channel is currently open and read and write operations can be executed on it...
PIndirectChannel
This is a channel that operates indirectly through another channel(s).
Definition: indchan.h:49
PIndirectChannel::readChannel
PChannel * readChannel
Channel for read operations.
Definition: indchan.h:301
PIndirectChannel::Shutdown
virtual PBoolean Shutdown(ShutdownValue option)
Close one or both of the data streams associated with a channel.
PChannel::ShutdownValue
ShutdownValue
Definition: channel.h:433
PIndirectChannel::GetReadChannel
PChannel * GetReadChannel() const
Get the channel used for read operations.
PIndirectChannel::GetBaseWriteChannel
virtual PChannel * GetBaseWriteChannel() const
This function returns the eventual base channel for writing of a series of indirect channels provided...
PIndirectChannel::GetWriteChannel
PChannel * GetWriteChannel() const
Get the channel used for write operations.
PBoolean
BOOL PBoolean
Definition: object.h:102
PIndirectChannel::writeChannel
PChannel * writeChannel
Channel for write operations.
Definition: indchan.h:307
channel.h
PChannel
Abstract class defining I/O channel semantics.
Definition: channel.h:107
syncthrd.h
PIndirectChannel::Close
virtual PBoolean Close()
Close the channel.
PIndirectChannel::GetBaseReadChannel
virtual PChannel * GetBaseReadChannel() const
This function returns the eventual base channel for reading of a series of indirect channels provided...
PIndirectChannel::PIndirectChannel
PIndirectChannel()
Create a new indirect channel without any channels to redirect to.
PString
The character string class.
Definition: pstring.h:108
PIndirectChannel::Open
PBoolean Open(PChannel &channel)
Set the channel for both read and write operations.
PIndirectChannel::Compare
Comparison Compare(const PObject &obj) const
Determine if the two objects refer to the same indirect channel.
PIndirectChannel::writeAutoDelete
PBoolean writeAutoDelete
Automatically delete write channel on destruction.
Definition: indchan.h:310
PChannel::ErrorGroup
ErrorGroup
Error groups.
Definition: channel.h:565
PIndirectChannel::Write
virtual PBoolean Write(const void *buf, PINDEX len)
Low level write to the channel.
PIndirectChannel::OnOpen
virtual PBoolean OnOpen()
This callback is executed when the Open() function is called with open channels.
PIndirectChannel::SetLocalEcho
virtual bool SetLocalEcho(bool localEcho)
Set local echo mode.
PIndirectChannel::Read
virtual PBoolean Read(void *buf, PINDEX len)
Low level read from the channel.
PIndirectChannel::SetReadChannel
bool SetReadChannel(PChannel *channel, bool autoDelete=true, bool closeExisting=false)
Set the channel for read operations.
PReadWriteMutex
This class defines a thread synchronisation object.
Definition: syncthrd.h:251
PObject
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
PIndirectChannel::SetWriteChannel
PBoolean SetWriteChannel(PChannel *channel, bool autoDelete=true, bool closeExisting=false)
Set the channel for read operations.
PIndirectChannel::~PIndirectChannel
~PIndirectChannel()
Close the indirect channel, deleting read/write channels if desired.