Base Framework
Public Member Functions | List of all members
LockableRegion Class Reference

A lockable file region. More...

#include <base/io/LockableRegion.h>

Inherits Object.

Public Member Functions

 LockableRegion (const File &file, const FileRegion &region, bool exclusive)
 
const FileRegiongetRegion () const noexcept
 
void lock (const FileRegion &region, bool exclusive=true)
 
 ~LockableRegion ()
 

Detailed Description

A lockable file region.

A lockable file region.

Version
1.0

Constructor & Destructor Documentation

◆ LockableRegion()

LockableRegion::LockableRegion ( const File file,
const FileRegion region,
bool  exclusive 
)

Initializes the file region lock.

Parameters
fileThe file.
regionThe file region to be locked.
exclusiveSpecifies that the region should be locked exclusively (if false the region is locked shared). This argument is true by default.

◆ ~LockableRegion()

LockableRegion::~LockableRegion ( )

Destroys the file region lock (unlocks the region).

Member Function Documentation

◆ getRegion()

const FileRegion& LockableRegion::getRegion ( ) const
inlinenoexcept

Returns the locked file region.

◆ lock()

void LockableRegion::lock ( const FileRegion region,
bool  exclusive = true 
)

Lock the specified file region (the old region is unlocked first).

Parameters
regionThe new file region to be locked.
exclusiveSpecifies that the region should be locked exclusively (if false the region is locked shared). This argument is true by default.