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>
|
off_t | getCapacity (void) |
| Get current file capacity. More...
|
|
Error | getErrorNumber (void) const |
| Return current error id. More...
|
|
char * | getErrorString (void) const |
| Return current error string. More...
|
|
bool | initial (void) |
| This method should be called right after a RandomFile derived object has been created. More...
|
|
| operator bool () const |
|
bool | operator! (void) const |
|
virtual Error | restart (void) |
| This method is commonly used to close and re-open an existing database. More...
|
|
virtual | ~RandomFile () |
| Destroy a random access file or it's derived class.
|
|
|
Error | error (Error errid, char *errstr=NULL) |
| Post an error event. More...
|
|
Error | error (char *err) |
| Post an extended string error message. More...
|
|
void | final (void) |
| Close the file.
|
|
virtual Attr | initialize (void) |
| This method is used to initialize a newly created file as indicated by the "initial" flag. More...
|
|
| RandomFile (const char *name=NULL) |
| Create an unopened random access file.
|
|
| RandomFile (const RandomFile &rf) |
| Default copy constructor.
|
|
Error | setCompletion (Complete mode) |
| Used to set file completion modes. More...
|
|
void | setError (bool enable) |
| Used to enable or disable throwing of exceptions on errors. More...
|
|
void | setTemporary (bool enable) |
| Used to set the temporary attribute for the file. More...
|
|
|
Access | access |
|
int | fd |
|
struct { |
unsigned count: 16 |
|
bool immediate: 1 |
|
bool initial: 1 |
|
bool temp: 1 |
|
bool thrown: 1 |
|
} | flags |
|
char * | pathname |
|
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.nosp@m.@ost.nosp@m.el.co.nosp@m.m Portable random disk file access.
Definition at line 392 of file file.h.
◆ error() [1/2]
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. |
◆ error() [2/2]
Error ost::RandomFile::error |
( |
char * |
err | ) |
|
|
inlineprotected |
Post an extended string error message.
- Returns
- errExtended.
- Parameters
-
Definition at line 443 of file file.h.
◆ getCapacity()
off_t ost::RandomFile::getCapacity |
( |
void |
| ) |
|
Get current file capacity.
- Returns
- total file size.
◆ getErrorNumber()
Error ost::RandomFile::getErrorNumber |
( |
void |
| ) |
const |
|
inline |
Return current error id.
- Returns
- last error identifier set.
Definition at line 531 of file file.h.
◆ getErrorString()
char* ost::RandomFile::getErrorString |
( |
void |
| ) |
const |
|
inline |
Return current error string.
- Returns
- last error string set.
Definition at line 540 of file file.h.
◆ initial()
bool ost::RandomFile::initial |
( |
void |
| ) |
|
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.
◆ initialize()
virtual Attr ost::RandomFile::initialize |
( |
void |
| ) |
|
|
protectedvirtual |
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.
◆ restart()
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::SharedFile.
◆ setCompletion()
Error ost::RandomFile::setCompletion |
( |
Complete |
mode | ) |
|
|
protected |
Used to set file completion modes.
- Returns
- errSuccess if okay.
- Parameters
-
- Todo:
- implement in win32
◆ setError()
void ost::RandomFile::setError |
( |
bool |
enable | ) |
|
|
inlineprotected |
Used to enable or disable throwing of exceptions on errors.
- Parameters
-
enable | true if errors will be thrown. |
Definition at line 453 of file file.h.
◆ setTemporary()
void ost::RandomFile::setTemporary |
( |
bool |
enable | ) |
|
|
inlineprotected |
Used to set the temporary attribute for the file.
Temporary files are automatically deleted when closed.
- Parameters
-
enable | true for marking as temporary. |
Definition at line 474 of file file.h.
◆ canAccess()
bool canAccess |
( |
const char * |
path | ) |
|
|
related |
◆ canModify()
bool canModify |
( |
const char * |
path | ) |
|
|
related |
◆ isDevice()
bool isDevice |
( |
const char * |
path | ) |
|
|
related |
◆ isDir()
bool isDir |
( |
const char * |
path | ) |
|
|
related |
◆ isFile()
bool isFile |
( |
const char * |
path | ) |
|
|
related |
◆ lastAccessed()
time_t lastAccessed |
( |
const char * |
path | ) |
|
|
related |
◆ lastModified()
time_t lastModified |
( |
const char * |
path | ) |
|
|
related |
The documentation for this class was generated from the following file: