mCRL2
Loading...
Searching...
No Matches
mcrl2::utilities::shared_reference< T > Class Template Reference

A reference counted reference to a shared_reference_counted object. More...

#include <shared_reference.h>

Public Member Functions

 shared_reference () noexcept
 The default constructor.
 
 shared_reference (T *reference) noexcept
 Takes ownership of the passed reference, which means that its reference count is incremented.
 
 shared_reference (const shared_reference< T > &other) noexcept
 Copy constructor.
 
 shared_reference (shared_reference< T > &&other) noexcept
 Move constructor.
 
 ~shared_reference ()
 
shared_reference< T > & operator= (const shared_reference< T > &other) noexcept
 Copy assignment constructor.
 
shared_reference< T > & operator= (shared_reference< T > &&other) noexcept
 Move assignment constructor.
 
bool defined () const
 Check whether the shared_reference has a valid reference.
 
bool operator== (const shared_reference< T > &other) const noexcept
 
bool operator< (const shared_reference< T > &other) const noexcept
 
bool operator!= (const shared_reference< T > &other) const noexcept
 
bool operator<= (const shared_reference< T > &other) const noexcept
 
bool operator> (const shared_reference< T > &other) const noexcept
 
bool operator>= (const shared_reference &other) const noexcept
 
T * operator-> () const noexcept
 
T * get () const noexcept
 
T & operator* () const noexcept
 
void swap (shared_reference< T > &other)
 Swaps *this with the other shared reference.
 
bool tagged () const noexcept
 
void tag () const
 
void untag () const
 

Private Attributes

utilities::tagged_pointer< T > m_reference
 

Detailed Description

template<typename T>
class mcrl2::utilities::shared_reference< T >

A reference counted reference to a shared_reference_counted object.

Similar to a shared_ptr except that reference counts are only atomic when thread safety is desired and that it stores the reference count in the inherited object.

Definition at line 102 of file shared_reference.h.

Constructor & Destructor Documentation

◆ shared_reference() [1/4]

template<typename T >
mcrl2::utilities::shared_reference< T >::shared_reference ( )
inlinenoexcept

The default constructor.

Definition at line 107 of file shared_reference.h.

◆ shared_reference() [2/4]

template<typename T >
mcrl2::utilities::shared_reference< T >::shared_reference ( T *  reference)
inlinenoexcept

Takes ownership of the passed reference, which means that its reference count is incremented.

Definition at line 113 of file shared_reference.h.

◆ shared_reference() [3/4]

template<typename T >
mcrl2::utilities::shared_reference< T >::shared_reference ( const shared_reference< T > &  other)
inlinenoexcept

Copy constructor.

Definition at line 121 of file shared_reference.h.

◆ shared_reference() [4/4]

template<typename T >
mcrl2::utilities::shared_reference< T >::shared_reference ( shared_reference< T > &&  other)
inlinenoexcept

Move constructor.

Definition at line 131 of file shared_reference.h.

◆ ~shared_reference()

template<typename T >
mcrl2::utilities::shared_reference< T >::~shared_reference ( )
inline

Definition at line 137 of file shared_reference.h.

Member Function Documentation

◆ defined()

template<typename T >
bool mcrl2::utilities::shared_reference< T >::defined ( ) const
inline

Check whether the shared_reference has a valid reference.

Definition at line 178 of file shared_reference.h.

◆ get()

template<typename T >
T * mcrl2::utilities::shared_reference< T >::get ( ) const
inlinenoexcept

Definition at line 220 of file shared_reference.h.

◆ operator!=()

template<typename T >
bool mcrl2::utilities::shared_reference< T >::operator!= ( const shared_reference< T > &  other) const
inlinenoexcept

Definition at line 194 of file shared_reference.h.

◆ operator*()

template<typename T >
T & mcrl2::utilities::shared_reference< T >::operator* ( ) const
inlinenoexcept

Definition at line 226 of file shared_reference.h.

◆ operator->()

template<typename T >
T * mcrl2::utilities::shared_reference< T >::operator-> ( ) const
inlinenoexcept

Definition at line 214 of file shared_reference.h.

◆ operator<()

template<typename T >
bool mcrl2::utilities::shared_reference< T >::operator< ( const shared_reference< T > &  other) const
inlinenoexcept

Definition at line 188 of file shared_reference.h.

◆ operator<=()

template<typename T >
bool mcrl2::utilities::shared_reference< T >::operator<= ( const shared_reference< T > &  other) const
inlinenoexcept

Definition at line 199 of file shared_reference.h.

◆ operator=() [1/2]

template<typename T >
shared_reference< T > & mcrl2::utilities::shared_reference< T >::operator= ( const shared_reference< T > &  other)
inlinenoexcept

Copy assignment constructor.

Definition at line 146 of file shared_reference.h.

◆ operator=() [2/2]

template<typename T >
shared_reference< T > & mcrl2::utilities::shared_reference< T >::operator= ( shared_reference< T > &&  other)
inlinenoexcept

Move assignment constructor.

Definition at line 165 of file shared_reference.h.

◆ operator==()

template<typename T >
bool mcrl2::utilities::shared_reference< T >::operator== ( const shared_reference< T > &  other) const
inlinenoexcept

Definition at line 183 of file shared_reference.h.

◆ operator>()

template<typename T >
bool mcrl2::utilities::shared_reference< T >::operator> ( const shared_reference< T > &  other) const
inlinenoexcept

Definition at line 204 of file shared_reference.h.

◆ operator>=()

template<typename T >
bool mcrl2::utilities::shared_reference< T >::operator>= ( const shared_reference< T > &  other) const
inlinenoexcept

Definition at line 209 of file shared_reference.h.

◆ swap()

template<typename T >
void mcrl2::utilities::shared_reference< T >::swap ( shared_reference< T > &  other)
inline

Swaps *this with the other shared reference.

Definition at line 233 of file shared_reference.h.

◆ tag()

template<typename T >
void mcrl2::utilities::shared_reference< T >::tag ( ) const
inline

Definition at line 243 of file shared_reference.h.

◆ tagged()

template<typename T >
bool mcrl2::utilities::shared_reference< T >::tagged ( ) const
inlinenoexcept

Definition at line 238 of file shared_reference.h.

◆ untag()

template<typename T >
void mcrl2::utilities::shared_reference< T >::untag ( ) const
inline

Definition at line 248 of file shared_reference.h.

Member Data Documentation

◆ m_reference

template<typename T >
utilities::tagged_pointer<T> mcrl2::utilities::shared_reference< T >::m_reference
mutableprivate

Definition at line 254 of file shared_reference.h.


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