dart
Public Types | Public Member Functions | List of all members
dart::common::SingleLockableReference< LockableT > Class Template Referencefinal

This class references a single lockable. More...

#include <LockableReference.hpp>

Inheritance diagram for dart::common::SingleLockableReference< LockableT >:
Inheritance graph
[legend]
Collaboration diagram for dart::common::SingleLockableReference< LockableT >:
Collaboration graph
[legend]

Public Types

using Lockable = LockableT
 

Public Member Functions

 SingleLockableReference (std::weak_ptr< const void > lockableHolder, Lockable &lockable) noexcept
 Constructor from a single lockable. More...
 
void lock () override
 Locks lockable that this class references; blocks if one of the lockables are not avaliable. More...
 
bool try_lock () noexcept override
 Tries to lock the lockables that this class references; returns false if one of the lockables is not avaliable. More...
 
void unlock () noexcept override
 Unlocks the lockables.
 
- Public Member Functions inherited from dart::common::LockableReference
constexpr LockableReference () noexcept=default
 Default construtor.
 
virtual ~LockableReference ()=default
 Default destructor.
 

Additional Inherited Members

- Protected Member Functions inherited from dart::common::LockableReference
 LockableReference (const LockableReference &)=delete
 Copy construction is not allowed.
 

Detailed Description

template<typename LockableT>
class dart::common::SingleLockableReference< LockableT >

This class references a single lockable.

Template Parameters
LockableTThe standard C++ Lockable concept object type.

Constructor & Destructor Documentation

◆ SingleLockableReference()

template<typename Lockable >
dart::common::SingleLockableReference< Lockable >::SingleLockableReference ( std::weak_ptr< const void >  lockableHolder,
Lockable &  lockable 
)
noexcept

Constructor from a single lockable.

Parameters
[in]lockableHolderWeak pointer to an object that holds the lockable. This is used to check whether the lockable holder is not destructed before lock/unlock.
[in]lockable

Member Function Documentation

◆ lock()

template<typename Lockable >
void dart::common::SingleLockableReference< Lockable >::lock ( )
overridevirtual

Locks lockable that this class references; blocks if one of the lockables are not avaliable.

Implements dart::common::LockableReference.

◆ try_lock()

template<typename Lockable >
bool dart::common::SingleLockableReference< Lockable >::try_lock ( )
overridevirtualnoexcept

Tries to lock the lockables that this class references; returns false if one of the lockables is not avaliable.

Implements dart::common::LockableReference.


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