#include <cel_storage.h>
Public Member Functions | |
virtual void * | getOSHandle ()=0 |
virtual void | lockRegion (uint64_t inPos, uint64_t inSize, bool inWriterLock)=0 |
virtual bool | tryLockRegion (uint64_t inPos, uint64_t inSize, bool inWriterLock)=0 |
virtual void | unlockRegion (uint64_t inPos, uint64_t inSize)=0 |
Public Member Functions inherited from Celartem::Storage | |
virtual uint64_t | getSize () const =0 |
virtual uint64_t | getPos () const =0 |
virtual void | reserve (uint64_t inReservationSize)=0 |
virtual void | setPos (uint64_t inPosition)=0 |
virtual void | setPosRelative (int64_t inPosition)=0 |
virtual void | setPosFromEnd (int64_t inPosition)=0 |
virtual void | setEof ()=0 |
virtual String | getStorageId () const =0 |
virtual AutoPtr< Storage > | duplicate () const =0 |
virtual Time | getLastUpdateTime () const =0 |
Public Member Functions inherited from Celartem::Stream | |
virtual size_t | readBytes (void *buffer, size_t inSize, bool wouldBlock=false)=0 |
virtual void | writeBytes (const void *buffer, size_t inSize)=0 |
virtual void | flushBuffer ()=0 |
virtual bool | isEof () const =0 |
virtual size_t | duplicateStream (Stream *inStream, size_t inBufferSize=1024, DuplicateStreamCallback inCallback=NULL, void *inCallbackContext=NULL) |
virtual size_t | duplicateStreamBytes (Stream *inStream, size_t inMaximumByteSize, size_t inBufferSize=1024, DuplicateStreamCallback inCallback=NULL, void *inCallbackContext=NULL) |
Public Member Functions inherited from Celartem::Referable | |
Referable () | |
void | addRef () const |
void | releaseRef () const |
size_t | getReferenceCount () const |
Public Member Functions inherited from Celartem::Lockable | |
virtual void | lock () const =0 |
virtual void | unlock () const =0 |
Static Public Member Functions | |
static AutoPtr< DiskStorage > | create (const Path &inFileName, AccessMode inAccessMode=accessRead, CreationMode inCreationMode=creationDefault, bool inThrowOnError=true) |
static AutoPtr< DiskStorage > | createAnonTemp () |
static AutoPtr< DiskStorage > | createTemp (String &ioFileName) |
static AutoPtr< DiskStorage > | createFromHandle (void *inFileHandle, AccessMode inAccessMode=accessRead, CreationMode inCreationMode=creationDefault, bool inCloseOnDelete=true) |
Static Public Member Functions inherited from Celartem::Storage | |
static AutoPtr< Storage > | create (const String &inUriOrFileName, bool inLateBinding=false, ResourceBroker *inBroker=NULL) |
static AutoPtr< Storage > | createTempNoLock () |
Static Public Member Functions inherited from Celartem::Referable | |
static void | dumpDbgAllRefCount () |
This class manages the files on the local storage.
|
static |
This method opens a disk file. For AccessMode and CreationMode configuration, see AccessMode and CreationMode.
inFileName | A file to open. |
inAccessMode | One of the AccessMode enumerations. |
inCreationMode | One of the CreationMode enumerations. |
inThrowOnError | Whether the function throws an exception on error or not. If it is false , the function returns NULL on errors. |
NULL
if you set inThrowOnError to false
and the function fails.
|
static |
This method opens an anonymous temporary file with Read/Write access. It also supports auto deletion of the file on the close of file; you don't have to call deleteFile
call.
|
static |
This method creates a DiskStorage instance based on the specified file handle.
For AccessMode and CreationMode configuration, see AccessMode and CreationMode.
inFileHandle | On Windows, the handle is actually a HANDLE value, so you should cast the actual handle value to void* to pass to this method.On UNIX variations, the handle is a file descriptor, which is usually described by an integer value. So you should cast the file descriptor to void* to pass to this method. |
inAccessMode | One of the AccessMode enumerations. This parameter actually does nothing with the actual operation on the file handle but for advisary. |
inCreationMode | One of the CreationMode enumerations. This parameter actually does nothing with the actual operation on the file handle but for advisary. |
inCloseOnDelete | If this is true , the handle is automatically closed on destruction of the DiskStorage instance; otherwise, you should close the handle manually. |
|
static |
This method opens a temporary file, which name is based on the input filename, with Read/Write access.
|
pure virtual |
This method returns the OS File handle used internally in this instance.
Note that direct access to the handle may conflict with the operation on the DiskStorage instance and you had better use DiskStorage methods rather than the handle.
On Windows, you should firstly cast this value to HANDLE.
On UNIX OSs, you should firstly cast this value to int.
|
pure virtual |
This method locks a region in an opened file.
This method blocks until it acquires the lock to the region.
You had better use DiskStorageLock method rather than directly use this method to ensure the call to unlockRegion method.
inPos | The start position of the region to lock. |
inSize | The length of the region to lock. |
inWriterLock | true if want an exclusive (writer) lock; false to shared (reader) lock. |
|
pure virtual |
This method locks a region in an opened file.
This method fails unless it can acquire the lock to the region.
inPos | The start position of the region to lock. |
inSize | The length of the region to lock. |
inWriterLock | true if want an exclusive (writer) lock; false to shared (reader) lock. |
|
pure virtual |
This method unlocks a region in an opened file.
inPos | The start position of the region to unlock. |
inSize | The length of the region to unlock. The region to unlock must correspond exactly to the locked region. |