LLFIO v2.00
Loading...
Searching...
No Matches
llfio_v2_xxx::lockable_byte_io_handle::extent_guard Class Reference

EXTENSION: RAII holder a locked extent of bytes in a file. More...

#include "lockable_byte_io_handle.hpp"

Public Member Functions

 extent_guard (const extent_guard &)=delete
 
extent_guardoperator= (const extent_guard &)=delete
 
constexpr extent_guard ()
 Default constructor.
 
 extent_guard (extent_guard &&o) noexcept
 Move constructor.
 
extent_guardoperator= (extent_guard &&o) noexcept
 Move assign.
 
 operator bool () const noexcept
 True if extent guard is valid.
 
lockable_byte_io_handlehandle () const noexcept
 The lockable_byte_io_handle to be unlocked.
 
void set_handle (lockable_byte_io_handle *h) noexcept
 Sets the lockable_byte_io_handle to be unlocked.
 
std::tuple< extent_type, extent_type, lock_kindextent () const noexcept
 The extent to be unlocked.
 
void unlock () noexcept
 Unlocks the locked extent immediately.
 
void release () noexcept
 Detach this RAII unlocker from the locked state.
 

Protected Member Functions

constexpr extent_guard (lockable_byte_io_handle *h, extent_type offset, extent_type length, lock_kind kind)
 

Friends

class lockable_byte_io_handle
 

Detailed Description

EXTENSION: RAII holder a locked extent of bytes in a file.

Constructor & Destructor Documentation

◆ extent_guard() [1/3]

constexpr llfio_v2_xxx::lockable_byte_io_handle::extent_guard::extent_guard ( lockable_byte_io_handle h,
extent_type  offset,
extent_type  length,
lock_kind  kind 
)
inlineconstexprprotected
157 : _h(h)
158 , _offset(offset)
159 , _length(length)
160 , _kind(kind)
161 {
162 }
result< section_handle::extent_type > length(const section_handle &self) noexcept
Return the current maximum permitted extent of the memory section.
Definition map_handle.hpp:1071

◆ extent_guard() [2/3]

constexpr llfio_v2_xxx::lockable_byte_io_handle::extent_guard::extent_guard ( )
inlineconstexpr

Default constructor.

169{} // NOLINT

◆ extent_guard() [3/3]

llfio_v2_xxx::lockable_byte_io_handle::extent_guard::extent_guard ( extent_guard &&  o)
inlinenoexcept

Move constructor.

172 : _h(o._h)
173 , _offset(o._offset)
174 , _length(o._length)
175 , _kind(o._kind)
176 {
177 o.release();
178 }

◆ ~extent_guard()

llfio_v2_xxx::lockable_byte_io_handle::extent_guard::~extent_guard ( )
inline
195 {
196 if(_h != nullptr)
197 {
198 unlock();
199 }
200 }
void unlock() noexcept
Unlocks the locked extent immediately.
Definition lockable_byte_io_handle.hpp:212

Member Function Documentation

◆ extent()

std::tuple< extent_type, extent_type, lock_kind > llfio_v2_xxx::lockable_byte_io_handle::extent_guard::extent ( ) const
inlinenoexcept

The extent to be unlocked.

209{ return std::make_tuple(_offset, _length, _kind); }

◆ handle()

lockable_byte_io_handle * llfio_v2_xxx::lockable_byte_io_handle::extent_guard::handle ( ) const
inlinenoexcept

The lockable_byte_io_handle to be unlocked.

205{ return _h; }

◆ operator bool()

llfio_v2_xxx::lockable_byte_io_handle::extent_guard::operator bool ( ) const
inlineexplicitnoexcept

True if extent guard is valid.

202{ return _h != nullptr; }

◆ operator=()

extent_guard & llfio_v2_xxx::lockable_byte_io_handle::extent_guard::operator= ( extent_guard &&  o)
inlinenoexcept

Move assign.

181 {
182 if(this == &o)
183 {
184 return *this;
185 }
186 unlock();
187 _h = o._h;
188 _offset = o._offset;
189 _length = o._length;
190 _kind = o._kind;
191 o.release();
192 return *this;
193 }

◆ release()

void llfio_v2_xxx::lockable_byte_io_handle::extent_guard::release ( )
inlinenoexcept

Detach this RAII unlocker from the locked state.

223 {
224 _h = nullptr;
225 _offset = 0;
226 _length = 0;
227 _kind = lock_kind::unlocked;
228 }
@ unlocked
Exclude none.

◆ set_handle()

void llfio_v2_xxx::lockable_byte_io_handle::extent_guard::set_handle ( lockable_byte_io_handle h)
inlinenoexcept

Sets the lockable_byte_io_handle to be unlocked.

207{ _h = h; }

◆ unlock()

void llfio_v2_xxx::lockable_byte_io_handle::extent_guard::unlock ( )
inlinenoexcept

Unlocks the locked extent immediately.

213 {
214 if(_h != nullptr)
215 {
216 _h->unlock_file_range(_offset, _length);
217 release();
218 }
219 }
void release() noexcept
Detach this RAII unlocker from the locked state.
Definition lockable_byte_io_handle.hpp:222
virtual void unlock_file_range(extent_type offset, extent_type bytes) noexcept
EXTENSION: Unlocks a byte range previously locked.

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