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 hEOF
 Event for notifying end of file (i.e. disconnect).
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 726 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 730 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 609 of file dashel-win32.cpp.

Dashel::FileStream::FileStream ( const std::string &  params  )  [inline]

Create the stream and associates a file descriptor.

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

Dashel::FileStream::~FileStream (  )  [inline]

Destructor.

Definition at line 662 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.

Definition at line 711 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:
t Type of event.

Reimplemented from Dashel::WaitableStream.

Definition at line 809 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:
data Pointer to the memory where the read data should be stored.
size Amount of data to read in bytes.

Reimplemented from Dashel::FileDescriptorStream.

Definition at line 716 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 612 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:
data Pointer to the data to write.
size Amount of data to write in bytes.

Reimplemented from Dashel::FileDescriptorStream.

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


Member Data Documentation

HANDLE Dashel::FileStream::hEOF [protected]

Event for notifying end of file (i.e. disconnect).

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

HANDLE Dashel::FileStream::hf [protected]

The file handle.

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

OVERLAPPED Dashel::FileStream::ovl [protected]

The overlapped structure used for file reads.

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

char Dashel::FileStream::readByte [protected]

Byte that is read to check for disconnections. Yuck.

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

Flag indicating whether readByte is around.

Definition at line 600 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 594 of file dashel-win32.cpp.

The current write offset.

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


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


asebaros
Author(s): $author
autogenerated on Mon Sep 5 08:42:16 2011