Public Types | Public Member Functions | List of all members
Celartem::DiskStorageLock Class Reference

#include <cel_storage.h>

Public Types

enum  LockMode { Shared = 0, Exclusive = 1 }
 

Public Member Functions

 DiskStorageLock (DiskStorage *inStorage, uint64_t inPos, uint64_t inSize, LockMode inMode=Shared)
 
 DiskStorageLock (DiskStorage *inStorage, const LockStorageRegion &inRegion, LockMode inMode=Shared)
 
 DiskStorageLock ()
 
 ~DiskStorageLock ()
 
void lock (DiskStorage *inStorage, const LockStorageRegion &inRegion, LockMode inMode=Shared)
 
void lock (DiskStorage *inStorage, uint64_t inPos, uint64_t inSize, LockMode inMode=Shared)
 
void unlock ()
 

Detailed Description

This class is used to lock a region of a DiskStorage.

Member Enumeration Documentation

Lock mode.

Enumerator
Shared 

Shared lock, which is also called "reader" lock.

Exclusive 

Exclusive lock, which is also called "writer" lock.

Constructor & Destructor Documentation

Celartem::DiskStorageLock::DiskStorageLock ( DiskStorage inStorage,
uint64_t  inPos,
uint64_t  inSize,
LockMode  inMode = Shared 
)
inline

Locks a region of a DiskStorage instance.

Parameters
inStorageA DiskStorage instance to lock a region of.
inPosThe offset of the region to lock.
inSizeThe size of the region to lock.
inModeThe lock mode.
Celartem::DiskStorageLock::DiskStorageLock ( DiskStorage inStorage,
const LockStorageRegion inRegion,
LockMode  inMode = Shared 
)
inline

Locks a region of a DiskStorage instance.

Parameters
inStorageA DiskStorage instance to lock a region of.
inPosThe offset of the region to lock.
inSizeThe size of the region to lock.
inModeThe lock mode.
Celartem::DiskStorageLock::DiskStorageLock ( )
inline

Initializes the instance without locking a storage region.

Celartem::DiskStorageLock::~DiskStorageLock ( )
inline

Deinitializes the instance. If a region of a storage is locked, the lock is released.

Member Function Documentation

void Celartem::DiskStorageLock::lock ( DiskStorage inStorage,
const LockStorageRegion inRegion,
LockMode  inMode = Shared 
)
inline

Locks a region of a DiskStorage instance.

Parameters
inStorageA DiskStorage instance to lock a region of.
inRegionThe region to lock. If the length is 0, this method locks all the subsequent bytes starts from offset.
inModeThe lock mode.

Referenced by DiskStorageLock().

void Celartem::DiskStorageLock::lock ( DiskStorage inStorage,
uint64_t  inPos,
uint64_t  inSize,
LockMode  inMode = Shared 
)
inline

Locks a region of a DiskStorage instance.

Parameters
inStorageA DiskStorage instance to lock a region of.
inPosThe offset of the region to lock.
inSizeThe size of the region to lock. If this is 0, this method locks all the subsequent bytes starts from inPos.
inModeThe lock mode.
void Celartem::DiskStorageLock::unlock ( )
inline

Releases the locked region. If no region is locked, do nothing.

Referenced by lock(), and ~DiskStorageLock().


The documentation for this class was generated from the following file:

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:06.
Cuminas Logo