Public Member Functions | |
FileStream (const std::string ¶ms) | |
Create the stream and associates a file descriptor. | |
FileStream (const string &targetName) | |
Parse the target name and create the corresponding file stream. | |
virtual void | flush () |
Flushes stream. | |
virtual void | notifyEvent (Hub *srv, EvType &t) |
Callback when an event is notified, allowing the stream to rearm it. | |
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. | |
~FileStream () | |
Destructor. | |
Protected Member Functions | |
FileStream (const std::string &protocolName, bool dummy) | |
Create a blank stream. | |
void | startStream (EvType et=EvData) |
Start non-blocking read on stream to get notifications when data arrives. | |
Protected Attributes | |
HANDLE | hf |
The file handle. | |
OVERLAPPED | ovl |
The overlapped structure used for file reads. | |
char | readByte |
Byte that is read to check for disconnections. Yuck. | |
bool | readByteAvailable |
Flag indicating whether readByte is around. | |
bool | readyToRead |
Indicates whether stream is actually ready to read. | |
DWORD | writeOffset |
The current write offset. |
Dashel::FileStream::FileStream | ( | const string & | targetName | ) | [inline] |
Parse the target name and create the corresponding file stream.
Definition at line 794 of file dashel-posix.cpp.
Dashel::FileStream::FileStream | ( | const std::string & | protocolName, |
bool | dummy | ||
) | [inline, protected] |
Create a blank stream.
This constructor is used only by derived classes that initialize differently.
Definition at line 555 of file dashel-win32.cpp.
Dashel::FileStream::FileStream | ( | const std::string & | params | ) | [inline] |
Create the stream and associates a file descriptor.
Definition at line 577 of file dashel-win32.cpp.
Dashel::FileStream::~FileStream | ( | ) | [inline] |
Destructor.
Definition at line 606 of file dashel-win32.cpp.
virtual void Dashel::FileStream::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.
Reimplemented from Dashel::FileDescriptorStream.
Reimplemented in Dashel::SerialStream, Dashel::StdoutStream, and Dashel::StdinStream.
Definition at line 668 of file dashel-win32.cpp.
virtual void Dashel::FileStream::notifyEvent | ( | Hub * | srv, |
EvType & | t | ||
) | [inline, virtual] |
Callback when an event is notified, allowing the stream to rearm it.
t | Type of event. |
Reimplemented from Dashel::WaitableStream.
Reimplemented in Dashel::StdinStream.
Definition at line 766 of file dashel-win32.cpp.
virtual void Dashel::FileStream::read | ( | void * | data, |
size_t | size | ||
) | [inline, 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. |
Reimplemented from Dashel::FileDescriptorStream.
Reimplemented in Dashel::StdoutStream, and Dashel::StdinStream.
Definition at line 673 of file dashel-win32.cpp.
void Dashel::FileStream::startStream | ( | EvType | et = EvData | ) | [inline, protected] |
Start non-blocking read on stream to get notifications when data arrives.
Definition at line 558 of file dashel-win32.cpp.
virtual void Dashel::FileStream::write | ( | const void * | data, |
const size_t | size | ||
) | [inline, 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. |
Reimplemented from Dashel::FileDescriptorStream.
Reimplemented in Dashel::StdoutStream, and Dashel::StdinStream.
Definition at line 611 of file dashel-win32.cpp.
HANDLE Dashel::FileStream::hf [protected] |
The file handle.
Reimplemented in Dashel::StdoutStream, and Dashel::StdinStream.
Definition at line 530 of file dashel-win32.cpp.
OVERLAPPED Dashel::FileStream::ovl [protected] |
The overlapped structure used for file reads.
Definition at line 533 of file dashel-win32.cpp.
char Dashel::FileStream::readByte [protected] |
Byte that is read to check for disconnections. Yuck.
Definition at line 546 of file dashel-win32.cpp.
bool Dashel::FileStream::readByteAvailable [protected] |
Flag indicating whether readByte is around.
Definition at line 549 of file dashel-win32.cpp.
bool Dashel::FileStream::readyToRead [protected] |
Indicates whether stream is actually ready to read.
If a read is attempted when this flag is false, we need to wait for data to arrive, because our user is being cruel and did not wait for the notification.
Definition at line 543 of file dashel-win32.cpp.
DWORD Dashel::FileStream::writeOffset [protected] |
The current write offset.
Definition at line 536 of file dashel-win32.cpp.