StormByte C++ Library 0.0.9999
StormByte is a comprehensive, cross-platform C++ library aimed at easing system programming, configuration management, logging, and database handling tasks. This library provides a unified API that abstracts away the complexities and inconsistencies of different platforms (Windows, Linux).
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
StormByte::Mutexed< T > Class Template Reference
Inheritance diagram for StormByte::Mutexed< T >:
Inheritance graph
[legend]

Public Member Functions

 Mutexed () noexcept=default
 Default constructor.
 
 Mutexed (const T &value) noexcept
 Constructor with value.
 
 Mutexed (const Mutexed< T > &other) noexcept
 Copy constructor.
 
 Mutexed (Mutexed< T > &&other) noexcept
 Move constructor.
 
Mutexed< T > & operator= (const Mutexed< T > &other) noexcept
 Copy assignment operator.
 
Mutexed< T > & operator= (Mutexed< T > &&other) noexcept
 Move assignment operator.
 
virtual Mutexed< T > & operator= (const T &value) noexcept
 Assignment operator.
 
virtual Mutexed< T > & operator= (T &&value) noexcept
 Assignment move operator.
 
virtual ~Mutexed () noexcept=default
 Destructor.
 
std::strong_ordering operator<=> (const Mutexed &other) const noexcept
 Spaceship operator for comparison.
 
bool operator!= (const Mutexed &other) const noexcept
 Inequality operator.
 
virtual Toperator* () noexcept
 Dereference operator (use with explicit locking).
 
virtual const Toperator* () const noexcept
 Dereference operator (use with explicit locking).
 
virtual Toperator-> () noexcept
 Pointer dereference operator (use with explicit locking).
 
virtual const Toperator-> () const noexcept
 Pointer dereference operator (use with explicit locking).
 
void Lock () const
 Locks the mutex.
 
void Unlock () const
 Unlocks the mutex.
 

Protected Attributes

T m_value
 Value.
 
std::mutex m_mutex
 Mutex.
 

Constructor & Destructor Documentation

◆ Mutexed() [1/3]

template<typename T >
StormByte::Mutexed< T >::Mutexed ( const T value)
inlinenoexcept

Constructor with value.

Parameters
valueThe value to set.

◆ Mutexed() [2/3]

template<typename T >
StormByte::Mutexed< T >::Mutexed ( const Mutexed< T > &  other)
inlinenoexcept

Copy constructor.

Parameters
otherThe other Mutexed object to copy.

◆ Mutexed() [3/3]

template<typename T >
StormByte::Mutexed< T >::Mutexed ( Mutexed< T > &&  other)
inlinenoexcept

Move constructor.

Parameters
otherThe other Mutexed object to move.

Member Function Documentation

◆ operator!=()

template<typename T >
bool StormByte::Mutexed< T >::operator!= ( const Mutexed< T > &  other) const
inlinenoexcept

Inequality operator.

Parameters
otherThe other Mutexed object to compare.
Returns
True if not equal, false otherwise.

◆ operator*() [1/2]

template<typename T >
virtual const T & StormByte::Mutexed< T >::operator* ( ) const
inlinevirtualnoexcept

Dereference operator (use with explicit locking).

Returns
Const reference to the value.

◆ operator*() [2/2]

template<typename T >
virtual T & StormByte::Mutexed< T >::operator* ( )
inlinevirtualnoexcept

Dereference operator (use with explicit locking).

Returns
Reference to the value.

◆ operator->() [1/2]

template<typename T >
virtual const T * StormByte::Mutexed< T >::operator-> ( ) const
inlinevirtualnoexcept

Pointer dereference operator (use with explicit locking).

Returns
Const pointer to the value.

◆ operator->() [2/2]

template<typename T >
virtual T * StormByte::Mutexed< T >::operator-> ( )
inlinevirtualnoexcept

Pointer dereference operator (use with explicit locking).

Returns
Pointer to the value.

◆ operator<=>()

template<typename T >
std::strong_ordering StormByte::Mutexed< T >::operator<=> ( const Mutexed< T > &  other) const
inlinenoexcept

Spaceship operator for comparison.

Parameters
otherThe other Mutexed object to compare.
Returns
Strong ordering result.

◆ operator=() [1/4]

template<typename T >
Mutexed< T > & StormByte::Mutexed< T >::operator= ( const Mutexed< T > &  other)
inlinenoexcept

Copy assignment operator.

Parameters
otherThe other Mutexed object to assign.
Returns
Reference to this object.

◆ operator=() [2/4]

template<typename T >
virtual Mutexed< T > & StormByte::Mutexed< T >::operator= ( const T value)
inlinevirtualnoexcept

Assignment operator.

Parameters
valueThe value to set.
Returns
Reference to this object.

Reimplemented in StormByte::ArithmeticMutexed< T >.

◆ operator=() [3/4]

template<typename T >
Mutexed< T > & StormByte::Mutexed< T >::operator= ( Mutexed< T > &&  other)
inlinenoexcept

Move assignment operator.

Parameters
otherThe other Mutexed object to assign.
Returns
Reference to this object.

◆ operator=() [4/4]

template<typename T >
virtual Mutexed< T > & StormByte::Mutexed< T >::operator= ( T &&  value)
inlinevirtualnoexcept

Assignment move operator.

Parameters
valueThe value to set.
Returns
Reference to this object.

Reimplemented in StormByte::ArithmeticMutexed< T >.


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