POSIX handle as Payload. More...
#include <PayloadStream.h>
Public Member Functions | |
PayloadStream (int h=-1) | |
virtual | ~PayloadStream (void) |
virtual bool | Get (char *buf, int &size) |
virtual bool | Get (std::string &buf) |
virtual std::string | Get (void) |
virtual bool | Put (const char *buf, Size_t size) |
virtual bool | Put (const std::string &buf) |
virtual bool | Put (const char *buf) |
virtual | operator bool (void) |
virtual bool | operator! (void) |
virtual int | Timeout (void) const |
virtual void | Timeout (int to) |
virtual Size_t | Pos (void) const |
virtual Size_t | Size (void) const |
virtual Size_t | Limit (void) const |
Protected Attributes | |
int | handle_ |
bool | seekable_ |
POSIX handle as Payload.
This is an implemetation of PayloadStreamInterface for generic POSIX handle.
Arc::PayloadStream::PayloadStream | ( | int | h = -1 |
) |
true if lseek operation is applicable to open handle Constructor. Attaches to already open handle. Handle is not managed by this class and must be closed by external code.
virtual Arc::PayloadStream::~PayloadStream | ( | void | ) | [inline, virtual] |
Destructor.
virtual std::string Arc::PayloadStream::Get | ( | void | ) | [inline, virtual] |
Read as many as possible (sane amount) of bytes.
Implements Arc::PayloadStreamInterface.
References Get().
Referenced by Get().
virtual bool Arc::PayloadStream::Get | ( | std::string & | buf | ) | [virtual] |
Read as many as possible (sane amount) of bytes into buf.
Implements Arc::PayloadStreamInterface.
virtual bool Arc::PayloadStream::Get | ( | char * | buf, | |
int & | size | |||
) | [virtual] |
Extracts information from stream up to 'size' bytes. 'size' contains number of read bytes on exit. Returns true in case of success.
Implements Arc::PayloadStreamInterface.
virtual Size_t Arc::PayloadStream::Limit | ( | void | ) | const [inline, virtual] |
Returns position at which stream reading will stop if supported. That may be not same as Size() if instance is meant to provide access to only part of underlying obejct.
Implements Arc::PayloadStreamInterface.
virtual Arc::PayloadStream::operator bool | ( | void | ) | [inline, virtual] |
virtual bool Arc::PayloadStream::operator! | ( | void | ) | [inline, virtual] |
virtual Size_t Arc::PayloadStream::Pos | ( | void | ) | const [inline, virtual] |
Returns current position in stream if supported.
Implements Arc::PayloadStreamInterface.
virtual bool Arc::PayloadStream::Put | ( | const char * | buf | ) | [inline, virtual] |
Push null terminated information from 'buf' into stream. Returns true on success.
Implements Arc::PayloadStreamInterface.
References Put().
Referenced by Put().
virtual bool Arc::PayloadStream::Put | ( | const std::string & | buf | ) | [inline, virtual] |
Push information from 'buf' into stream. Returns true on success.
Implements Arc::PayloadStreamInterface.
References Put().
Referenced by Put().
virtual bool Arc::PayloadStream::Put | ( | const char * | buf, | |
Size_t | size | |||
) | [virtual] |
Push 'size' bytes from 'buf' into stream. Returns true on success.
Implements Arc::PayloadStreamInterface.
virtual Size_t Arc::PayloadStream::Size | ( | void | ) | const [inline, virtual] |
Returns size of underlying object if supported.
Implements Arc::PayloadStreamInterface.
virtual void Arc::PayloadStream::Timeout | ( | int | to | ) | [inline, virtual] |
Set current timeout for Get() and Put() operations.
Implements Arc::PayloadStreamInterface.
virtual int Arc::PayloadStream::Timeout | ( | void | ) | const [inline, virtual] |
Query current timeout for Get() and Put() operations.
Implements Arc::PayloadStreamInterface.
int Arc::PayloadStream::handle_ [protected] |
Timeout for read/write operations
Referenced by operator bool(), and operator!().
bool Arc::PayloadStream::seekable_ [protected] |
Handle for operations