Bayonne2 / Common C++ 2 Framework
|
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>
Public Member Functions | |
virtual | ~RandomFile () |
Destroy a random access file or it's derived class. More... | |
bool | initial (void) |
This method should be called right after a RandomFile derived object has been created. More... | |
off_t | getCapacity (void) |
Get current file capacity. More... | |
virtual Error | restart (void) |
This method is commonly used to close and re-open an existing database. More... | |
Error | getErrorNumber (void) |
Return current error id. More... | |
char * | getErrorString (void) |
Return current error string. More... | |
bool | operator! (void) |
Static Public Member Functions | |
static const char * | getExtension (const char *path) |
static const char * | getFilename (const char *path) |
static char * | getFilename (const char *path, char *buffer, size_t size=64) |
static char * | getDirname (const char *path, char *buffer, size_t size=256) |
static char * | getRealpath (const char *path, char *buffer, size_t size=256) |
Protected Types | |
typedef struct File::_fcb | fcb_t |
Protected Member Functions | |
RandomFile (const char *name=NULL) | |
Create an unopened random access file. More... | |
RandomFile (const RandomFile &rf) | |
Default copy constructor. More... | |
Error | error (Error errid, char *errstr=NULL) |
Post an error event. More... | |
Error | error (char *err) |
Post an extended string error message. More... | |
void | setError (bool enable) |
Used to enable or disable throwing of exceptions on errors. More... | |
Error | setCompletion (Complete mode) |
Used to set file completion modes. More... | |
void | setTemporary (bool enable) |
Used to set the temporary attribute for the file. More... | |
virtual Attr | initialize (void) |
This method is used to initialize a newly created file as indicated by the "initial" flag. More... | |
void | final (void) |
Close the file. More... | |
void | nameMutex (const char *name) |
Enable setting of mutex name for deadlock debug. More... | |
void | enterMutex (void) |
Entering a Mutex locks the mutex for the current thread. More... | |
void | enter (void) |
Future abi will use enter/leave/test members. More... | |
void | leave (void) |
Future abi will use enter/leave/test members. More... | |
bool | test (void) |
Future abi will use enter/leave/test members. More... | |
bool | tryEnterMutex (void) |
Tries to lock the mutex for the current thread. More... | |
void | leaveMutex (void) |
Leaving a mutex frees that mutex for use by another thread. More... | |
Static Protected Member Functions | |
static void | setDebug (bool mode) |
Enable or disable deadlock debugging. More... | |
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 |
Private Attributes | |
Error | errid |
char * | errstr |
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) |
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.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
protectedinherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
protected |
Create an unopened random access file.
|
protected |
Default copy constructor.
|
virtual |
Destroy a random access file or it's derived class.
|
inlineinherited |
|
inherited |
Entering a Mutex locks the mutex for the current thread.
This also can be done using the ENTER_CRITICAL macro or by using the ++ operator on a mutex.
Post an error event.
errid | error code. |
errstr | error message string. |
|
inlineprotected |
|
protected |
Close the file.
off_t RandomFile::getCapacity | ( | void | ) |
Get current file capacity.
|
staticinherited |
|
inline |
|
inline |
|
staticinherited |
|
staticinherited |
|
staticinherited |
|
staticinherited |
bool 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.
|
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.
|
inlineinherited |
|
inherited |
Leaving a mutex frees that mutex for use by another thread.
If the mutex has been entered (invoked) multiple times (recursivily) by the same thread, then it will need to be exited the same number of instances before it is free for re-use. This operation can also be done using the LEAVE_CRITICAL macro or by the – operator on a mutex.
|
inlineinherited |
bool RandomFile::operator! | ( | 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 SharedFile, and ThreadFile.
Used to set file completion modes.
mode | completion mode. |
|
inlinestaticinherited |
|
inlineprotected |
|
inlineprotected |
|
inlineinherited |
|
inherited |
Tries to lock the mutex for the current thread.
Behaves like enterMutex , except that it doesn't block the calling thread if the mutex is already locked by another thread.
|
related |
|
related |
|
related |
|
related |
|
related |
|
related |
|
related |
struct { ... } RandomFile::flags |