Async 1.8.0
Async::FileReader Class Reference

#include <AsyncFileReader.h>

Inheritance diagram for Async::FileReader:

Public Member Functions

 FileReader (int buf_size)
 Constuctor.
 
 ~FileReader (void)
 Destructor.
 
bool open (const std::string &name)
 Open a file for binary reading.
 
bool close (void)
 Close a previously opened file.
 
bool isOpen (void) const
 Check if a file is currently opened.
 
int read (void *buf, int len)
 Read data from a previously opened file.
 

Detailed Description

Definition at line 112 of file AsyncFileReader.h.

Constructor & Destructor Documentation

◆ FileReader()

Async::FileReader::FileReader ( int buf_size)

Constuctor.

Parameters
buf_sizeThe device name of the serial port to use

This is the constructor for the file reader class. The buffer size should be assigned at least twice as large as the maximum block size to be read.

◆ ~FileReader()

Async::FileReader::~FileReader ( void )

Destructor.

Member Function Documentation

◆ close()

bool Async::FileReader::close ( void )

Close a previously opened file.

Returns
Return true on success or else false on failue.

◆ isOpen()

bool Async::FileReader::isOpen ( void ) const
inline

Check if a file is currently opened.

Returns
Returns true if a file is currently opened or false if no file has been opened or if the file was already closed.

Definition at line 150 of file AsyncFileReader.h.

◆ open()

bool Async::FileReader::open ( const std::string & name)

Open a file for binary reading.

Parameters
nameThe file name to be opened
Returns
Return true on success or else false on failue.

◆ read()

int Async::FileReader::read ( void * buf,
int len )

Read data from a previously opened file.

Parameters
bufA read target data buffer
lenThe number of bytes to be read
Returns
The number of read bytes is returned on success. If an error occurs, -1 is returned.

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