#include <UnnamedPipe.hpp>

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. | |
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 |
Blocking is enabled by default.
Definition at line 56 of file UnnamedPipe.hpp.
| BLOCXX_NAMESPACE::UnnamedPipe::~UnnamedPipe | ( | ) | [virtual] |
Definition at line 51 of file UnnamedPipe.cpp.
| BLOCXX_NAMESPACE::UnnamedPipe::UnnamedPipe | ( | ) | [inline, protected] |
Definition at line 199 of file UnnamedPipe.hpp.
| int BLOCXX_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
| value | The value to write. |
Definition at line 56 of file UnnamedPipe.cpp.
References BLOCXX_NAMESPACE::IOIFC::write().
| int BLOCXX_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
| strData | The String to write. |
Definition at line 62 of file UnnamedPipe.cpp.
References BLOCXX_NAMESPACE::String::c_str(), BLOCXX_NAMESPACE::String::length(), and BLOCXX_NAMESPACE::IOIFC::write().
| int BLOCXX_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
| value | Out parameter where the read int will be stored. |
Definition at line 74 of file UnnamedPipe.cpp.
References BLOCXX_NAMESPACE::IOIFC::read().
| int BLOCXX_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.
| strData | Out parameter where the read int will be stored as string. |
| std::bad_alloc |
Definition at line 80 of file UnnamedPipe.cpp.
References BLOCXX_NAMESPACE::String::E_TAKE_OWNERSHIP, BLOCXX_NAMESPACE::AutoPtrVec< X >::get(), and BLOCXX_NAMESPACE::AutoPtrVec< X >::release().
| void BLOCXX_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
| seconds | The new read timeout. |
Definition at line 111 of file UnnamedPipe.hpp.
| int BLOCXX_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
Definition at line 118 of file UnnamedPipe.hpp.
| void BLOCXX_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
| seconds | The new write timeout. |
Definition at line 125 of file UnnamedPipe.hpp.
| int BLOCXX_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
Definition at line 132 of file UnnamedPipe.hpp.
| void BLOCXX_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
| seconds | The new timeout. |
Definition at line 139 of file UnnamedPipe.hpp.
Referenced by BLOCXX_NAMESPACE::PosixUnnamedPipe::PosixUnnamedPipe().
| String BLOCXX_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.
| IOException | on error |
Definition at line 99 of file UnnamedPipe.cpp.
References BLOCXX_NAMESPACE::IOIFC::read(), and BLOCXX_NAMESPACE::StringBuffer::releaseString().
| virtual void BLOCXX_NAMESPACE::UnnamedPipe::open | ( | ) | [pure virtual] |
Open the pipe.
Implemented in BLOCXX_NAMESPACE::PosixUnnamedPipe.
Referenced by BLOCXX_NAMESPACE::PosixUnnamedPipe::PosixUnnamedPipe().
| virtual int BLOCXX_NAMESPACE::UnnamedPipe::close | ( | ) | [pure virtual] |
Close the pipe.
Implemented in BLOCXX_NAMESPACE::PosixUnnamedPipe.
| virtual bool BLOCXX_NAMESPACE::UnnamedPipe::isOpen | ( | ) | const [pure virtual] |
| virtual Select_t BLOCXX_NAMESPACE::UnnamedPipe::getWriteSelectObj | ( | ) | const [pure virtual] |
| virtual void BLOCXX_NAMESPACE::UnnamedPipe::setBlocking | ( | EBlockingMode | outputIsBlocking = E_BLOCKING |
) | [pure virtual] |
Set the pipe's blocking mode.
Precondition: The pipe is open.
| outputIsBlocking | new blocking mode. |
Implemented in BLOCXX_NAMESPACE::PosixUnnamedPipe.
Referenced by BLOCXX_NAMESPACE::PosixUnnamedPipe::PosixUnnamedPipe().
| UnnamedPipeRef BLOCXX_NAMESPACE::UnnamedPipe::createUnnamedPipe | ( | EOpen | doOpen = E_OPEN |
) | [static] |
Create an instance of the concrete class that implements the UnnamedPipe interface.
| doOpen | Open the pipe or not. |
Definition at line 207 of file PosixUnnamedPipe.cpp.
Referenced by BLOCXX_NAMESPACE::Socket::createShutDownMechanism(), and BLOCXX_NAMESPACE::Exec::safePopen().
int BLOCXX_NAMESPACE::UnnamedPipe::m_readTimeout [protected] |
Definition at line 202 of file UnnamedPipe.hpp.
Referenced by BLOCXX_NAMESPACE::PosixUnnamedPipe::read().
int BLOCXX_NAMESPACE::UnnamedPipe::m_writeTimeout [protected] |
Definition at line 203 of file UnnamedPipe.hpp.
Referenced by BLOCXX_NAMESPACE::PosixUnnamedPipe::write().
1.5.3