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>
Inheritance diagram for RandomFile:
Collaboration diagram for RandomFile:
Public Types
enum
Error {
errSuccess = 0,
errNotOpened,
errMapFailed,
errInitFailed,
errOpenDenied,
errOpenFailed,
errOpenInUse,
errReadInterrupted,
errReadIncomplete,
errReadFailure,
errWriteInterrupted,
errWriteIncomplete,
errWriteFailure,
errLockFailure,
errExtended
}
Public Member Functions
Destroy a random access file or it's derived class.
More...
This method should be called right after a
RandomFile derived object has been created.
More...
This method is commonly used to close and re-open an existing database.
More...
Return current error string.
More...
Static Public Member Functions
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
Protected Member Functions
Create an unopened random access file.
More...
Post an extended string error message.
More...
Used to enable or disable throwing of exceptions on errors.
More...
Used to set file completion modes.
More...
Used to set the temporary attribute for the file.
More...
This method is used to initialize a newly created file as indicated by the "initial" flag.
More...
Enable setting of mutex name for deadlock debug.
More...
Entering a
Mutex locks the mutex for the current thread.
More...
Future abi will use enter/leave/test members.
More...
Future abi will use enter/leave/test members.
More...
Future abi will use enter/leave/test members.
More...
Tries to lock the mutex for the current thread.
More...
Leaving a mutex frees that mutex for use by another thread.
More...
Static Protected Member Functions
Enable or disable deadlock debugging.
More...
Protected Attributes
struct {
Private Attributes
Related Functions
(Note that these are not member functions.)
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.nosp@m.@ost.nosp@m.el.co.nosp@m.m Portable random disk file access.
Definition at line 396 of file file.h.
Member Typedef Documentation
Member Enumeration Documentation
Enumerator |
---|
accessReadOnly |
accessWriteOnly |
accessReadWrite |
Definition at line 139 of file file.h.
Enumerator |
---|
attrInvalid |
attrPrivate |
attrGroup |
attrPublic |
Definition at line 199 of file file.h.
Enumerator |
---|
completionImmediate |
completionDelayed |
completionDeferred |
Definition at line 233 of file file.h.
Enumerator |
---|
errSuccess |
errNotOpened |
errMapFailed |
errInitFailed |
errOpenDenied |
errOpenFailed |
errOpenInUse |
errReadInterrupted |
errReadIncomplete |
errReadFailure |
errWriteInterrupted |
errWriteIncomplete |
errWriteFailure |
errLockFailure |
errExtended |
Definition at line 120 of file file.h.
Enumerator |
---|
mappedRead |
mappedWrite |
mappedReadWrite |
Definition at line 228 of file file.h.
Enumerator |
---|
openReadOnly |
openWriteOnly |
openReadWrite |
openAppend |
openSync |
openTruncate |
Definition at line 171 of file file.h.
Constructor & Destructor Documentation
RandomFile::RandomFile
(
const char *
name = NULL
)
protected |
Create an unopened random access file.
Default copy constructor.
virtual RandomFile::~RandomFile
(
)
virtual |
Destroy a random access file or it's derived class.
Member Function Documentation
void Mutex::enter
(
void
)
inlineinherited |
Future abi will use enter/leave/test members.
Definition at line 263 of file thread.h.
void Mutex::enterMutex
(
void
)
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.
- See Also
- leaveMutex
char *
errstr = NULL
)
protected |
Post an error event.
- Returns
- error code.
- Parameters
-
errid error code.
errstr error message string.
Error RandomFile::error
(
char *
err )
inlineprotected |
Post an extended string error message.
- Returns
- errExtended.
- Parameters
-
err error string.
Definition at line 447 of file file.h.
void RandomFile::final
(
void
)
protected |
off_t RandomFile::getCapacity
(
void
)
Get current file capacity.
- Returns
- total file size.
static char* File::getDirname
(
const char *
path,
char *
buffer,
size_t
size = 256
)
staticinherited |
Error RandomFile::getErrorNumber
(
void
)
inline |
Return current error id.
- Returns
- last error identifier set.
Definition at line 532 of file file.h.
char* RandomFile::getErrorString
(
void
)
inline |
Return current error string.
- Returns
- last error string set.
Definition at line 540 of file file.h.
static const char* File::getExtension
(
const char *
path )
staticinherited |
static const char* File::getFilename
(
const char *
path )
staticinherited |
static char* File::getFilename
(
const char *
path,
char *
buffer,
size_t
size = 64
)
staticinherited |
static char* File::getRealpath
(
const char *
path,
char *
buffer,
size_t
size = 256
)
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.
- Returns
- true if file had to be initialized.
virtual
Attr 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.
void Mutex::leave
(
void
)
inlineinherited |
Future abi will use enter/leave/test members.
Definition at line 269 of file thread.h.
void Mutex::leaveMutex
(
void
)
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.
- See Also
- enterMutex
void Mutex::nameMutex
(
const char *
name )
inlineinherited |
Enable setting of mutex name for deadlock debug.
- Parameters
-
name for mutex.
Definition at line 248 of file thread.h.
bool RandomFile::operator!
(
void
)
virtual
Error 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 SharedFile, and ThreadFile.
Used to set file completion modes.
- Returns
- errSuccess if okay.
- Parameters
-
mode completion mode.
- Todo:
- implement in win32
static void Mutex::setDebug
(
bool
mode )
inlinestaticinherited |
Enable or disable deadlock debugging.
- Parameters
-
mode debug mode.
Definition at line 240 of file thread.h.
void 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 456 of file file.h.
void 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 476 of file file.h.
bool Mutex::test
(
void
)
inlineinherited |
Future abi will use enter/leave/test members.
- Returns
- true if entered.
Definition at line 277 of file thread.h.
bool Mutex::tryEnterMutex
(
void
)
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.
- Returns
- true if locking the mutex was succesful otherwise false
- See Also
- enterMutex
-
leaveMutex
Friends And Related Function Documentation
bool
__EXPORT canAccess
(
const char *
path )
related |
bool
__EXPORT canModify
(
const char *
path )
related |
bool
__EXPORT isDevice
(
const char *
path )
related |
bool
__EXPORT isDir
(
const char *
path )
related |
bool
__EXPORT isFile
(
const char *
path )
related |
time_t
__EXPORT lastAccessed
(
const char *
path )
related |
time_t
__EXPORT lastModified
(
const char *
path )
related |
Field Documentation
unsigned RandomFile::count
char* RandomFile::errstr
private |
int RandomFile::fd
protected |
struct { ... } RandomFile::flags
bool RandomFile::immediate
char* RandomFile::pathname
protected |
The documentation for this class was generated from the following file:
Generated on Dec 21, 2017 for
commoncpp2-1.8.1,
ccrtp-1.7.2,
libzrtpcpp-2.3.4,
ccscript3-1.1.7,
ccaudio2-1.0.0 and
bayonne2-2.3.2
(after installation in /usr/local/)
by
doxygen 1.8.6