Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

File Class Reference

#include <File.hpp>

List of all members.

Public Types

typedef off_t offset_type
 Large file offset type.

typedef off_t library_offset_type
 IO library offset type.


Public Methods

 File ()
 ~File ()
void open (const std::string &fileName, int mode)
void close ()
 Closes the File, closing all segments.

void read (void *buffer, offset_type count)
 Read count bytes into buffer from File.

void write (const void *buffer, offset_type count)
 Write count bytes from buffer into File.

void seekg (offset_type relativePosition, std::fstream::seekdir direction)
 Move the get pointer.

void seekp (offset_type relativePosition, std::fstream::seekdir direction)
 Move the put pointer.

offset_type tellg ()
 Return the value of the get pointer.

offset_type tellp ()
 Return the value of the put pointer.

offset_type gcount ()
 Return the number of bytes read by last read.

int rdstate ()
 Returns eof bit set if at end of File.

offset_type size () const
 Returns size of last segment in file.

void unlink ()
 Close and remove File, and all segments from filesystem.


Static Public Methods

void unlink (const std::string &fileName)
 Remove each segment from filesystem.

void rename (const std::string &oldName, const std::string &newName)
 Rename File from oldName to newName. Renames all segments.


Private Methods

void _appendSegment ()
offset_type _absolutePosition (offset_type relativePosition, offset_type currentPosition, std::fstream::seekdir direction) const
FileSegment_segmentForPosition (offset_type absolutePosition, FileSegment *guess)
void _validateReadPointer ()
void _validateWritePointer ()

Static Private Methods

std::string segmentName (const std::string &fileName, int segment)

Private Attributes

std::string _fileName
std::vector< FileSegment * > _segments
FileSegment_readSegment
FileSegment_writeSegment
offset_type _readPosition
offset_type _writePosition
offset_type _readCount
bool _readPointerValid
bool _writePointerValid
int _mode
int _state


Detailed Description

Provide single file interface file date stored in multiple segment files on disk. Keeps each segment size below 2GB for OSes without large file support.


Member Typedef Documentation

typedef off_t File::library_offset_type
 

IO library offset type.

typedef off_t File::offset_type
 

Large file offset type.


Constructor & Destructor Documentation

File::File   [inline]
 

File::~File   [inline]
 


Member Function Documentation

offset_type File::_absolutePosition offset_type    relativePosition,
offset_type    currentPosition,
std::fstream::seekdir    direction
const [inline, private]
 

void File::_appendSegment   [inline, private]
 

FileSegment* File::_segmentForPosition offset_type    absolutePosition,
FileSegment   guess
[inline, private]
 

void File::_validateReadPointer   [inline, private]
 

void File::_validateWritePointer   [inline, private]
 

void File::close   [inline]
 

Closes the File, closing all segments.

offset_type File::gcount   [inline]
 

Return the number of bytes read by last read.

void File::open const std::string &    fileName,
int    mode
[inline]
 

Open the file named fileName with the provided mode flags. Initializes individual file segments.

int File::rdstate   [inline]
 

Returns eof bit set if at end of File.

void File::read void *    buffer,
offset_type    count
[inline]
 

Read count bytes into buffer from File.

void File::rename const std::string &    oldName,
const std::string &    newName
[inline, static]
 

Rename File from oldName to newName. Renames all segments.

void File::seekg offset_type    relativePosition,
std::fstream::seekdir    direction
[inline]
 

Move the get pointer.

void File::seekp offset_type    relativePosition,
std::fstream::seekdir    direction
[inline]
 

Move the put pointer.

std::string File::segmentName const std::string &    fileName,
int    segment
[inline, static, private]
 

offset_type File::size   const [inline]
 

Returns size of last segment in file.

offset_type File::tellg   [inline]
 

Return the value of the get pointer.

offset_type File::tellp   [inline]
 

Return the value of the put pointer.

void File::unlink const std::string &    fileName [inline, static]
 

Remove each segment from filesystem.

void File::unlink   [inline]
 

Close and remove File, and all segments from filesystem.

void File::write const void *    buffer,
offset_type    count
[inline]
 

Write count bytes from buffer into File.


Member Data Documentation

std::string File::_fileName [private]
 

int File::_mode [private]
 

offset_type File::_readCount [private]
 

bool File::_readPointerValid [private]
 

offset_type File::_readPosition [private]
 

FileSegment* File::_readSegment [private]
 

std::vector<FileSegment*> File::_segments [private]
 

int File::_state [private]
 

bool File::_writePointerValid [private]
 

offset_type File::_writePosition [private]
 

FileSegment* File::_writeSegment [private]
 


The documentation for this class was generated from the following file:
Generated on Fri Feb 6 07:12:00 2004 for LEMUR by doxygen1.2.16