Public Member Functions | Private Member Functions | Private Attributes | List of all members
xsens::Lock Class Reference

A base class for a Lock. More...

#include <xsens_mutex.h>

Public Member Functions

bool isLocked () const
 
bool lock ()
 Locks the unlocked mutex. More...
 
bool lock (LockState ls)
 Locks the unlocked mutex. More...
 
 Lock (Mutex *mutex)
 Constructs a lock a given mutex. More...
 
 Lock (Mutex *mutex, bool lockit)
 Constructs a lock a given mutex. More...
 
 Lock (Mutex *mutex, LockState lockit)
 Constructs a lock a given mutex. More...
 
bool tryLock ()
 Tries to lock the unlocked mutex. More...
 
bool tryLock (LockState ls)
 Tries to lock the unlocked mutex. More...
 
bool unlock () noexcept
 Unlocks the locked mutex. More...
 
 ~Lock ()
 

Private Member Functions

 CHECK_LOCK_DEFINE ()
 
 Lock (Lock &&rhs)
 
 Lock (Lock const &)=delete
 
Lockoperator= (Lock &&rhs)
 
Lockoperator= (Lock const &)=delete
 

Private Attributes

volatile std::atomic_bool m_locked
 
Mutexm_mutex
 

Detailed Description

A base class for a Lock.

Definition at line 947 of file xsens_mutex.h.

Constructor & Destructor Documentation

◆ Lock() [1/5]

xsens::Lock::Lock ( Lock const &  )
privatedelete

◆ Lock() [2/5]

xsens::Lock::Lock ( Lock &&  rhs)
inlineprivate

Definition at line 956 of file xsens_mutex.h.

◆ Lock() [3/5]

xsens::Lock::Lock ( Mutex mutex)
inline

Constructs a lock a given mutex.

Parameters
mutexThe pointer to a mutex to lock

Definition at line 980 of file xsens_mutex.h.

◆ Lock() [4/5]

xsens::Lock::Lock ( Mutex mutex,
bool  lockit 
)
inline

Constructs a lock a given mutex.

Parameters
mutexThe pointer to a mutex to lock
lockitIf set to true then it will lock a mutex

Definition at line 990 of file xsens_mutex.h.

◆ Lock() [5/5]

xsens::Lock::Lock ( Mutex mutex,
LockState  lockit 
)
inline

Constructs a lock a given mutex.

Parameters
mutexThe pointer to a mutex to lock
lockitIf is not set to an unlocked state then it will lock it

Definition at line 1003 of file xsens_mutex.h.

◆ ~Lock()

xsens::Lock::~Lock ( )
inline

Definition at line 1011 of file xsens_mutex.h.

Member Function Documentation

◆ CHECK_LOCK_DEFINE()

xsens::Lock::CHECK_LOCK_DEFINE ( )
private

◆ isLocked()

bool xsens::Lock::isLocked ( ) const
inline
Returns
True if the mutex is locked

Definition at line 1081 of file xsens_mutex.h.

◆ lock() [1/2]

bool xsens::Lock::lock ( )
inline

Locks the unlocked mutex.

Returns
True if the mutex is successfully locked

Definition at line 1019 of file xsens_mutex.h.

◆ lock() [2/2]

bool xsens::Lock::lock ( LockState  ls)
inline

Locks the unlocked mutex.

Parameters
lsLockState, either LS_Unlocked to unlock or any other value to lock
Returns
True if the mutex is successfully locked

Definition at line 1047 of file xsens_mutex.h.

◆ operator=() [1/2]

Lock& xsens::Lock::operator= ( Lock &&  rhs)
inlineprivate

Definition at line 963 of file xsens_mutex.h.

◆ operator=() [2/2]

Lock& xsens::Lock::operator= ( Lock const &  )
privatedelete

◆ tryLock() [1/2]

bool xsens::Lock::tryLock ( )
inline

Tries to lock the unlocked mutex.

Returns
True if the mutex is successfully locked

Definition at line 1058 of file xsens_mutex.h.

◆ tryLock() [2/2]

bool xsens::Lock::tryLock ( LockState  ls)
inline

Tries to lock the unlocked mutex.

Parameters
lsLockState, either LS_Unlocked to unlock or any other value to lock
Returns
True if the mutex is successfully locked

Definition at line 1072 of file xsens_mutex.h.

◆ unlock()

bool xsens::Lock::unlock ( )
inlinenoexcept

Unlocks the locked mutex.

Returns
True if the mutex is successfully unlocked

Definition at line 1032 of file xsens_mutex.h.

Member Data Documentation

◆ m_locked

volatile std::atomic_bool xsens::Lock::m_locked
private

Definition at line 951 of file xsens_mutex.h.

◆ m_mutex

Mutex* xsens::Lock::m_mutex
private

Definition at line 950 of file xsens_mutex.h.


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


xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:23