ALib C++ Library
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::lang::OwnerSharedTimed< TOwnable, TOptional > Class Template Reference

Description:

template<typename TOwnable, bool TOptional = false>
class alib::lang::OwnerSharedTimed< TOwnable, TOptional >

Similar to class Owner, but calls method TryAcquireSharedTimed instead of Acquire and ReleaseShared instead of Shared. The result is retrievable with the method IsOwning().

See also
Chapter 3.3.1 Class Owner And Its Siblings of the Programmer's Manual of module ALib Threads
Template Parameters
TOwnableThe type to own. Requirements are to have methods TryAcquireSharedTimed and ReleaseShared available.
TOptionalIf true, then checks is performed, whether the given owned is nulled and thus not acquired and released. If false such checks are omitted.

Definition at line 582 of file owner.inl.

Collaboration diagram for alib::lang::OwnerSharedTimed< TOwnable, TOptional >:
[legend]

Public Type Index:

using OwnablePointer = std::remove_reference_t<TOwnable>*
 The pointer type of the owned object.
 

Public Method Index:

template<typename TTimeValue>
requires TOptional
 OwnerSharedTimed (OwnablePointer ownable, const TTimeValue &time, const CallerInfo &ci)
 
template<typename TTimeValue>
 OwnerSharedTimed (TOwnable &ownable, const TTimeValue &time, const CallerInfo &ci)
 
 ~OwnerSharedTimed ()
 Destructor. Invokes Release() on member owned.
 
bool IsOwning () const noexcept
 
template<typename TTimeValue>
requires TOptional
bool Set (OwnablePointer ownable, const TTimeValue &time)
 

Protected Field Index:

CallerInfo dbgCI
 Caller information. Available only with debug-builds.
 
bool isOwning
 The result of the call to TryAcquire.
 
OwnablePointer owned
 The resource to acquire and release.
 

Type Definition Details:

◆ OwnablePointer

template<typename TOwnable, bool TOptional = false>
using alib::lang::OwnerSharedTimed< TOwnable, TOptional >::OwnablePointer = std::remove_reference_t<TOwnable>*

The pointer type of the owned object.

Definition at line 588 of file owner.inl.

Field Details:

◆ dbgCI

template<typename TOwnable, bool TOptional = false>
CallerInfo alib::lang::OwnerSharedTimed< TOwnable, TOptional >::dbgCI
protected

Caller information. Available only with debug-builds.

Definition at line 594 of file owner.inl.

◆ isOwning

template<typename TOwnable, bool TOptional = false>
bool alib::lang::OwnerSharedTimed< TOwnable, TOptional >::isOwning
protected

The result of the call to TryAcquire.

Definition at line 592 of file owner.inl.

◆ owned

template<typename TOwnable, bool TOptional = false>
OwnablePointer alib::lang::OwnerSharedTimed< TOwnable, TOptional >::owned
protected

The resource to acquire and release.

Definition at line 591 of file owner.inl.

Constructor(s) / Destructor Details:

◆ OwnerSharedTimed() [1/2]

template<typename TOwnable, bool TOptional = false>
template<typename TTimeValue>
alib::lang::OwnerSharedTimed< TOwnable, TOptional >::OwnerSharedTimed ( TOwnable & ownable,
const TTimeValue & time,
const CallerInfo & ci )
inline

Constructor. Invokes TryAcquire() on member owned.

Template Parameters
TTimeValueType of time parameter accepted with construction and passed to method TOwnable::TryAcquireTimed.
Usually this is type Ticks or Ticks::Duration.
Parameters
timeThe duration to wait for, or point in time to wait until.
ownableThe ownable to acquire.
ciCaller information.

Definition at line 621 of file owner.inl.

◆ OwnerSharedTimed() [2/2]

template<typename TOwnable, bool TOptional = false>
template<typename TTimeValue>
requires TOptional
alib::lang::OwnerSharedTimed< TOwnable, TOptional >::OwnerSharedTimed ( OwnablePointer ownable,
const TTimeValue & time,
const CallerInfo & ci )
inline

Constructor taking a pointer to the ownable. This constructor is only available if the template parameter TOptional is true.

Template Parameters
TTimeValueType of time parameter accepted with construction and passed to method TOwnable::TryAcquireTimed.
Usually this is type Ticks or Ticks::Duration.
Parameters
timeThe duration to wait for, or point in time to wait until.
ownableThe ownable to acquire.
ciCaller information.

Definition at line 636 of file owner.inl.

◆ ~OwnerSharedTimed()

template<typename TOwnable, bool TOptional = false>
alib::lang::OwnerSharedTimed< TOwnable, TOptional >::~OwnerSharedTimed ( )
inline

Destructor. Invokes Release() on member owned.

Definition at line 652 of file owner.inl.

Method Details:

◆ IsOwning()

template<typename TOwnable, bool TOptional = false>
bool alib::lang::OwnerSharedTimed< TOwnable, TOptional >::IsOwning ( ) const
inlinenoexcept
Returns
true if the try to acquire the owned with construction of this type was successful. Furthermore, true is returned in the case that the template parameter TOptional is true and no ownable was given with construction. Otherwise, false is returned.

Definition at line 658 of file owner.inl.

◆ Set()

template<typename TOwnable, bool TOptional = false>
template<typename TTimeValue>
requires TOptional
bool alib::lang::OwnerSharedTimed< TOwnable, TOptional >::Set ( OwnablePointer ownable,
const TTimeValue & time )
inline

Sets the ownable after construction. This method is only available if the template parameter TOptional is true. It must not be called if an object was given with construction already, and it must not be called twice. If done, an assertion is raised.

Parameters
ownableThe ownable to acquire.
timeThe duration to wait for, or point in time to wait until.
Template Parameters
TTimeValueType of time parameter accepted with construction and passed to method TOwnable::TryAcquireTimed.
Usually this is type Ticks or Ticks::Duration.
Returns
true if the try to acquire the owner was successful, false if not.

Definition at line 671 of file owner.inl.


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