The system-neutral part of packet stream that implement the actual memory buffers. More...
#include <dashel-private.h>
Public Member Functions | |
virtual void | flush () |
Flushes stream. | |
MemoryPacketStream (const std::string &protocolName) | |
Constructor. | |
virtual void | read (void *data, size_t size) |
Reads data from the stream. | |
virtual void | write (const void *data, const size_t size) |
Write data to the stream. | |
Protected Attributes | |
std::deque< unsigned char > | receptionBuffer |
The buffer holding data from last receive. | |
ExpandableBuffer | sendBuffer |
The buffer collecting data to send. |
The system-neutral part of packet stream that implement the actual memory buffers.
Definition at line 82 of file dashel-private.h.
Dashel::MemoryPacketStream::MemoryPacketStream | ( | const std::string & | protocolName | ) | [inline] |
Constructor.
Definition at line 92 of file dashel-private.h.
virtual void Dashel::MemoryPacketStream::flush | ( | ) | [inline, virtual] |
Flushes stream.
Calling this function requests the stream to be flushed, this may ensure that data is written to physical media or actually sent over a wire. The exact performed function depends on the stream type and operating system.
Implements Dashel::Stream.
Definition at line 96 of file dashel-private.h.
void Dashel::MemoryPacketStream::read | ( | void * | data, | |
size_t | size | |||
) | [virtual] |
Reads data from the stream.
Reads all requested data from the stream, blocking until all the data has been read, or some error occurs. Errors are signaled by throwing a DashelException exception, which may be caused either by device errors or reaching the end of file.
data | Pointer to the memory where the read data should be stored. | |
size | Amount of data to read in bytes. |
Implements Dashel::Stream.
Definition at line 282 of file dashel-common.cpp.
void Dashel::MemoryPacketStream::write | ( | const void * | data, | |
const size_t | size | |||
) | [virtual] |
Write data to the stream.
Writes all requested data to the stream, blocking until all the data has been written, or some error occurs. Errors are signaled by throwing a DashelException exception. This function does not flush devices, therefore the data may not really have been written on return, but only been buffered. In order to flush the stream, call flush().
data | Pointer to the data to write. | |
size | Amount of data to write in bytes. |
Implements Dashel::Stream.
Definition at line 277 of file dashel-common.cpp.
std::deque<unsigned char> Dashel::MemoryPacketStream::receptionBuffer [protected] |
The buffer holding data from last receive.
Definition at line 88 of file dashel-private.h.
The buffer collecting data to send.
Definition at line 86 of file dashel-private.h.