RandomFile   (3) manpage
RandomFile
3
19 Jul 2003
CommonC++
\"
-*-
nroff
-*-
  • NAME
      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. Portable random disk file access.
  • SYNOPSIS



      #include <file.h>

      Inherits Mutex, and File.

      Inherited by MappedFile, SharedFile, and ThreadFile.

      "Public Methods"
      virtual \fB~RandomFile\fP ()
      \fIDestroy a random access file or it's derived class.\fP bool \fBinitial\fP (void)
      \fIThis method should be called right after a RandomFile derived object has been created.\fP off_t \fBgetCapacity\fP (void)
      \fIGet current file capacity.\fP virtual \fBError\fP \fBrestart\fP (void)
      \fIThis method is commonly used to close and re-open an existing database.\fP \fBError\fP \fBgetErrorNumber\fP (void)
      \fIReturn current error id.\fP char * \fBgetErrorString\fP (void)
      \fIReturn current error string.\fP bool \fBoperator!\fP (void)
      "Protected Methods"
      \fBRandomFile\fP ()
      \fICreate an unopened random access file.\fP \fBRandomFile\fP (const RandomFile &rf)
      \fIDefault copy constructor.\fP \fBError\fP \fBerror\fP (\fBError\fP errid, char *errstr=NULL)
      \fIPost an error event.\fP \fBError\fP \fBerror\fP (char *errstr)
      \fIPost an extended string error message.\fP void \fBsetError\fP (bool enable)
      \fIUsed to enable or disable throwing of exceptions on errors.\fP \fBError\fP \fBsetCompletion\fP (\fBComplete\fP mode)
      \fIUsed to set file completion modes.\fP void \fBsetTemporary\fP (bool enable)
      \fIUsed to set the temporary attribute for the file.\fP virtual \fBAttr\fP \fBinitialize\fP (void)
      \fIThis method is used to initialize a newly created file as indicated by the 'initial' flag.\fP void \fBfinal\fP (void)
      \fIClose the file.\fP "Protected Attributes"
      int \fBfd\fP
      \fBAccess\fP \fBaccess\fP
      char * \fBpathname\fP
      struct {
      unsigned \fBcount\fP: 16
      bool \fBthrown\fP: 1
      bool \fBinitial\fP: 1
      bool \fBimmediate\fP: 1
      bool \fBtemp\fP: 1
      } \fBflags\fP
      ""
      "Related Functions" (Note that these are not member functions.) bool \fBisDir\fP (const char *path)
      bool \fBisFile\fP (const char *path)
      bool \fBisDevice\fP (const char *path)
      bool \fBcanAccess\fP (const char *path)
      bool \fBcanModify\fP (const char *path)
  • 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. Portable random disk file access.

      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>

  • CONSTRUCTOR & DESTRUCTOR DOCUMENTATION


      "RandomFile::RandomFile () [protected]"

      Create an unopened random access file.

      "RandomFile::RandomFile (const RandomFile & rf) [protected]"

      Default copy constructor.

      "virtual RandomFile::~RandomFile () [inline, virtual]"

      Destroy a random access file or it's derived class.

  • MEMBER FUNCTION DOCUMENTATION


      "Error RandomFile::error (char * errstr) [inline, protected]"

      Post an extended string error message.

      Returns: errExtended.

      Parameters:
      errstr
      error string. "Error RandomFile::error (Error errid, char * errstr = NULL) [protected]"

      Post an error event.

      Returns: error code.

      Parameters:
      errid
      error code.
      errstr
      error message string. "void RandomFile::final (void) [protected]"

      Close the file.

      "off_t RandomFile::getCapacity (void)"

      Get current file capacity.

      Returns: total file size. "Error RandomFile::getErrorNumber (void) [inline]"

      Return current error id.

      Returns: last error identifier set. "char* RandomFile::getErrorString (void) [inline]"

      Return current error string.

      Returns: last error string set. "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) [inline, 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. "bool RandomFile::operator! (void)"

      "virtual Error RandomFile::restart (void) [inline, 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 ThreadFile, and SharedFile. "Error RandomFile::setCompletion (Complete mode) [protected]"

      Used to set file completion modes.

      Returns: errSuccess if okay.

      Parameters:
      mode
      completion mode.

      Todo: implement in win32   "void RandomFile::setError (bool enable) [inline, protected]"

      Used to enable or disable throwing of exceptions on errors.

      Parameters:
      enable
      true if errors will be thrown. "void RandomFile::setTemporary (bool enable) [inline, protected]"

      Used to set the temporary attribute for the file.

      Temporary files are automatically deleted when closed.

      Parameters:
      enable
      true for marking as temporary.
  • FRIENDS AND RELATED FUNCTION DOCUMENTATION


      "bool canAccess (const char * path) [related]"

      "bool canModify (const char * path) [related]"

      "bool isDevice (const char * path) [related]"

      "bool isDir (const char * path) [related]"

      "bool isFile (const char * path) [related]"

  • MEMBER DATA DOCUMENTATION


      "Access RandomFile::access [protected]"

      "unsigned RandomFile::count [protected]"

      "int RandomFile::fd [protected]"

      "struct { ... }   RandomFile::flags [protected]"

      "bool RandomFile::immediate [protected]"

      "bool RandomFile::initial [protected]"

      "char* RandomFile::pathname [protected]"

      "bool RandomFile::temp [protected]"

      "bool RandomFile::thrown [protected]"



  • AUTHOR


      Generated automatically by Doxygen for CommonC++ from the source code.
Current Users: 18 © 1999-2006 Linux.com.hk PenguinSoft
All trademarks and copyrights on this page are owned by their respective companies. Linux is a trademark of Linus Torvalds.