20#ifndef RIPPLE_BASICS_INTRUSIVEREFCOUNTS_H_INCLUDED 
   21#define RIPPLE_BASICS_INTRUSIVEREFCOUNTS_H_INCLUDED 
   23#include <xrpl/beast/utility/instrumentation.h> 
  279            "ripple::IntrusiveRefCounts::releaseStrongRef : previous ref " 
  283        if (prevVal.strong == 1)
 
  285            if (prevVal.weak == 0)
 
  304                "ripple::IntrusiveRefCounts::releaseStrongRef : not in partial " 
 
  335            (!prevVal.partialDestroyStartedBit),
 
  336            "ripple::IntrusiveRefCounts::addWeakReleaseStrongRef : not in " 
  339        auto nextIntVal = prevIntVal + delta;
 
  341        if (prevVal.strong == 1)
 
  343            if (prevVal.weak == 0)
 
  358                "ripple::IntrusiveRefCounts::addWeakReleaseStrongRef : not " 
  359                "started partial destroy");
 
 
  370    if (prev.weak == 1 && prev.strong == 0)
 
  372        if (!prev.partialDestroyStartedBit)
 
  381        if (!prev.partialDestroyFinishedBit)
 
 
  430        "ripple::IntrusiveRefCounts::~IntrusiveRefCounts : count must be zero");
 
  434        "ripple::IntrusiveRefCounts::~IntrusiveRefCounts : valid tag");
 
 
  449        "ripple::IntrusiveRefCounts::RefCountPair(FieldType) : inputs inside " 
 
  460        "ripple::IntrusiveRefCounts::RefCountPair(CountType, CountType) : " 
  461        "inputs inside range");
 
 
  469        "ripple::IntrusiveRefCounts::RefCountPair::combinedValue : inputs " 
 
  487        "ripple::partialDestructorFinished : not a weak ref");
 
  493        self.refCounts.notify_one();
 
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
ReleaseWeakRefAction
Action to perform when releasing a weak pointer.
 
ReleaseStrongRefAction
Action to perform when releasing a strong pointer.
 
Unpack the count and tag fields from the packed atomic integer form.
 
static constexpr CountType maxStrongValue
 
FieldType combinedValue() const noexcept
Convert back to the packed integer form.
 
FieldType partialDestroyFinishedBit
The partialDestroyFinishedBit is set to on when the partial destroy function has finished.
 
static constexpr CountType maxWeakValue
 
static constexpr CountType checkWeakMaxValue
 
RefCountPair(FieldType v) noexcept
 
FieldType partialDestroyStartedBit
The partialDestroyStartedBit is set to on when the partial destroy function is started.
 
static constexpr CountType checkStrongMaxValue
Put an extra margin to detect when running up against limits.
 
Implement the strong count, weak count, and bit flags for an intrusive pointer.
 
ReleaseWeakRefAction releaseWeakRef() const
 
static constexpr size_t StrongCountNumBits
 
static constexpr FieldType partialDestroyFinishedMask
Flag that is set when the partialDestroy function has finished running.
 
ReleaseStrongRefAction addWeakReleaseStrongRef() const
 
static constexpr FieldType tagMask
Mask that will zero out all the count bits and leave the tag bits unchanged.
 
static constexpr size_t FieldTypeBits
 
std::size_t use_count() const noexcept
 
bool expired() const noexcept
 
static constexpr FieldType weakMask
Mask that will zero out everything except the weak count.
 
static constexpr FieldType strongMask
Mask that will zero out everything except the strong count.
 
void addStrongRef() const noexcept
 
static constexpr FieldType partialDestroyStartedMask
Flag that is set when the partialDestroy function has started running (or is about to start running).
 
bool checkoutStrongRefFromWeak() const noexcept
 
static constexpr FieldType strongDelta
Amount to change the strong count when adding or releasing a reference.
 
friend void partialDestructorFinished(T **o)
 
virtual ~IntrusiveRefCounts() noexcept
 
static constexpr FieldType weakDelta
Amount to change the weak count when adding or releasing a reference.
 
static constexpr size_t WeakCountNumBits
 
void addWeakRef() const noexcept
 
static constexpr FieldType valueMask
Mask that will zero out the tag bits and leave the count bits unchanged.
 
static constexpr FieldType one
 
std::atomic< FieldType > refCounts
refCounts consists of four fields that are treated atomically:
 
ReleaseStrongRefAction releaseStrongRef() const