| 
    rippled
    
   | 
 
A combination of a strong and a weak intrusive pointer stored in the space of a single pointer. More...
#include <IntrusivePointer.h>

Public Member Functions | |
| SharedWeakUnion ()=default | |
| SharedWeakUnion (SharedWeakUnion const &rhs) | |
| template<class TT >  requires std::convertible_to<TT*, T*>  | |
| SharedWeakUnion (SharedIntrusive< TT > const &rhs) | |
| SharedWeakUnion (SharedWeakUnion &&rhs) | |
| template<class TT >  requires std::convertible_to<TT*, T*>  | |
| SharedWeakUnion (SharedIntrusive< TT > &&rhs) | |
| SharedWeakUnion & | operator= (SharedWeakUnion const &rhs) | 
| template<class TT >  requires std::convertible_to<TT*, T*>  | |
| SharedWeakUnion & | operator= (SharedIntrusive< TT > const &rhs) | 
| template<class TT >  requires std::convertible_to<TT*, T*>  | |
| SharedWeakUnion & | operator= (SharedIntrusive< TT > &&rhs) | 
| ~SharedWeakUnion () | |
| SharedIntrusive< T > | getStrong () const | 
| Return a strong pointer if this is already a strong pointer (i.e.   | |
| operator bool () const noexcept | |
| Return true if this is a strong pointer and the strong pointer is seated.   | |
| void | reset () | 
| Set the pointer to null, decrement the appropriate ref count, and run the appropriate release action.   | |
| T * | get () const | 
| If this is a strong pointer, return the raw pointer.   | |
| std::size_t | use_count () const | 
| If this is a strong pointer, return the strong count.   | |
| bool | expired () const | 
| Return true if there is a non-zero strong count.   | |
| SharedIntrusive< T > | lock () const | 
| If this is a strong pointer, return the strong pointer.   | |
| bool | isStrong () const | 
| Return true is this represents a strong pointer.   | |
| bool | isWeak () const | 
| Return true is this represents a weak pointer.   | |
| bool | convertToStrong () | 
| If this is a weak pointer, attempt to convert it to a strong pointer.   | |
| bool | convertToWeak () | 
| If this is a strong pointer, attempt to convert it to a weak pointer.   | |
Private Types | |
| enum class | RefStrength { strong , weak } | 
Private Member Functions | |
| T * | unsafeGetRawPtr () const | 
| Return the raw pointer held by this object.   | |
| void | unsafeSetRawPtr (T *p, RefStrength rs) | 
| Set the raw pointer and tag bit directly.   | |
| void | unsafeSetRawPtr (std::nullptr_t) | 
| Set the raw pointer and tag bit to all zeros (strong null pointer).   | |
| void | unsafeReleaseNoStore () | 
| Decrement the appropriate ref count, and run the appropriate release action.   | |
Private Attributes | |
| std::uintptr_t | tp_ {0} | 
Static Private Attributes | |
| static constexpr std::uintptr_t | tagMask = 1 | 
| static constexpr std::uintptr_t | ptrMask = ~tagMask | 
A combination of a strong and a weak intrusive pointer stored in the space of a single pointer.
This class is similar to a std::variant<SharedIntrusive,WeakIntrusive> with some optimizations. In particular, it uses a low-order bit to determine if the raw pointer represents a strong pointer or a weak pointer. It can also be quickly switched between its strong pointer and weak pointer representations. This class is useful for storing intrusive pointers in tagged caches. 
Definition at line 321 of file IntrusivePointer.h.
      
  | 
  strongprivate | 
| Enumerator | |
|---|---|
| strong | |
| weak | |
Definition at line 440 of file IntrusivePointer.h.
      
  | 
  default | 
| ripple::SharedWeakUnion< T >::SharedWeakUnion | ( | SharedWeakUnion< T > const & | rhs | ) | 
| ripple::SharedWeakUnion< T >::SharedWeakUnion | ( | SharedIntrusive< TT > const & | rhs | ) | 
| ripple::SharedWeakUnion< T >::SharedWeakUnion | ( | SharedWeakUnion< T > && | rhs | ) | 
| ripple::SharedWeakUnion< T >::SharedWeakUnion | ( | SharedIntrusive< TT > && | rhs | ) | 
| ripple::SharedWeakUnion< T >::~SharedWeakUnion | ( | ) | 
| SharedWeakUnion & ripple::SharedWeakUnion< T >::operator= | ( | SharedWeakUnion< T > const & | rhs | ) | 
| SharedWeakUnion & ripple::SharedWeakUnion< T >::operator= | ( | SharedIntrusive< TT > const & | rhs | ) | 
| SharedWeakUnion & ripple::SharedWeakUnion< T >::operator= | ( | SharedIntrusive< TT > && | rhs | ) | 
| SharedIntrusive< T > ripple::SharedWeakUnion< T >::getStrong | ( | ) | const | 
Return a strong pointer if this is already a strong pointer (i.e.
don't lock the weak pointer. Use the lock method if that's what's needed) 
      
  | 
  explicitnoexcept | 
Return true if this is a strong pointer and the strong pointer is seated.
| void ripple::SharedWeakUnion< T >::reset | ( | ) | 
Set the pointer to null, decrement the appropriate ref count, and run the appropriate release action.
| T * ripple::SharedWeakUnion< T >::get | ( | ) | const | 
If this is a strong pointer, return the raw pointer.
Otherwise return null.
| std::size_t ripple::SharedWeakUnion< T >::use_count | ( | ) | const | 
If this is a strong pointer, return the strong count.
Otherwise return 0
| bool ripple::SharedWeakUnion< T >::expired | ( | ) | const | 
Return true if there is a non-zero strong count.
| SharedIntrusive< T > ripple::SharedWeakUnion< T >::lock | ( | ) | const | 
If this is a strong pointer, return the strong pointer.
Otherwise attempt to lock the weak pointer.
| bool ripple::SharedWeakUnion< T >::isStrong | ( | ) | const | 
Return true is this represents a strong pointer.
| bool ripple::SharedWeakUnion< T >::isWeak | ( | ) | const | 
Return true is this represents a weak pointer.
| bool ripple::SharedWeakUnion< T >::convertToStrong | ( | ) | 
If this is a weak pointer, attempt to convert it to a strong pointer.
| bool ripple::SharedWeakUnion< T >::convertToWeak | ( | ) | 
If this is a strong pointer, attempt to convert it to a weak pointer.
      
  | 
  private | 
Return the raw pointer held by this object.
      
  | 
  private | 
Set the raw pointer and tag bit directly.
      
  | 
  private | 
Set the raw pointer and tag bit to all zeros (strong null pointer).
      
  | 
  private | 
Decrement the appropriate ref count, and run the appropriate release action.
Note: this does not set the raw pointer to null.
      
  | 
  private | 
Definition at line 430 of file IntrusivePointer.h.
      
  | 
  staticconstexprprivate | 
Definition at line 431 of file IntrusivePointer.h.
      
  | 
  staticconstexprprivate | 
Definition at line 432 of file IntrusivePointer.h.