ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
TSharedMonoVal< T, TAllocator, TLock > Class Template Reference

Description:

template<typename T, typename TAllocator, typename TLock>
class alib::monomem::TSharedMonoVal< T, TAllocator, TLock >

This templated class is a utility type for TMonoAllocator and supports the following mechanics:

  • It creates a first buffer usable by a MonoAllocator.
  • A custom type defined by template parameter T is placed at the beginning of that buffer.
  • Along with the custom type, the MonoAllocator that receives this first buffer is likewise emplaced in the buffer.
  • Finally, an atomic usage counter is placed as a third member inside that buffer.
  • Only one pointer into this first buffer is stored with this type.
  • This type overloads operator->() and operator*() to access the members of the custom type.
  • The concept of an "automatic pointer", similar to std::shared_ptr is implemented with this type.
  • The default-constructor of this type just sets the internal pointer to nullptr.

All of the above results in the following:

  • The size of an instance of this class is equal to the size of a single C++ pointer. The only member is a pointer to an object of internal type FieldMembers.
  • A single dynamic memory allocation is performed to create an instance of the class, which holds all data and allows further monotonic allocations.
  • Values of this type are nulled, when default constructed.
  • Values of this type can be shared (copied as value), which increases the use counter.
  • Values of this type can be moved, which keeps the use counter as is.
  • Values of this type can be emptied by assigning nullptr or invoking SetNulled.
  • At the moment that the last copy gets out of scope, is deleted or nulled, the contained object is destructed, and all monotonic memory is freed.
  • The allocator can be received with GetAllocator and used by the contained type. A derived type may volunteer to publish the allocator as well to be used by any entity that gets access to a copy of the automatic pointer.
  • Member access is performed with the overloaded operator->(). Alternatively (and sometimes needed) other provided operators and methods like Get may be used.

In contrast to the container types SharedVal and SharedPtr, this type is most commonly used as a base class of types that should to be fully self-contained (like the types listed below).

See also
Template Parameters
TThe custom type that is embedded along with the MonoAllocator.
TAllocatorThe chained allocator that is used by the monotonous allocator that this type creates inside its first buffer.
Usually, type HeapAllocator is to be given here.
TLockThe type of ALib lock to embed besides T. With the provision of void, the integration of a lock is suppressed.
See chapter 7.4 Locking Shared Values of the Programmer's Manual of module ALib Monomem for further details.

Definition at line 86 of file sharedmonoval.hpp.

#include <sharedmonoval.hpp>

Inner Type Index:

struct  FieldMembersNoLock
 
struct  FieldMembersWithLock
 

Public Type Index:

using AllocatorType = TMonoAllocator<TAllocator>
 Exposes the monotonic allocator used. Equals to TMonoAllocator<TAllocator>.
 
using LockType = TLock
 Exposes the lock type specified with template parameter TLock.
 
using StoredType = T
 Exposes the stored type specified with template parameter T.
 

Public Static Method Index:

static constexpr size_t SizeOfAllocation ()
 

Public Method Index:

 TSharedMonoVal () noexcept
 Default Constructor. Leaves this object nulled.
 
 TSharedMonoVal (const TSharedMonoVal &other) noexcept
 
 TSharedMonoVal (size_t initialBufferSizeInKB, unsigned int bufferGrowthInPercent)
 
 TSharedMonoVal (std::nullptr_t) noexcept
 
 TSharedMonoVal (TAllocator &allocator, size_t initialBufferSizeInKB, unsigned int bufferGrowthInPercent)
 
 TSharedMonoVal (TSharedMonoVal &&other) noexcept
 
 ~TSharedMonoVal ()
 
void Acquire (const CallerInfo &ci) const noexcept
 
void AcquireRecursive (const CallerInfo &ci) const noexcept
 
void AcquireShared (const CallerInfo &ci) const noexcept
 
template<typename... TArgs>
void ConstructT (TArgs &&... args)
 
const T * Get () const noexcept
 
T * Get () noexcept
 
AllocatorTypeGetAllocator () noexcept
 
TLock & GetLock () const noexcept
 
bool IsNulled () const noexcept
 
 operator bool () const noexcept
 
bool operator!= (std::nullptr_t) const noexcept
 
const T & operator* () const noexcept
 
T & operator* () noexcept
 
const T * operator-> () const noexcept
 
T * operator-> () noexcept
 
TSharedMonoValoperator= (const TSharedMonoVal &other) noexcept
 
void operator= (std::nullptr_t)
 Assignment of nullptr. Same as SetNulled.
 
TSharedMonoValoperator= (TSharedMonoVal &&other) noexcept
 
bool operator== (std::nullptr_t) const noexcept
 
void Release (const CallerInfo &ci) const noexcept
 
void ReleaseRecursive (const CallerInfo &ci) const noexcept
 
void ReleaseShared (const CallerInfo &ci) const noexcept
 
template<typename... TArgs>
void Reset (TArgs &&... args)
 
const T & Self () const noexcept
 
T & Self () noexcept
 
void SetNulled () noexcept
 
bool TryAcquire (const CallerInfo &ci) const noexcept
 
bool TryAcquireShared (const CallerInfo &ci) const noexcept
 
bool TryAcquireSharedTimed (const Ticks &pointInTime, const CallerInfo &ci) const noexcept
 
bool TryAcquireSharedTimed (const Ticks::Duration &waitDuration, const CallerInfo &ci) const noexcept
 
bool TryAcquireSharedTimed (const Ticks::Duration::TDuration &waitDuration, const CallerInfo &ci) const noexcept
 
bool TryAcquireSharedTimed (const Ticks::TTimePoint &pointInTime, const CallerInfo &ci) const noexcept
 
bool TryAcquireTimed (const Ticks &pointInTime, const CallerInfo &ci) const noexcept
 
bool TryAcquireTimed (const Ticks::Duration &waitDuration, const CallerInfo &ci) const noexcept
 
bool TryAcquireTimed (const Ticks::Duration::TDuration &waitDuration, const CallerInfo &ci) const noexcept
 
bool TryAcquireTimed (const Ticks::TTimePoint &pointInTime, const CallerInfo &ci) const noexcept
 
bool Unique () const noexcept
 
unsigned int UseCount () const noexcept
 

Protected Type Index:

using FieldMembers = ATMP_IF_T_F(ATMP_EQ(void, TLock), FieldMembersNoLock, FieldMembersWithLock)
 

Protected Field Index:

FieldMembersmembers
 

Type Definition Details:

◆ AllocatorType

template<typename T , typename TAllocator , typename TLock >
using AllocatorType = TMonoAllocator<TAllocator>

Exposes the monotonic allocator used. Equals to TMonoAllocator<TAllocator>.

Definition at line 187 of file sharedmonoval.hpp.

◆ FieldMembers

template<typename T , typename TAllocator , typename TLock >
using FieldMembers = ATMP_IF_T_F(ATMP_EQ(void, TLock), FieldMembersNoLock, FieldMembersWithLock)
protected

The type of field members to include. Dependent on the template parameter TLock, either FieldMembersNoLock or FieldMembersWithLock is chosen.

Definition at line 176 of file sharedmonoval.hpp.

◆ LockType

template<typename T , typename TAllocator , typename TLock >
using LockType = TLock

Exposes the lock type specified with template parameter TLock.

Definition at line 193 of file sharedmonoval.hpp.

◆ StoredType

template<typename T , typename TAllocator , typename TLock >
using StoredType = T

Exposes the stored type specified with template parameter T.

Definition at line 190 of file sharedmonoval.hpp.

Field Details:

◆ members

template<typename T , typename TAllocator , typename TLock >
FieldMembers* members
protected

The object that is placed in the allocator's first buffer. Contains T, the allocator itself, and a reference counter.

Definition at line 180 of file sharedmonoval.hpp.

Constructor(s) / Destructor Details:

◆ TSharedMonoVal() [1/6]

template<typename T , typename TAllocator , typename TLock >
TSharedMonoVal ( TAllocator & allocator,
size_t initialBufferSizeInKB,
unsigned int bufferGrowthInPercent )
inline

Constructs an initial buffer of given size and creates the mono allocator within.

Attention
The instance of custom type T will not be constructed with any constructor of this type. Instead, an explicit call to ConstructT has to be made after construction!
Parameters
allocatorThe (chained) allocator used to create the initial buffer and passed to the monotonous allocator that is created.
initialBufferSizeInKBThe initial size of memory buffers used with the monotonic allocator in kB (1024 bytes)
bufferGrowthInPercentOptional growth factor in percent, applied to the buffer size with each next buffer allocation. Should be set to 200, to double the size with each allocation.

Definition at line 210 of file sharedmonoval.hpp.

◆ TSharedMonoVal() [2/6]

template<typename T , typename TAllocator , typename TLock >
TSharedMonoVal ( size_t initialBufferSizeInKB,
unsigned int bufferGrowthInPercent )
inline

Constructor missing the allocator instance. To be used only with allocators that are default constructible (like HeapAllocator is).

Attention
The instance of custom type T will not be constructed with any constructor of this type. Instead, an explicit call to ConstructT has to be made after construction!
Parameters
initialBufferSizeInKBThe initial size of memory buffers used with the monotonic allocator in kB (1024 bytes)
bufferGrowthInPercentOptional growth factor in percent, applied to the buffer size with each next buffer allocation. Should be set to 200, to double the size with each allocation.

Definition at line 238 of file sharedmonoval.hpp.

◆ ~TSharedMonoVal()

template<typename T , typename TAllocator , typename TLock >
~TSharedMonoVal ( )
inline

Destructor. If this is the last copy, the destructors of T and of the MonoAllocator are invoked.

Definition at line 251 of file sharedmonoval.hpp.

Here is the call graph for this function:

◆ TSharedMonoVal() [3/6]

template<typename T , typename TAllocator , typename TLock >
TSharedMonoVal ( )
inlinenoexcept

Default Constructor. Leaves this object nulled.

Definition at line 348 of file sharedmonoval.hpp.

◆ TSharedMonoVal() [4/6]

template<typename T , typename TAllocator , typename TLock >
TSharedMonoVal ( std::nullptr_t )
inlinenoexcept

Constructs an empty instance from std::nullptr. This constructor is necessary to allow assignment of std::nullptr to values of this type, which clears the automatic pointer.

Note
As the common way to use this class is to derive an own type, this own type should have this same constructor. Only then, the assignment of std::nullptr is possible.

Definition at line 355 of file sharedmonoval.hpp.

◆ TSharedMonoVal() [5/6]

template<typename T , typename TAllocator , typename TLock >
TSharedMonoVal ( const TSharedMonoVal< T, TAllocator, TLock > & other)
inlinenoexcept

Copy Constructor. Increases the reference counter of the shared pointer (in case given other is not nulled).

Parameters
otherThe object to copy.

Definition at line 360 of file sharedmonoval.hpp.

◆ TSharedMonoVal() [6/6]

template<typename T , typename TAllocator , typename TLock >
TSharedMonoVal ( TSharedMonoVal< T, TAllocator, TLock > && other)
inlinenoexcept

Move Constructor. Does not increase the reference counter, instead nulls the other.

Parameters
otherThe object to copy.

Definition at line 366 of file sharedmonoval.hpp.

Method Details:

◆ Acquire()

template<typename T , typename TAllocator , typename TLock >
void Acquire ( const CallerInfo & ci) const
inlinenoexcept

Calls this Acquire on the embedded instance specified with template parameter TLock. This method participates in the overload resolution only if TLock provides an equivalent method.

Parameters
ciCaller information. Available only with debug-builds.

◆ AcquireRecursive()

template<typename T , typename TAllocator , typename TLock >
void AcquireRecursive ( const CallerInfo & ci) const
noexcept

Calls this Acquire on the embedded instance specified with template parameter TLock. This method participates in the overload resolution only if TLock provides an equivalent method.

Parameters
ciCaller information. Available only with debug-builds.

◆ AcquireShared()

template<typename T , typename TAllocator , typename TLock >
void AcquireShared ( const CallerInfo & ci) const
noexcept

Calls this Acquire on the embedded instance specified with template parameter TLock. This method participates in the overload resolution only if TLock provides an equivalent method.

Parameters
ciCaller information. Available only with debug-builds.

◆ ConstructT()

template<typename T , typename TAllocator , typename TLock >
template<typename... TArgs>
void ConstructT ( TArgs &&... args)
inline

Constructs the custom members. This method has to be called right after this instance was created with a non-nulled state.
Usually, this is done in the constructor of a dedicated derived type.

Note
The construction of the contained type is intentionally deferred to the (therefore mandatory) call of this method. The reason is that this way, the monotonic allocator is accessible with the method # GetAllocator() and valid and thus can be used here.
Template Parameters
TArgsThe argument types used for constructing T.
Parameters
argsThe arguments to construct the instance of T.

Definition at line 305 of file sharedmonoval.hpp.

◆ Get() [1/2]

template<typename T , typename TAllocator , typename TLock >
const T * Get ( ) const
inlinenoexcept

Returns a constant reference to the stored object of type T.

Returns
A constant reference to T.

Definition at line 457 of file sharedmonoval.hpp.

◆ Get() [2/2]

template<typename T , typename TAllocator , typename TLock >
T * Get ( )
inlinenoexcept

Returns a non-constant pointer to the stored object of type T.

Returns
A pointer to T.

Definition at line 453 of file sharedmonoval.hpp.

◆ GetAllocator()

template<typename T , typename TAllocator , typename TLock >
AllocatorType & GetAllocator ( )
inlinenoexcept
Returns
The monotonic allocator that this object has created and embedded itself in. It may be used for custom allocations and especially may be passed to the constructor of T with the method ConstructT for further use.

Definition at line 315 of file sharedmonoval.hpp.

◆ GetLock()

template<typename T , typename TAllocator , typename TLock >
TLock & GetLock ( ) const
noexcept

Returns the embedded TLock. This method is available only if the template parameter TLock is not equal to void.

Returns
A reference to the embedded lock.

◆ IsNulled()

template<typename T , typename TAllocator , typename TLock >
bool IsNulled ( ) const
inlinenoexcept

Returns true if this is an empty instance.

Returns
true if UseCount is 0, false otherwise.

Definition at line 438 of file sharedmonoval.hpp.

◆ operator bool()

template<typename T , typename TAllocator , typename TLock >
operator bool ( ) const
inlinenoexcept
Returns
true if this instance is not nulled, false otherwise.

Definition at line 460 of file sharedmonoval.hpp.

◆ operator!=()

template<typename T , typename TAllocator , typename TLock >
bool operator!= ( std::nullptr_t ) const
inlinenoexcept

Comparison with nullptr.

Returns
false if UseCount is greater than 0.

Definition at line 449 of file sharedmonoval.hpp.

◆ operator*() [1/2]

template<typename T , typename TAllocator , typename TLock >
const T & operator* ( ) const
inlinenoexcept

Overloaded operator to access members of custom type T

Returns
A constant pointer to T.

Definition at line 341 of file sharedmonoval.hpp.

◆ operator*() [2/2]

template<typename T , typename TAllocator , typename TLock >
T & operator* ( )
inlinenoexcept

Overloaded operator to access members of custom type T

Returns
A pointer to T.

Definition at line 337 of file sharedmonoval.hpp.

◆ operator->() [1/2]

template<typename T , typename TAllocator , typename TLock >
const T * operator-> ( ) const
inlinenoexcept

Overloaded operator to access members of custom type T

Returns
A constant pointer to T.

Definition at line 333 of file sharedmonoval.hpp.

◆ operator->() [2/2]

template<typename T , typename TAllocator , typename TLock >
T * operator-> ( )
inlinenoexcept

Overloaded operator to access members of custom type T

Returns
A pointer to T.

Definition at line 329 of file sharedmonoval.hpp.

◆ operator=() [1/3]

template<typename T , typename TAllocator , typename TLock >
TSharedMonoVal & operator= ( const TSharedMonoVal< T, TAllocator, TLock > & other)
inlinenoexcept

Copy Assignment Operator. Cares for self-assignment and assignment of a shared pointer with the same content. Otherwise, the reference counter of the current object is decreased, disposed if necessary, and then the object in other is copied to this object.

Parameters
otherThe object to copy into this one.
Returns
A reference to this.

Definition at line 375 of file sharedmonoval.hpp.

Here is the call graph for this function:

◆ operator=() [2/3]

template<typename T , typename TAllocator , typename TLock >
void operator= ( std::nullptr_t )
inline

Assignment of nullptr. Same as SetNulled.

Definition at line 441 of file sharedmonoval.hpp.

Here is the call graph for this function:

◆ operator=() [3/3]

template<typename T , typename TAllocator , typename TLock >
TSharedMonoVal & operator= ( TSharedMonoVal< T, TAllocator, TLock > && other)
inlinenoexcept

Move Assignment Operator. Cares for self-assignment. Otherwise, the object in other is copied to this.

Parameters
otherThe object to move into this one.
Returns
A reference to this.

Definition at line 399 of file sharedmonoval.hpp.

Here is the call graph for this function:

◆ operator==()

template<typename T , typename TAllocator , typename TLock >
bool operator== ( std::nullptr_t ) const
inlinenoexcept

Comparison with nullptr.

Returns
true if UseCount is greater than 0.

Definition at line 445 of file sharedmonoval.hpp.

◆ Release()

template<typename T , typename TAllocator , typename TLock >
void Release ( const CallerInfo & ci) const
noexcept

Calls this Acquire on the embedded instance specified with template parameter TLock. This method participates in the overload resolution only if TLock provides an equivalent method.

Parameters
ciCaller information. Available only with debug-builds.

◆ ReleaseRecursive()

template<typename T , typename TAllocator , typename TLock >
void ReleaseRecursive ( const CallerInfo & ci) const
noexcept

Calls this Acquire on the embedded instance specified with template parameter TLock. This method participates in the overload resolution only if TLock provides an equivalent method.

Parameters
ciCaller information. Available only with debug-builds.

◆ ReleaseShared()

template<typename T , typename TAllocator , typename TLock >
void ReleaseShared ( const CallerInfo & ci) const
noexcept

Calls this Acquire on the embedded instance specified with template parameter TLock. This method participates in the overload resolution only if TLock provides an equivalent method.

Parameters
ciCaller information. Available only with debug-builds.

◆ Reset()

template<typename T , typename TAllocator , typename TLock >
template<typename... TArgs>
void Reset ( TArgs &&... args)
inline

Resets the monotonic allocator that this object is contained in to the snapshot created right after construction. The allocated memory buffers will remain allocated and reused. Before resetting, the destructor of the custom object T is invoked, and after the reset, in-place construction is performed.

All shared instances remain valid (while, of-course, their content is likewise reset).

It is up to the implementation of the derived class if this method should be exposed or not. It is also up to the implementation of the derived class if the internal allocator should be exposed for 3rd-party usage or not.

Template Parameters
TArgsThe argument types used for re-constructing T.
Parameters
argsThe arguments to re-construct the instance of T.

Definition at line 280 of file sharedmonoval.hpp.

◆ Self() [1/2]

template<typename T , typename TAllocator , typename TLock >
const T & Self ( ) const
inlinenoexcept

Returns a constant reference to the stored object of type T.
This can be used as an alias to (**this).

Returns
A constant reference to T.

Definition at line 325 of file sharedmonoval.hpp.

◆ Self() [2/2]

template<typename T , typename TAllocator , typename TLock >
T & Self ( )
inlinenoexcept

Returns a non-constant reference to the stored object of type T.
This can be used as an alias to (**this).

Returns
A reference to T.

Definition at line 320 of file sharedmonoval.hpp.

◆ SetNulled()

template<typename T , typename TAllocator , typename TLock >
void SetNulled ( )
inlinenoexcept

Sets this object to nulled state, as if default constructed or nullptr was assigned. If no shared copy exists, all data is destructed and memory is freed.
As an alternative to this method, nullptr can be assigned.

Definition at line 434 of file sharedmonoval.hpp.

Here is the call graph for this function:

◆ SizeOfAllocation()

template<typename T , typename TAllocator , typename TLock >
static constexpr size_t SizeOfAllocation ( )
inlinestaticconstexpr
Returns
The size of the memory that is allocated for the T as well as for the reference counter and the allocator member. (To whom it may concern.)

Definition at line 310 of file sharedmonoval.hpp.

◆ TryAcquire()

template<typename T , typename TAllocator , typename TLock >
bool TryAcquire ( const CallerInfo & ci) const
nodiscardnoexcept

Calls this Acquire on the embedded instance specified with template parameter TLock. This method participates in the overload resolution only if TLock provides an equivalent method.

Parameters
ciCaller information. Available only with debug-builds.
Returns
true if the lock was not acquired by a different thread and thus, this call was successful. false otherwise.

◆ TryAcquireShared()

template<typename T , typename TAllocator , typename TLock >
bool TryAcquireShared ( const CallerInfo & ci) const
nodiscardnoexcept

Calls this Acquire on the embedded instance specified with template parameter TLock. This method participates in the overload resolution only if TLock provides an equivalent method.

Parameters
ciCaller information. Available only with debug-builds.
Returns
true if the lock was not acquired by a different thread and thus, this call was successful. false otherwise.

◆ TryAcquireSharedTimed() [1/4]

template<typename T , typename TAllocator , typename TLock >
bool TryAcquireSharedTimed ( const Ticks & pointInTime,
const CallerInfo & ci ) const
nodiscardnoexcept

Calls this TryAcquireSharedTimed on the embedded instance specified with template parameter TLock. This method participates in the overload resolution only if TLock provides an equivalent method.

Parameters
pointInTimeThe point in time, when this method stops waiting.
ciCaller information. Available only with debug-builds.
Returns
true if the lock was not acquired by a different thread and thus, this call was successful. false otherwise.

◆ TryAcquireSharedTimed() [2/4]

template<typename T , typename TAllocator , typename TLock >
bool TryAcquireSharedTimed ( const Ticks::Duration & waitDuration,
const CallerInfo & ci ) const
nodiscardnoexcept

Calls this TryAcquireSharedTimed on the embedded instance specified with template parameter TLock. This method participates in the overload resolution only if TLock provides an equivalent method.

Parameters
waitDurationThe point in time, when this method stops waiting.
ciCaller information. Available only with debug-builds.
Returns
true if the lock was not acquired by a different thread and thus, this call was successful. false otherwise.

◆ TryAcquireSharedTimed() [3/4]

template<typename T , typename TAllocator , typename TLock >
bool TryAcquireSharedTimed ( const Ticks::Duration::TDuration & waitDuration,
const CallerInfo & ci ) const
nodiscardnoexcept

Calls this TryAcquireSharedTimed on the embedded instance specified with template parameter TLock. This method participates in the overload resolution only if TLock provides an equivalent method.

Parameters
waitDurationThe point in time, when this method stops waiting.
ciCaller information. Available only with debug-builds.
Returns
true if the lock was not acquired by a different thread and thus, this call was successful. false otherwise.

◆ TryAcquireSharedTimed() [4/4]

template<typename T , typename TAllocator , typename TLock >
bool TryAcquireSharedTimed ( const Ticks::TTimePoint & pointInTime,
const CallerInfo & ci ) const
nodiscardnoexcept

Calls this TryAcquireSharedTimed on the embedded instance specified with template parameter TLock. This method participates in the overload resolution only if TLock provides an equivalent method.

Parameters
pointInTimeThe point in time, when this method stops waiting.
ciCaller information. Available only with debug-builds.
Returns
true if the lock was not acquired by a different thread and thus, this call was successful. false otherwise.

◆ TryAcquireTimed() [1/4]

template<typename T , typename TAllocator , typename TLock >
bool TryAcquireTimed ( const Ticks & pointInTime,
const CallerInfo & ci ) const
noexcept

Calls this TryAcquireTimed on the embedded instance specified with template parameter TLock. This method participates in the overload resolution only if TLock provides an equivalent method.

Parameters
pointInTimeThe point in time, when this method stops waiting.
ciCaller information. Available only with debug-builds.
Returns
true if the lock was not acquired by a different thread and thus, this call was successful. false otherwise.

◆ TryAcquireTimed() [2/4]

template<typename T , typename TAllocator , typename TLock >
bool TryAcquireTimed ( const Ticks::Duration & waitDuration,
const CallerInfo & ci ) const
nodiscardnoexcept

Calls this TryAcquireTimed on the embedded instance specified with template parameter TLock. This method participates in the overload resolution only if TLock provides an equivalent method.

Parameters
waitDurationThe point in time, when this method stops waiting.
ciCaller information. Available only with debug-builds.
Returns
true if the lock was not acquired by a different thread and thus, this call was successful. false otherwise.

◆ TryAcquireTimed() [3/4]

template<typename T , typename TAllocator , typename TLock >
bool TryAcquireTimed ( const Ticks::Duration::TDuration & waitDuration,
const CallerInfo & ci ) const
nodiscardnoexcept

Calls this TryAcquireTimed on the embedded instance specified with template parameter TLock. This method participates in the overload resolution only if TLock provides an equivalent method.

Parameters
waitDurationThe point in time, when this method stops waiting.
ciCaller information. Available only with debug-builds.
Returns
true if the lock was not acquired by a different thread and thus, this call was successful. false otherwise.

◆ TryAcquireTimed() [4/4]

template<typename T , typename TAllocator , typename TLock >
bool TryAcquireTimed ( const Ticks::TTimePoint & pointInTime,
const CallerInfo & ci ) const
nodiscardnoexcept

Calls this TryAcquireTimed on the embedded instance specified with template parameter TLock. This method participates in the overload resolution only if TLock provides an equivalent method.

Parameters
pointInTimeThe point in time, when this method stops waiting.
ciCaller information. Available only with debug-builds.
Returns
true if the lock was not acquired by a different thread and thus, this call was successful. false otherwise.

◆ Unique()

template<typename T , typename TAllocator , typename TLock >
bool Unique ( ) const
inlinenoexcept

Returns true if the UseCount is 1.

Returns
true if this instance is set but not shared.

Definition at line 428 of file sharedmonoval.hpp.

◆ UseCount()

template<typename T , typename TAllocator , typename TLock >
unsigned int UseCount ( ) const
inlinenoexcept

Returns the number of shared usages. In a multithreaded environment, the value returned is approximate.

Returns
The number of shared usages. If this instance was default-constructed, moved, method SetNulled was called, or nullptr was assigned, then 0 is returned.

Definition at line 423 of file sharedmonoval.hpp.


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