OW_NAMESPACE::UnnamedPipe Class Reference

Abstract interface for an UnnamedPipe. More...

#include <OW_UnnamedPipe.hpp>

Inheritance diagram for OW_NAMESPACE::UnnamedPipe:

Inheritance graph
[legend]
Collaboration diagram for OW_NAMESPACE::UnnamedPipe:

Collaboration graph
[legend]
List of all members.

Public Types

enum  EBlockingMode { E_NONBLOCKING, E_BLOCKING }
enum  EOpen { E_DONT_OPEN, E_OPEN }

Public Member Functions

virtual ~UnnamedPipe ()
int writeInt (int value)
 Write an int (native binary representation) to the pipe.
int writeString (const String &strData)
 Writes a String to the pipe.
int readInt (int *value)
 Reads an int (native binary representation) from the pipe.
int readString (String &strData)
 Reads a String from the pipe.
void setReadTimeout (int seconds)
 Sets the read timeout value.
int getReadTimeout ()
 Gets the read timeout value.
void setWriteTimeout (int seconds)
 Sets the write timeout value.
int getWriteTimeout ()
 Gets the write timeout value.
void setTimeouts (int seconds)
 Sets the read & write timeout values.
String readAll ()
 Read from the pipe and collect into a string, until the other end of the pipe is closed.
virtual void open ()=0
 Open the pipe.
virtual int close ()=0
 Close the pipe.
virtual bool isOpen () const =0
 Is the pipe open or closed?
virtual Select_t getWriteSelectObj () const =0
 Get a write select object.
virtual void setBlocking (EBlockingMode outputIsBlocking=E_BLOCKING)=0
 Set the pipe's blocking mode.
virtual void setOutputBlocking (bool outputIsBlocking=true)=0

Static Public Member Functions

static UnnamedPipeRef createUnnamedPipe (EOpen doOpen=E_OPEN)
 Create an instance of the concrete class that implements the UnnamedPipe interface.

Protected Member Functions

 UnnamedPipe ()

Protected Attributes

int m_readTimeout
int m_writeTimeout

Detailed Description

Abstract interface for an UnnamedPipe.

Blocking is enabled by default.

Definition at line 54 of file OW_UnnamedPipe.hpp.


Member Enumeration Documentation

enum OW_NAMESPACE::UnnamedPipe::EBlockingMode
 

Enumerator:
E_NONBLOCKING 
E_BLOCKING 

Definition at line 171 of file OW_UnnamedPipe.hpp.

enum OW_NAMESPACE::UnnamedPipe::EOpen
 

Enumerator:
E_DONT_OPEN 
E_OPEN 

Definition at line 185 of file OW_UnnamedPipe.hpp.


Constructor & Destructor Documentation

OW_NAMESPACE::UnnamedPipe::~UnnamedPipe  )  [virtual]
 

Definition at line 49 of file OW_UnnamedPipe.cpp.

OW_NAMESPACE::UnnamedPipe::UnnamedPipe  )  [inline, protected]
 

Definition at line 198 of file OW_UnnamedPipe.hpp.


Member Function Documentation

virtual int OW_NAMESPACE::UnnamedPipe::close  )  [pure virtual]
 

Close the pipe.

Returns:
-1 on error, 0 on success.

Implemented in OW_NAMESPACE::PosixUnnamedPipe.

UnnamedPipeRef OW_NAMESPACE::UnnamedPipe::createUnnamedPipe EOpen  doOpen = E_OPEN  )  [static]
 

Create an instance of the concrete class that implements the UnnamedPipe interface.

Parameters:
doOpen Open the pipe or not.

Definition at line 206 of file OW_PosixUnnamedPipe.cpp.

Referenced by OW_NAMESPACE::Socket::createShutDownMechanism().

int OW_NAMESPACE::UnnamedPipe::getReadTimeout  )  [inline]
 

Gets the read timeout value.

If blocking is enabled this is the number of seconds a read operation will block. Exception safety: No-throw

Returns:
The read timeout.

Definition at line 116 of file OW_UnnamedPipe.hpp.

virtual Select_t OW_NAMESPACE::UnnamedPipe::getWriteSelectObj  )  const [pure virtual]
 

Get a write select object.

Implemented in OW_NAMESPACE::PosixUnnamedPipe.

int OW_NAMESPACE::UnnamedPipe::getWriteTimeout  )  [inline]
 

Gets the write timeout value.

If blocking is enabled this is the number of seconds a write operation will block. Exception safety: No-throw

Returns:
seconds The write timeout.

Definition at line 130 of file OW_UnnamedPipe.hpp.

virtual bool OW_NAMESPACE::UnnamedPipe::isOpen  )  const [pure virtual]
 

Is the pipe open or closed?

Implemented in OW_NAMESPACE::PosixUnnamedPipe.

virtual void OW_NAMESPACE::UnnamedPipe::open  )  [pure virtual]
 

Open the pipe.

Implemented in OW_NAMESPACE::PosixUnnamedPipe.

String OW_NAMESPACE::UnnamedPipe::readAll  ) 
 

Read from the pipe and collect into a string, until the other end of the pipe is closed.

Exception safety: Strong for the C++ instance. Fubared for the pipe. If an exception is thrown, the pipe won't be reset to it's pre-call state.

Exceptions:
IOException on error

Definition at line 97 of file OW_UnnamedPipe.cpp.

References OW_NAMESPACE::IOIFC::read(), and OW_NAMESPACE::StringBuffer::releaseString().

int OW_NAMESPACE::UnnamedPipe::readInt int *  value  ) 
 

Reads an int (native binary representation) from the pipe.

If blocking is enabled, readInt() will block for up to getReadTimeout() seconds or forever if getReadTimeout() == -1. Exception safety: No-throw

Parameters:
value Out parameter where the read int will be stored.
Returns:
The number of bytes read, -1 on error, ETIMEDOUT on timeout.

Definition at line 72 of file OW_UnnamedPipe.cpp.

References OW_NAMESPACE::IOIFC::read().

int OW_NAMESPACE::UnnamedPipe::readString String strData  ) 
 

Reads a String from the pipe.

If blocking is enabled, readInt() will block for up to getReadTimeout() seconds or forever if getReadTimeout() == -1. Exception safety: Strong for the C++ instance. Fubared for the pipe. If an exception is thrown, the pipe won't be reset to it's pre-call state.

Parameters:
value Out parameter where the read int will be stored.
Returns:
The number of bytes read, -1 on error, ETIMEDOUT on timeout.
Exceptions:
std::bad_alloc 

Definition at line 78 of file OW_UnnamedPipe.cpp.

References OW_NAMESPACE::String::E_TAKE_OWNERSHIP, OW_NAMESPACE::AutoPtrVec< X >::get(), and OW_NAMESPACE::AutoPtrVec< X >::release().

virtual void OW_NAMESPACE::UnnamedPipe::setBlocking EBlockingMode  outputIsBlocking = E_BLOCKING  )  [pure virtual]
 

Set the pipe's blocking mode.

Precondition: The pipe is open.

Parameters:
outputIsBlocking new blocking mode.

virtual void OW_NAMESPACE::UnnamedPipe::setOutputBlocking bool  outputIsBlocking = true  )  [pure virtual]
 

Implemented in OW_NAMESPACE::PosixUnnamedPipe.

void OW_NAMESPACE::UnnamedPipe::setReadTimeout int  seconds  )  [inline]
 

Sets the read timeout value.

If blocking is enabled this is the number of seconds a read operation will block. Exception safety: No-throw

Parameters:
seconds The new read timeout.

Definition at line 109 of file OW_UnnamedPipe.hpp.

void OW_NAMESPACE::UnnamedPipe::setTimeouts int  seconds  )  [inline]
 

Sets the read & write timeout values.

If blocking is enabled this is the number of seconds a read or write operation will block. Exception safety: No-throw

Parameters:
seconds The new timeout.

Definition at line 137 of file OW_UnnamedPipe.hpp.

void OW_NAMESPACE::UnnamedPipe::setWriteTimeout int  seconds  )  [inline]
 

Sets the write timeout value.

If blocking is enabled this is the number of seconds a write operation will block. Exception safety: No-throw

Parameters:
seconds The new write timeout.

Definition at line 123 of file OW_UnnamedPipe.hpp.

int OW_NAMESPACE::UnnamedPipe::writeInt int  value  ) 
 

Write an int (native binary representation) to the pipe.

If blocking is enabled, writeInt() will block for up to getWriteTimeout() seconds or forever if getWriteTimeout() == -1. Exception safety: No-throw

Parameters:
value The value to write.
Returns:
The number of bytes written, -1 on error, ETIMEDOUT on timeout.

Definition at line 54 of file OW_UnnamedPipe.cpp.

References OW_NAMESPACE::IOIFC::write().

int OW_NAMESPACE::UnnamedPipe::writeString const String strData  ) 
 

Writes a String to the pipe.

This should be read from the other side by readString. If blocking is enabled, writeString() will block for up to getWriteTimeout() seconds or forever if getWriteTimeout() == -1. Exception safety: No-throw

Parameters:
strData The String to write.
Returns:
The number of bytes written, -1 on error, ETIMEDOUT on timeout.

Definition at line 60 of file OW_UnnamedPipe.cpp.

References OW_NAMESPACE::String::c_str(), OW_NAMESPACE::String::length(), and OW_NAMESPACE::IOIFC::write().


Member Data Documentation

int OW_NAMESPACE::UnnamedPipe::m_readTimeout [protected]
 

Definition at line 201 of file OW_UnnamedPipe.hpp.

Referenced by OW_NAMESPACE::PosixUnnamedPipe::read().

int OW_NAMESPACE::UnnamedPipe::m_writeTimeout [protected]
 

Definition at line 202 of file OW_UnnamedPipe.hpp.

Referenced by OW_NAMESPACE::PosixUnnamedPipe::write().


The documentation for this class was generated from the following files:
Generated on Thu Feb 9 09:14:49 2006 for openwbem by  doxygen 1.4.6