#include <file.h>
Public Member Functions | |
virtual | ~RandomFile () |
Destroy a random access file or it's derived class. | |
bool | initial (void) |
This method should be called right after a RandomFile derived object has been created. | |
off_t | getCapacity (void) |
Get current file capacity. | |
virtual Error | restart (void) |
This method is commonly used to close and re-open an existing database. | |
Error | getErrorNumber (void) |
Return current error id. | |
char * | getErrorString (void) |
Return current error string. | |
bool | operator! (void) |
Protected Member Functions | |
RandomFile (const char *name=NULL) | |
Create an unopened random access file. | |
RandomFile (const RandomFile &rf) | |
Default copy constructor. | |
Error | error (Error errid, char *errstr=NULL) |
Post an error event. | |
Error | error (char *err) |
Post an extended string error message. | |
void | setError (bool enable) |
Used to enable or disable throwing of exceptions on errors. | |
Error | setCompletion (Complete mode) |
Used to set file completion modes. | |
void | setTemporary (bool enable) |
Used to set the temporary attribute for the file. | |
virtual Attr | initialize (void) |
This method is used to initialize a newly created file as indicated by the "initial" flag. | |
void | final (void) |
Close the file. | |
Protected Attributes | |
int | fd |
Access | access |
char * | pathname |
struct { | |
unsigned count: 16 | |
bool thrown: 1 | |
bool initial: 1 | |
bool immediate: 1 | |
bool temp: 1 | |
} | flags |
Related Functions | |
(Note that these are not member functions.) | |
bool __EXPORT | isDir (const char *path) |
bool __EXPORT | isFile (const char *path) |
bool __EXPORT | isDevice (const char *path) |
bool __EXPORT | canAccess (const char *path) |
bool __EXPORT | canModify (const char *path) |
time_t __EXPORT | lastModified (const char *path) |
time_t __EXPORT | lastAccessed (const char *path) |
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.
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.
Post an error event.
errid | error code. | |
errstr | error message string. |
Error ost::RandomFile::error | ( | char * | err | ) | [inline, protected] |
Post an extended string error message.
err | error string. |
void ost::RandomFile::setError | ( | bool | enable | ) | [inline, protected] |
Used to enable or disable throwing of exceptions on errors.
enable | true if errors will be thrown. |
Used to set file completion modes.
mode | completion mode. |
void ost::RandomFile::setTemporary | ( | bool | enable | ) | [inline, protected] |
Used to set the temporary attribute for the file.
Temporary files are automatically deleted when closed.
enable | true for marking as temporary. |
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.
void ost::RandomFile::final | ( | void | ) | [protected] |
Close the file.
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.
off_t ost::RandomFile::getCapacity | ( | void | ) |
Get current file capacity.
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::getErrorNumber | ( | void | ) | [inline] |
Return current error id.
char* ost::RandomFile::getErrorString | ( | void | ) | [inline] |
Return current error string.
bool ost::RandomFile::operator! | ( | void | ) |
bool __EXPORT isDir | ( | const char * | path | ) | [related] |
bool __EXPORT isFile | ( | const char * | path | ) | [related] |
bool __EXPORT isDevice | ( | const char * | path | ) | [related] |
bool __EXPORT canAccess | ( | const char * | path | ) | [related] |
bool __EXPORT canModify | ( | const char * | path | ) | [related] |
time_t __EXPORT lastModified | ( | const char * | path | ) | [related] |
time_t __EXPORT lastAccessed | ( | const char * | path | ) | [related] |
int ost::RandomFile::fd [protected] |
Access ost::RandomFile::access [protected] |
char* ost::RandomFile::pathname [protected] |
unsigned ost::RandomFile::count |
struct { ... } ost::RandomFile::flags [protected] |