.TH "ost::RandomFile" 3 "Sun Dec 27 2020" "GNU CommonC++" \" -*- nroff -*- .ad l .nh .SH 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\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBost::Mutex\fP, and \fBost::File\fP\&. .PP Inherited by \fBost::MappedFile\fP, \fBost::SharedFile\fP, and \fBost::ThreadFile\fP\&. .SS "Public Member Functions" .in +1c .ti -1c .RI "virtual \fB~RandomFile\fP ()" .br .RI "Destroy a random access file or it's derived class\&. " .ti -1c .RI "bool \fBinitial\fP (void)" .br .RI "This method should be called right after a \fBRandomFile\fP derived object has been created\&. " .ti -1c .RI "off_t \fBgetCapacity\fP (void)" .br .RI "Get current file capacity\&. " .ti -1c .RI "virtual \fBError\fP \fBrestart\fP (void)" .br .RI "This method is commonly used to close and re-open an existing database\&. " .ti -1c .RI "\fBError\fP \fBgetErrorNumber\fP (void)" .br .RI "Return current error id\&. " .ti -1c .RI "char * \fBgetErrorString\fP (void)" .br .RI "Return current error string\&. " .ti -1c .RI "bool \fBoperator!\fP (void)" .br .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "\fBRandomFile\fP (const char *name=NULL)" .br .RI "Create an unopened random access file\&. " .ti -1c .RI "\fBRandomFile\fP (const \fBRandomFile\fP &rf)" .br .RI "Default copy constructor\&. " .ti -1c .RI "\fBError\fP \fBerror\fP (\fBError\fP errid, char *errstr=NULL)" .br .RI "Post an error event\&. " .ti -1c .RI "\fBError\fP \fBerror\fP (char *err)" .br .RI "Post an extended string error message\&. " .ti -1c .RI "void \fBsetError\fP (bool enable)" .br .RI "Used to enable or disable throwing of exceptions on errors\&. " .ti -1c .RI "\fBError\fP \fBsetCompletion\fP (\fBComplete\fP mode)" .br .RI "Used to set file completion modes\&. " .ti -1c .RI "void \fBsetTemporary\fP (bool enable)" .br .RI "Used to set the temporary attribute for the file\&. " .ti -1c .RI "virtual \fBAttr\fP \fBinitialize\fP (void)" .br .RI "This method is used to initialize a newly created file as indicated by the 'initial' flag\&. " .ti -1c .RI "void \fBfinal\fP (void)" .br .RI "Close the file\&. " .in -1c .SS "Protected Attributes" .in +1c .ti -1c .RI "int \fBfd\fP" .br .ti -1c .RI "\fBAccess\fP \fBaccess\fP" .br .ti -1c .RI "char * \fBpathname\fP" .br .ti -1c .RI "struct {" .br .ti -1c .RI " unsigned \fBcount\fP: 16" .br .ti -1c .RI " bool \fBthrown\fP: 1" .br .ti -1c .RI " bool \fBinitial\fP: 1" .br .ti -1c .RI " bool \fBimmediate\fP: 1" .br .ti -1c .RI " bool \fBtemp\fP: 1" .br .ti -1c .RI "} \fBflags\fP" .br .in -1c .SS "Related Functions" (Note that these are not member functions\&.) .in +1c .ti -1c .RI "bool \fB__EXPORT\fP \fBisDir\fP (const char *path)" .br .ti -1c .RI "bool \fB__EXPORT\fP \fBisFile\fP (const char *path)" .br .ti -1c .RI "bool \fB__EXPORT\fP \fBisDevice\fP (const char *path)" .br .ti -1c .RI "bool \fB__EXPORT\fP \fBcanAccess\fP (const char *path)" .br .ti -1c .RI "bool \fB__EXPORT\fP \fBcanModify\fP (const char *path)" .br .ti -1c .RI "time_t \fB__EXPORT\fP \fBlastModified\fP (const char *path)" .br .ti -1c .RI "time_t \fB__EXPORT\fP \fBlastAccessed\fP (const char *path)" .br .in -1c .SS "Additional Inherited Members" .SH "Detailed Description" .PP 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\&. .PP \fBAuthor\fP .RS 4 David Sugar dyfet@ostel.com .RE .PP Portable random disk file access\&. .SH "Constructor & Destructor Documentation" .PP .SS "ost::RandomFile::RandomFile (const char * name = \fCNULL\fP)\fC [protected]\fP" .PP Create an unopened random access file\&. .SS "ost::RandomFile::RandomFile (const \fBRandomFile\fP & rf)\fC [protected]\fP" .PP Default copy constructor\&. .SS "virtual ost::RandomFile::~RandomFile ()\fC [virtual]\fP" .PP Destroy a random access file or it's derived class\&. .SH "Member Function Documentation" .PP .SS "\fBError\fP ost::RandomFile::error (char * err)\fC [inline]\fP, \fC [protected]\fP" .PP Post an extended string error message\&. .PP \fBReturns\fP .RS 4 errExtended\&. .RE .PP \fBParameters\fP .RS 4 \fIerr\fP error string\&. .RE .PP .PP References ost::error()\&. .SS "\fBError\fP ost::RandomFile::error (\fBError\fP errid, char * errstr = \fCNULL\fP)\fC [protected]\fP" .PP Post an error event\&. .PP \fBReturns\fP .RS 4 error code\&. .RE .PP \fBParameters\fP .RS 4 \fIerrid\fP error code\&. .br \fIerrstr\fP error message string\&. .RE .PP .SS "void ost::RandomFile::final (void)\fC [protected]\fP" .PP Close the file\&. .SS "off_t ost::RandomFile::getCapacity (void)" .PP Get current file capacity\&. .PP \fBReturns\fP .RS 4 total file size\&. .RE .PP .SS "\fBError\fP ost::RandomFile::getErrorNumber (void)\fC [inline]\fP" .PP Return current error id\&. .PP \fBReturns\fP .RS 4 last error identifier set\&. .RE .PP .SS "char* ost::RandomFile::getErrorString (void)\fC [inline]\fP" .PP Return current error string\&. .PP \fBReturns\fP .RS 4 last error string set\&. .RE .PP .SS "bool ost::RandomFile::initial (void)" .PP This method should be called right after a \fBRandomFile\fP derived object has been created\&. This method will invoke initialize if the object is newly created, and set file access permissions appropriately\&. .PP \fBReturns\fP .RS 4 true if file had to be initialized\&. .RE .PP .SS "virtual \fBAttr\fP ost::RandomFile::initialize (void)\fC [protected]\fP, \fC [virtual]\fP" .PP 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\&. .PP \fBReturns\fP .RS 4 access, or attrInvalid if should be removed\&. .RE .PP .SS "bool ost::RandomFile::operator! (void)" .SS "virtual \fBError\fP ost::RandomFile::restart (void)\fC [virtual]\fP" .PP 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\&. .PP Reimplemented in \fBost::SharedFile\fP, and \fBost::ThreadFile\fP\&. .SS "\fBError\fP ost::RandomFile::setCompletion (\fBComplete\fP mode)\fC [protected]\fP" .PP Used to set file completion modes\&. .PP \fBReturns\fP .RS 4 errSuccess if okay\&. .RE .PP \fBParameters\fP .RS 4 \fImode\fP completion mode\&. .RE .PP .SS "void ost::RandomFile::setError (bool enable)\fC [inline]\fP, \fC [protected]\fP" .PP Used to enable or disable throwing of exceptions on errors\&. .PP \fBParameters\fP .RS 4 \fIenable\fP true if errors will be thrown\&. .RE .PP .SS "void ost::RandomFile::setTemporary (bool enable)\fC [inline]\fP, \fC [protected]\fP" .PP Used to set the temporary attribute for the file\&. Temporary files are automatically deleted when closed\&. .PP \fBParameters\fP .RS 4 \fIenable\fP true for marking as temporary\&. .RE .PP .SH "Friends And Related Function Documentation" .PP .SS "bool \fB__EXPORT\fP canAccess (const char * path)\fC [related]\fP" .SS "bool \fB__EXPORT\fP canModify (const char * path)\fC [related]\fP" .SS "bool \fB__EXPORT\fP isDevice (const char * path)\fC [related]\fP" .SS "bool \fB__EXPORT\fP isDir (const char * path)\fC [related]\fP" .SS "bool \fB__EXPORT\fP isFile (const char * path)\fC [related]\fP" .SS "time_t \fB__EXPORT\fP lastAccessed (const char * path)\fC [related]\fP" .SS "time_t \fB__EXPORT\fP lastModified (const char * path)\fC [related]\fP" .SH "Member Data Documentation" .PP .SS "\fBAccess\fP ost::RandomFile::access\fC [protected]\fP" .SS "unsigned ost::RandomFile::count" .SS "int ost::RandomFile::fd\fC [protected]\fP" .SS "struct { \&.\&.\&. } ost::RandomFile::flags\fC [protected]\fP" .SS "bool ost::RandomFile::immediate" .SS "bool ost::RandomFile::initial" .SS "char* ost::RandomFile::pathname\fC [protected]\fP" .SS "bool ost::RandomFile::temp" .SS "bool ost::RandomFile::thrown" .SH "Author" .PP Generated automatically by Doxygen for GNU CommonC++ from the source code\&.