Public Member Functions | Protected Member Functions | Protected Attributes
Dashel::FileStream Class Reference

Stream for file. More...

Inheritance diagram for Dashel::FileStream:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 FileStream (const std::string &params)
 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.

Detailed Description

Stream for file.

File stream.

Definition at line 790 of file dashel-posix.cpp.


Constructor & Destructor Documentation

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.

Destructor.

Definition at line 606 of file dashel-win32.cpp.


Member Function Documentation

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.

Parameters:
tType 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.

Parameters:
dataPointer to the memory where the read data should be stored.
sizeAmount 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().

Parameters:
dataPointer to the data to write.
sizeAmount 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.


Member Data Documentation

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.

Flag indicating whether readByte is around.

Definition at line 549 of file dashel-win32.cpp.

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.

The current write offset.

Definition at line 536 of file dashel-win32.cpp.


The documentation for this class was generated from the following files:


dashel
Author(s): Stéphane Magnenat
autogenerated on Sun Oct 5 2014 23:46:32