Block File Access. More...
#include <rblockfileaccess.h>
Public Member Functions | |
RBlockFileAccess (RBlockFile *file) | |
RBlockFileAccess (RBlockFile *file, size_t blockid, size_t pos=0) | |
RBlockFileAccess (RBlockFile &file) | |
RBlockFileAccess (RBlockFile &file, size_t blockid, size_t pos=0) | |
void | ReadLock (void) |
void | ReadUnLock (void) |
void | WriteLock (void) |
void | WriteUnLock (void) |
~RBlockFileAccess (void) | |
Private Attributes | |
RBlockFile * | File |
size_t | BlockId |
RBlockFileData * | Block |
size_t | CurrentPos |
char * | CurrentData |
bool | Lock |
Detailed Description
Block File Access.
The RBlockFileAccess class provides an access to a given block file to read and write data in a particular bloc.
When it is necessary to ensure the coherence of a serie of reads or writes (for example to store data stored in multiple variables), we must first lock the access in read or write mode. Don't forget to unlock at the end of the reads and writes!
- Warning
- While the RBlockFileAccess allows a multithread access to a block file, it is itself not reentrant.
- See also
- RBlockFile
Constructor & Destructor Documentation
RBlockFileAccess | ( | RBlockFile * | file | ) |
Constructor of an access.
- Parameters
-
file File to access to.
RBlockFileAccess | ( | RBlockFile * | file, |
size_t | blockid, | ||
size_t | pos = 0 |
||
) |
Constructor of an access for a given block and at a given position.
- Parameters
-
file File to access to. blockid Identifier of the block to access. pos Position in the block.
RBlockFileAccess | ( | RBlockFile & | file | ) |
Constructor of an access.
- Parameters
-
file File to access to.
RBlockFileAccess | ( | RBlockFile & | file, |
size_t | blockid, | ||
size_t | pos = 0 |
||
) |
Constructor of an access for a given block and at a given position.
- Parameters
-
file File to access to. blockid Identifier of the block to access. pos Position in the block.
~RBlockFileAccess | ( | void | ) |
Destructor.
Member Function Documentation
void ReadLock | ( | void | ) |
Read locking.
void ReadUnLock | ( | void | ) |
Read unlocking.
void WriteLock | ( | void | ) |
Write locking.
void WriteUnLock | ( | void | ) |
Write unlocking.
Field Documentation
|
private |
Block file to access to.
|
private |
Block identifier.
|
private |
Pointer to the data block. Can be null if the block is not in memory anymore.
|
private |
Current position in the data block.
|
private |
Pointer to the current data block.
|
private |
Is the access currently in lock mode ?