Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

FileReprBase Class Reference

This class represents the base class of a file representation. More...

#include <FileReprBase.hpp>

Inheritance diagram for FileReprBase:

Inheritance graph
[legend]
List of all members.

Public Types

enum  Mode { READ, WRITE }

Public Member Functions

 FileReprBase (const params_t *par)
 ~FileReprBase ()
void rewind ()
 It rewinds the file to the beginning.
void flush ()
 It flushes the low-level buffer.
std::streamsize readFromFile (char *buffer, std::streamsize buffer_size)
 This method reads in a block of characters from the file and places it in a buffer.
void writeToFile (const char *buffer, std::streamsize n)
 This method writes out a block of characters to the file.

Protected Attributes

char * file_buffer
 the low-level buffer
std::streamsize file_buffer_size
 the size of the lowest level buffer
Mode mode
 operating mode

Classes

class  params_t
 The parameter class of the IO constructor. More...

Detailed Description

This class represents the base class of a file representation.

There are many ways of representing a file in C++. We created an IO framework where the file representation is changeable. This way we could test the efficacy of the different solutions. Our experiment showed that file descriptor-based representation is the fastest.

Definition at line 17 of file FileReprBase.hpp.


Member Enumeration Documentation

enum FileReprBase::Mode
 

Enumerator:
READ 
WRITE 

Definition at line 20 of file FileReprBase.hpp.


Constructor & Destructor Documentation

FileReprBase::FileReprBase const params_t par  )  [inline]
 

Definition at line 45 of file FileReprBase.hpp.

References file_buffer, FileReprBase::params_t::file_buffer_size, FileReprBase::params_t::mode, and mode.

FileReprBase::~FileReprBase  )  [inline]
 

Definition at line 52 of file FileReprBase.hpp.

References file_buffer.


Member Function Documentation

void FileReprBase::flush  )  [inline]
 

It flushes the low-level buffer.

Reimplemented in FDRepr, FILERepr, and StreamRepr.

Definition at line 63 of file FileReprBase.hpp.

std::streamsize FileReprBase::readFromFile char *  buffer,
std::streamsize  buffer_size
[inline]
 

This method reads in a block of characters from the file and places it in a buffer.

Parameters:
buffer the buffer where the chacters are copied to
buffer_size the number of characters to read in
Returns:
the number of character that has succesfully read in. If the end of the file is reached before the buffer could be filled in, then this value will be smaller than buffer_size.

Reimplemented in FDRepr, FILERepr, and StreamRepr.

Definition at line 74 of file FileReprBase.hpp.

void FileReprBase::rewind  )  [inline]
 

It rewinds the file to the beginning.

Obviously this method makes sense when the file is opened for reading.

Reimplemented in FDRepr, FILERepr, and StreamRepr.

Definition at line 60 of file FileReprBase.hpp.

void FileReprBase::writeToFile const char *  buffer,
std::streamsize  n
[inline]
 

This method writes out a block of characters to the file.

Parameters:
buffer the buffer that contains the characters
n the number of characters to write out

Reimplemented in FDRepr, FILERepr, and StreamRepr.

Definition at line 84 of file FileReprBase.hpp.


Member Data Documentation

char* FileReprBase::file_buffer [protected]
 

the low-level buffer

Definition at line 89 of file FileReprBase.hpp.

Referenced by FDRepr::FDRepr(), FILERepr::FILERepr(), FileReprBase(), FDRepr::flush(), StreamRepr::StreamRepr(), FDRepr::writeToFile(), and ~FileReprBase().

std::streamsize FileReprBase::file_buffer_size [protected]
 

the size of the lowest level buffer

Definition at line 91 of file FileReprBase.hpp.

Referenced by FDRepr::FDRepr(), and FDRepr::flush().

Mode FileReprBase::mode [protected]
 

operating mode

Definition at line 93 of file FileReprBase.hpp.

Referenced by SimpleOutputTester::doTest(), FileReprBase(), and FDRepr::~FDRepr().


The documentation for this class was generated from the following file:
Generated on Sun Sep 17 17:55:20 2006 for FIM environment by  doxygen 1.4.4