Public Types | Public Member Functions

Celartem::DiskStorageLock Class Reference

#include <cel_storage.h>

List of all members.

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:
inStorage A DiskStorage instance to lock a region of.
inPos The offset of the region to lock.
inSize The size of the region to lock.
inMode The lock mode.
Celartem::DiskStorageLock::DiskStorageLock ( DiskStorage inStorage,
const LockStorageRegion inRegion,
LockMode  inMode = Shared 
) [inline]

Locks a region of a DiskStorage instance.

Parameters:
inStorage A DiskStorage instance to lock a region of.
inPos The offset of the region to lock.
inSize The size of the region to lock.
inMode The 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:
inStorage A DiskStorage instance to lock a region of.
inRegion The region to lock. If the length is 0, this method locks all the subsequent bytes starts from offset.
inMode The 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:
inStorage A DiskStorage instance to lock a region of.
inPos The offset of the region to lock.
inSize The size of the region to lock. If this is 0, this method locks all the subsequent bytes starts from inPos.
inMode The 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:

This document is made with doxygen 1.7.1 at Sun Sep 5 2010 13:03:38.
Caminova Logo