20#ifndef RIPPLE_BASICS_INTRUSIVEPOINTER_H_INCLUDED 
   21#define RIPPLE_BASICS_INTRUSIVEPOINTER_H_INCLUDED 
   92    template <CAdoptTag TAdoptTag>
 
  134    template <CAdoptTag TAdoptTag = SharedIntrusiveAdoptIncrementStrongTag>
 
  172    operator->() const noexcept;
 
  175    operator 
bool() const noexcept;
 
  191    template <class TT, class... Args>
 
  328        "Bad alignment: Combo pointer requires low bit to be zero");
 
  371    operator bool() const noexcept;
 
 
  465template <
class TT, 
class... Args>
 
  475        "SharedIntrusive constructor should not throw or this can leak " 
 
 
  493template <
class T, 
class... A>
 
  500template <
class T, 
class TT>
 
  507template <
class T, 
class TT>
 
 
 
A shared intrusive pointer class that supports weak pointers.
 
bool operator!=(std::nullptr_t) const
 
T * ptr_
pointer to the type with an intrusive count
 
T & operator*() const noexcept
 
SharedIntrusive & operator=(SharedIntrusive const &rhs)
 
void adopt(T *p)
Adopt the raw pointer.
 
SharedIntrusive(T *p, TAdoptTag) noexcept
 
SharedIntrusive(SharedIntrusive< TT > &&rhs)
 
std::size_t use_count() const
Return the strong count.
 
SharedIntrusive & operator=(SharedIntrusive< TT > &&rhs)
 
T * unsafeGetRawPtr() const
Return the raw pointer held by this object.
 
friend SharedIntrusive< TT > make_SharedIntrusive(Args &&... args)
Create a shared intrusive pointer.
 
SharedIntrusive & operator=(SharedIntrusive &&rhs)
 
SharedIntrusive(SharedIntrusive &&rhs)
 
SharedIntrusive(DynamicCastTagSharedIntrusive, SharedIntrusive< TT > &&rhs)
Create a new SharedIntrusive by dynamically casting the pointer controlled by the rhs param.
 
SharedIntrusive & operator=(SharedIntrusive< TT > const &rhs)
 
T * get() const
Get the raw pointer.
 
SharedIntrusive(StaticCastTagSharedIntrusive, SharedIntrusive< TT > &&rhs)
Create a new SharedIntrusive by statically casting the pointer controlled by the rhs param.
 
SharedIntrusive(SharedIntrusive const &rhs)
 
void reset()
Set the pointer to null, decrement the strong count, and run the appropriate release action.
 
SharedIntrusive(SharedIntrusive< TT > const &rhs)
 
void unsafeSetRawPtr(T *p)
Set the raw pointer directly.
 
SharedIntrusive()=default
 
SharedIntrusive(DynamicCastTagSharedIntrusive, SharedIntrusive< TT > const &rhs)
Create a new SharedIntrusive by dynamically casting the pointer controlled by the rhs param.
 
SharedIntrusive(StaticCastTagSharedIntrusive, SharedIntrusive< TT > const &rhs)
Create a new SharedIntrusive by statically casting the pointer controlled by the rhs param.
 
void unsafeReleaseAndStore(T *next)
Exchange the current raw pointer held by this object with the given pointer.
 
T * unsafeExchange(T *p)
Exchange the raw pointer directly.
 
bool operator==(std::nullptr_t) const
 
A combination of a strong and a weak intrusive pointer stored in the space of a single pointer.
 
SharedIntrusive< T > getStrong() const
Return a strong pointer if this is already a strong pointer (i.e.
 
SharedIntrusive< T > lock() const
If this is a strong pointer, return the strong pointer.
 
T * unsafeGetRawPtr() const
Return the raw pointer held by this object.
 
bool expired() const
Return true if there is a non-zero strong count.
 
SharedWeakUnion & operator=(SharedIntrusive< TT > const &rhs)
 
bool isStrong() const
Return true is this represents a strong pointer.
 
SharedWeakUnion(SharedWeakUnion &&rhs)
 
SharedWeakUnion & operator=(SharedIntrusive< TT > &&rhs)
 
SharedWeakUnion(SharedIntrusive< TT > &&rhs)
 
bool convertToWeak()
If this is a strong pointer, attempt to convert it to a weak pointer.
 
T * get() const
If this is a strong pointer, return the raw pointer.
 
void reset()
Set the pointer to null, decrement the appropriate ref count, and run the appropriate release action.
 
std::size_t use_count() const
If this is a strong pointer, return the strong count.
 
SharedWeakUnion & operator=(SharedWeakUnion const &rhs)
 
SharedWeakUnion(SharedIntrusive< TT > const &rhs)
 
static constexpr std::uintptr_t ptrMask
 
bool convertToStrong()
If this is a weak pointer, attempt to convert it to a strong pointer.
 
void unsafeReleaseNoStore()
Decrement the appropriate ref count, and run the appropriate release action.
 
SharedWeakUnion()=default
 
void unsafeSetRawPtr(T *p, RefStrength rs)
Set the raw pointer and tag bit directly.
 
bool isWeak() const
Return true is this represents a weak pointer.
 
void unsafeSetRawPtr(std::nullptr_t)
Set the raw pointer and tag bit to all zeros (strong null pointer).
 
static constexpr std::uintptr_t tagMask
 
SharedWeakUnion(SharedWeakUnion const &rhs)
 
A weak intrusive pointer class for the SharedIntrusive pointer class.
 
WeakIntrusive(SharedIntrusive< T > const &&rhs)=delete
 
bool expired() const
Return true if the strong count is zero.
 
WeakIntrusive & operator=(SharedIntrusive< TT > const &rhs)
 
void adopt(T *ptr)
Adopt the raw pointer and increment the weak count.
 
WeakIntrusive(SharedIntrusive< T > const &rhs)
 
void unsafeReleaseNoStore()
Decrement the weak count.
 
WeakIntrusive & operator=(WeakIntrusive const &)=delete
 
SharedIntrusive< T > lock() const
Get a strong pointer from the weak pointer, if possible.
 
WeakIntrusive(WeakIntrusive &&rhs)
 
void reset()
Set the pointer to null and decrement the weak count.
 
WeakIntrusive(WeakIntrusive const &rhs)
 
SharedPtr< T > make_shared(A &&... args)
 
SharedPtr< T > static_pointer_cast(TT const &v)
 
SharedPtr< T > dynamic_pointer_cast(TT const &v)
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
SharedIntrusive< TT > make_SharedIntrusive(Args &&... args)
Create a shared intrusive pointer.
 
When creating or adopting a raw pointer, controls whether the strong count is incremented or not.
 
When creating or adopting a raw pointer, controls whether the strong count is incremented or not.