ost::RandomFile - The purpose of this class is to define a base class for low level random file access
Contents
Constructor & Destructor Documentation
ost::RandomFile::RandomFile(constchar*name=NULL)[protected]
Create an unopened random access file.
ost::RandomFile::RandomFile(constRandomFile&rf)[protected]
Default copy constructor.
virtualost::RandomFile::~RandomFile()[virtual]
Destroy a random access file or it's derived class.
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.
Member Data Documentation
Accessost::RandomFile::access[protected]unsignedost::RandomFile::countintost::RandomFile::fd[protected]struct{...}ost::RandomFile::flags[protected]boolost::RandomFile::immediateboolost::RandomFile::initialchar*ost::RandomFile::pathname[protected]boolost::RandomFile::tempboolost::RandomFile::thrownMember Function Documentation
Errorost::RandomFile::error(char*err)[inline],[protected]
Post an extended string error message.
Returns
errExtended.
Parameterserr error string.
References ost::error().
Errorost::RandomFile::error(Errorerrid,char*errstr=NULL)[protected]
Post an error event.
Returns
error code.
Parameterserrid error code.
errstr error message string.
voidost::RandomFile::final(void)[protected]
Close the file.
off_tost::RandomFile::getCapacity(void)
Get current file capacity.
Returns
total file size.
Errorost::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.
boolost::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.
virtualAttrost::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.
boolost::RandomFile::operator!(void)virtualErrorost::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, and ost::ThreadFile.
Errorost::RandomFile::setCompletion(Completemode)[protected]
Used to set file completion modes.
Returns
errSuccess if okay.
Parametersmode completion mode.
voidost::RandomFile::setError(boolenable)[inline],[protected]
Used to enable or disable throwing of exceptions on errors.
Parametersenable true if errors will be thrown.
voidost::RandomFile::setTemporary(boolenable)[inline],[protected]
Used to set the temporary attribute for the file. Temporary files are automatically deleted when closed.
Parametersenable true for marking as temporary.
Name
ost::RandomFile - 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.
Synopsis
#include <file.h>
Inherits ost::Mutex, and ost::File.
Inherited by ost::MappedFile, ost::SharedFile, and ost::ThreadFile.
PublicMemberFunctions
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 Errorrestart (void)
This method is commonly used to close and re-open an existing database.
ErrorgetErrorNumber (void)
Return current error id.
char * getErrorString (void)
Return current error string.
bool operator! (void)
ProtectedMemberFunctionsRandomFile (const char *name=NULL)
Create an unopened random access file.
RandomFile (const RandomFile &rf)
Default copy constructor.
Errorerror (Error errid, char *errstr=NULL)
Post an error event.
Errorerror (char *err)
Post an extended string error message.
void setError (bool enable)
Used to enable or disable throwing of exceptions on errors.
ErrorsetCompletion (Complete mode)
Used to set file completion modes.
void setTemporary (bool enable)
Used to set the temporary attribute for the file.
virtual Attrinitialize (void)
This method is used to initialize a newly created file as indicated by the 'initial' flag.
void final (void)
Close the file.
ProtectedAttributes
int fdAccessaccess
char * pathname
struct {
unsigned count: 16
bool thrown: 1
bool initial: 1
bool immediate: 1
bool temp: 1
} flagsRelatedFunctions
(Note that these are not member functions.)
bool __EXPORTisDir (const char *path)
bool __EXPORTisFile (const char *path)
bool __EXPORTisDevice (const char *path)
bool __EXPORTcanAccess (const char *path)
bool __EXPORTcanModify (const char *path)
time_t __EXPORTlastModified (const char *path)
time_t __EXPORTlastAccessed (const char *path)
AdditionalInheritedMembers