The C++ framework for developing highly scalable, high performance servers on Windows platforms.

CAsyncFileReader Class Reference
[Asynchronous I/OI/O BuffersFileIO]

Inheritance diagram for CAsyncFileReader:
Collaboration diagram for CAsyncFileReader:

List of all members.


Detailed Description

A class that implements IHandler to provide an asynchronous file reader that uses overlapped I/O to perform reads from the file. Data read from the file is provided in a 'push fashion' via the CAsyncFileReader::Callback interface.

Public Types

enum  ReadOptions {
  WaitToStartReading = 0x00, BeginReadingNow = 0x01, ManuallyIssueNewReads = 0x00, AutomaticallyIssueNewReads = 0x10,
  AutomaticallyReadWholeFile = 0x11
}

Public Member Functions

 CAsyncFileReader (const JetByteTools::Core::_tstring &filename, Callback &callback, const IIOPool &pool, IAllocateBuffers &allocator, int readOptions=AutomaticallyReadWholeFile)
 Read the specified file asynchronously using overlapped I/O via the threads in the supplied IIOPool into buffers provided by the IAllocateBuffers instance and push the data that is read to the CAsyncFileReader::Callback interface.
 CAsyncFileReader (const JetByteTools::Core::_tstring &filename, Callback &callback, const IIOPool &pool, IAllocateBuffers &allocator, IMonitorAsyncFileReader &monitor, int readOptions=AutomaticallyReadWholeFile)
 Read the specified file asynchronously using overlapped I/O via the threads in the supplied IIOPool into buffers provided by the IAllocateBuffers instance and push the data that is read to the CAsyncFileReader::Callback interface. Monitor the read using the supplied monitor.
 CAsyncFileReader (HANDLE hFile, Callback &callback, const IIOPool &pool, IAllocateBuffers &allocator, int readOptions=AutomaticallyReadWholeFile)
 Read the specified file asynchronously using overlapped I/O via the threads in the supplied IIOPool into buffers provided by the IAllocateBuffers instance and push the data that is read to the CAsyncFileReader::Callback interface. Note: that the file MUST have been opened in overlapped mode! Note: takes ownership of the file, the handle will be closed when the object is destroyed.
 CAsyncFileReader (HANDLE hFile, Callback &callback, const IIOPool &pool, IAllocateBuffers &allocator, IMonitorAsyncFileReader &monitor, int readOptions=AutomaticallyReadWholeFile)
 Read the specified file asynchronously using overlapped I/O via the threads in the supplied IIOPool into buffers provided by the IAllocateBuffers instance and push the data that is read to the CAsyncFileReader::Callback interface. Monitor the read using the supplied monitor. Note: that the file MUST have been opened in overlapped mode! Note: takes ownership of the file, the handle will be closed when the object is destroyed.
 CAsyncFileReader (const CAsyncFileReader &rhs)
 ~CAsyncFileReader () override
CAsyncFileReaderoperator= (const CAsyncFileReader &rhs)
void SetNextReadOffset (LARGE_INTEGER nextReadOffset)
void SetMaxReadSize (IBuffer::BufferSize size)
void StartReading ()
bool TryStartReading ()
void Close ()
HANDLE GetWaitHandle () const override
void Wait () const override
bool Wait (Milliseconds timeout) const override

Classes

class  Callback
 An interface for users of the CAsyncFileReader to be notified of the results of the asynchronous read operations on the file. More...

Member Enumeration Documentation

Enumerator:
WaitToStartReading 
BeginReadingNow 
ManuallyIssueNewReads 
AutomaticallyIssueNewReads 
AutomaticallyReadWholeFile 


Constructor & Destructor Documentation

CAsyncFileReader ( const JetByteTools::Core::_tstring filename,
Callback callback,
const IIOPool pool,
IAllocateBuffers allocator,
int  readOptions = AutomaticallyReadWholeFile 
)

Read the specified file asynchronously using overlapped I/O via the threads in the supplied IIOPool into buffers provided by the IAllocateBuffers instance and push the data that is read to the CAsyncFileReader::Callback interface.

CAsyncFileReader ( const JetByteTools::Core::_tstring filename,
Callback callback,
const IIOPool pool,
IAllocateBuffers allocator,
IMonitorAsyncFileReader monitor,
int  readOptions = AutomaticallyReadWholeFile 
)

Read the specified file asynchronously using overlapped I/O via the threads in the supplied IIOPool into buffers provided by the IAllocateBuffers instance and push the data that is read to the CAsyncFileReader::Callback interface. Monitor the read using the supplied monitor.

CAsyncFileReader ( HANDLE  hFile,
Callback callback,
const IIOPool pool,
IAllocateBuffers allocator,
int  readOptions = AutomaticallyReadWholeFile 
)

Read the specified file asynchronously using overlapped I/O via the threads in the supplied IIOPool into buffers provided by the IAllocateBuffers instance and push the data that is read to the CAsyncFileReader::Callback interface. Note: that the file MUST have been opened in overlapped mode! Note: takes ownership of the file, the handle will be closed when the object is destroyed.

CAsyncFileReader ( HANDLE  hFile,
Callback callback,
const IIOPool pool,
IAllocateBuffers allocator,
IMonitorAsyncFileReader monitor,
int  readOptions = AutomaticallyReadWholeFile 
)

Read the specified file asynchronously using overlapped I/O via the threads in the supplied IIOPool into buffers provided by the IAllocateBuffers instance and push the data that is read to the CAsyncFileReader::Callback interface. Monitor the read using the supplied monitor. Note: that the file MUST have been opened in overlapped mode! Note: takes ownership of the file, the handle will be closed when the object is destroyed.

CAsyncFileReader ( const CAsyncFileReader rhs  ) 

~CAsyncFileReader (  )  [override]


Member Function Documentation

CAsyncFileReader& operator= ( const CAsyncFileReader rhs  ) 

void SetNextReadOffset ( LARGE_INTEGER  nextReadOffset  ) 

void SetMaxReadSize ( IBuffer::BufferSize  size  ) 

void StartReading (  ) 

bool TryStartReading (  ) 

void Close (  ) 

HANDLE GetWaitHandle (  )  const [override]

void Wait (  )  const [override]

bool Wait ( Milliseconds  timeout  )  const [override]


Generated on Sun Sep 12 19:09:18 2021 for The Server Framework - v7.4 by doxygen 1.5.3