Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

BOOL PIndirectChannel::Open ( PChannel readChannel,
PChannel writeChannel,
BOOL  autoDeleteRead = TRUE,
BOOL  autoDeleteWrite = TRUE 
) [inherited]

Set the channel for both read and write operations. This then checks that they are open and then calls the OnOpen() virtual function. If it in turn returns TRUE then the Open() function returns success.

The channels pointed to by readChannel# and writeChannel# may be automatically deleted when the PIndirectChannel is destroyed or a new subchannel opened.

Returns:
TRUE if both channels are set, open and OnOpen() returns TRUE.
Parameters:
readChannel  Channel to be used for both read operations.
writeChannel  Channel to be used for both write operations.
autoDeleteRead  Automatically delete the read channel
autoDeleteWrite  Automatically delete the write channel

Definition at line 900 of file pchannel.cxx.

{
  flush();

  channelPointerMutex.StartWrite();

  if (readChannel != NULL)
    readChannel->Close();

  if (readChannel != writeChannel && writeChannel != NULL)
    writeChannel->Close();

  if (readAutoDelete)
    delete readChannel;

  if (readChannel != writeChannel && writeAutoDelete)
    delete writeChannel;

  readChannel = readChan;
  readAutoDelete = autoDeleteRead;

  writeChannel = writeChan;
  writeAutoDelete = autoDeleteWrite;

  channelPointerMutex.EndWrite();

  return IsOpen() && OnOpen();
}


Generated by  Doxygen 1.6.0   Back to index