ost::RandomFile Class Reference
The purpose of this class is to define a base class for low level random file access that is portable between Win32 and Posix systems.
More...
#include <file.h>
List of all members.
Detailed Description
The purpose of this class is to define a base class for low level random file access that is portable between Win32 and Posix systems.
This class is a foundation both for optimized thread shared and traditional locked file access that is commonly used to build database services, rather than the standard C++ streaming file classes.
- Author:
- David Sugar <dyfet@ostel.com> Portable random disk file access.
Constructor & Destructor Documentation
ost::RandomFile::RandomFile |
( |
const char * |
name = NULL |
) |
[protected] |
Create an unopened random access file.
ost::RandomFile::RandomFile |
( |
const RandomFile & |
rf |
) |
[protected] |
Default copy constructor.
virtual ost::RandomFile::~RandomFile |
( |
|
) |
[virtual] |
Destroy a random access file or it's derived class.
Member Function Documentation
Error ost::RandomFile::error |
( |
char * |
err |
) |
[inline, protected] |
Post an extended string error message.
- Returns:
- errExtended.
- Parameters:
-
References error().
Referenced by error().
Error ost::RandomFile::error |
( |
Error |
errid, |
|
|
char * |
errstr = NULL | |
|
) |
| | [protected] |
Post an error event.
- Returns:
- error code.
- Parameters:
-
| errid | error code. |
| errstr | error message string. |
void ost::RandomFile::final |
( |
void |
|
) |
[protected] |
off_t ost::RandomFile::getCapacity |
( |
void |
|
) |
|
Get current file capacity.
- Returns:
- total file size.
Error ost::RandomFile::getErrorNumber |
( |
void |
|
) |
[inline] |
Return current error id.
- Returns:
- last error identifier set.
char* ost::RandomFile::getErrorString |
( |
void |
|
) |
[inline] |
Return current error string.
- Returns:
- last error string set.
This method should be called right after a RandomFile derived object has been created.
This method will invoke initialize if the object is newly created, and set file access permissions appropriately.
- Returns:
- true if file had to be initialized.
virtual Attr ost::RandomFile::initialize |
( |
void |
|
) |
[protected, virtual] |
This method is used to initialize a newly created file as indicated by the "initial" flag.
This method also returns the file access permissions that should be associated with the file. This method should never be called directly, but is instead used to impliment the "Initial" method. Typically one would use this to build an empty database shell when a previously empty database file is created.
- Returns:
- access, or attrInvalid if should be removed.
bool ost::RandomFile::operator! |
( |
void |
|
) |
|
virtual Error ost::RandomFile::restart |
( |
void |
|
) |
[virtual] |
This method is commonly used to close and re-open an existing database.
This may be used when the database has been unlinked and an external process provides a new one to use.
Reimplemented in ost::ThreadFile, and ost::SharedFile.
Error ost::RandomFile::setCompletion |
( |
Complete |
mode |
) |
[protected] |
Used to set file completion modes.
- Returns:
- errSuccess if okay.
- Parameters:
-
- Todo:
- implement in win32
void ost::RandomFile::setError |
( |
bool |
enable |
) |
[inline, protected] |
Used to enable or disable throwing of exceptions on errors.
- Parameters:
-
| enable | true if errors will be thrown. |
void ost::RandomFile::setTemporary |
( |
bool |
enable |
) |
[inline, protected] |
Used to set the temporary attribute for the file.
Temporary files are automatically deleted when closed.
- Parameters:
-
| enable | true for marking as temporary. |
Friends And Related Function Documentation
bool canAccess |
( |
const char * |
path |
) |
[related] |
bool canModify |
( |
const char * |
path |
) |
[related] |
bool isDevice |
( |
const char * |
path |
) |
[related] |
bool isDir |
( |
const char * |
path |
) |
[related] |
bool isFile |
( |
const char * |
path |
) |
[related] |
time_t lastAccessed |
( |
const char * |
path |
) |
[related] |
time_t lastModified |
( |
const char * |
path |
) |
[related] |
Member Data Documentation
The documentation for this class was generated from the following file: