openDAQ
Open data acquisition platform
UserLockPtr Class Reference

This class manages the lock state of an object, usually a device. A device can be locked either with a specific user or without one. If the device is locked with a specific user, only that user can unlock it. If the device is locked without a user, any user can unlock it. More...

Inherits ObjectPtr< IUserLock >.

Detailed Description

This class manages the lock state of an object, usually a device. A device can be locked either with a specific user or without one. If the device is locked with a specific user, only that user can unlock it. If the device is locked without a user, any user can unlock it.

Public Member Functions

void lock (const daq::UserPtr &user=nullptr) const
 Lock the object. Only the user who locked the object can unlock it. If the object was locked without a specific user, or with an anonymous user, any user can unlock it. More...
 
void unlock (const daq::UserPtr &user=nullptr) const
 Unlock the object. Only the user who locked the object can unlock it. If the object was locked without a specific user, or with an anonymous user, any user can unlock it. More...
 
void forceUnlock () const
 Forcefully unlock the object. A force unlock will always succeed, regardless of which user initially locked the object.
 
daq::Bool isLocked () const
 Returns true if the object is locked. More...
 

Member Function Documentation

◆ isLocked()

daq::Bool isLocked ( ) const
inline

Returns true if the object is locked.

Parameters
isLockedOut[out]True if the object is locked.

◆ lock()

void lock ( const daq::UserPtr &  user = nullptr) const
inline

Lock the object. Only the user who locked the object can unlock it. If the object was locked without a specific user, or with an anonymous user, any user can unlock it.

Parameters
userUser performing the lock action.

◆ unlock()

void unlock ( const daq::UserPtr &  user = nullptr) const
inline

Unlock the object. Only the user who locked the object can unlock it. If the object was locked without a specific user, or with an anonymous user, any user can unlock it.

Parameters
userUser performing the unlock action.