MIRA
Public Member Functions | Protected Attributes | List of all members
ScopedAccess< Protectee, void > Class Template Reference

Specialization for Mutex=void, i.e. More...

#include <thread/ScopedAccess.h>

Inheritance diagram for ScopedAccess< Protectee, void >:
Inheritance graph
[legend]

Public Member Functions

 ScopedAccess (Protectee *p, bool lockedAlready=false)
 This is used to create an access object to a protected object, which is passed as pointer. More...
 
 ~ScopedAccess ()
 
 ScopedAccess (ScopedAccess &&other) noexcept
 
ScopedAccessoperator= (ScopedAccess &&other) noexcept
 
Protectee * operator-> ()
 
const Protectee * operator-> () const
 
Protectee & operator* ()
 
const Protectee & operator* () const
 

Protected Attributes

Protectee * mObject
 

Detailed Description

template<typename Protectee>
class mira::ScopedAccess< Protectee, void >

Specialization for Mutex=void, i.e.

there is no separate mutex object.

The Protectee must meet the following concept: concept Protectee { // locks the object from concurrent access (blocks, if there is an access already). void lock();

// unlocks the object void unlock(); } Internally, this behavior usually is implemented using a mutex in the Protectee. For most use cases it would be sufficient to use the ProtecteeMixin class.

Constructor & Destructor Documentation

◆ ScopedAccess() [1/2]

ScopedAccess ( Protectee *  p,
bool  lockedAlready = false 
)
inline

This is used to create an access object to a protected object, which is passed as pointer.

The second parameter specifies if the object is already locked. If not (the default), it is locked immediately. Note that in both cases the object will be unlocked in ScopedAccess's destructor and should NOT be unlocked outside to prevent double unlock!

◆ ~ScopedAccess()

~ScopedAccess ( )
inline

◆ ScopedAccess() [2/2]

ScopedAccess ( ScopedAccess< Protectee, void > &&  other)
inlinenoexcept

Member Function Documentation

◆ operator=()

ScopedAccess& operator= ( ScopedAccess< Protectee, void > &&  other)
inlinenoexcept

◆ operator->() [1/2]

Protectee* operator-> ( )
inlineinherited

◆ operator->() [2/2]

const Protectee* operator-> ( ) const
inlineinherited

◆ operator*() [1/2]

Protectee& operator* ( )
inlineinherited

◆ operator*() [2/2]

const Protectee& operator* ( ) const
inlineinherited

Member Data Documentation

◆ mObject

Protectee* mObject
protectedinherited

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