xrpld
Loading...
Searching...
No Matches
xrpl::IntrusiveRefCounts::RefCountPair Struct Reference

Unpack the count and tag fields from the packed atomic integer form. More...

Collaboration diagram for xrpl::IntrusiveRefCounts::RefCountPair:

Public Member Functions

 RefCountPair (FieldType v) noexcept
 RefCountPair (CountType s, CountType w) noexcept
FieldType combinedValue () const noexcept
 Convert back to the packed integer form.

Public Attributes

CountType strong
CountType weak
FieldType partialDestroyStartedBit {0}
 The partialDestroyStartedBit is set to on when the partial destroy function is started.
FieldType partialDestroyFinishedBit {0}
 The partialDestroyFinishedBit is set to on when the partial destroy function has finished.

Static Public Attributes

static constexpr CountType kMaxStrongValue
static constexpr CountType kMaxWeakValue
static constexpr CountType kCheckStrongMaxValue = kMaxStrongValue - 32
 Put an extra margin to detect when running up against limits.
static constexpr CountType kCheckWeakMaxValue = kMaxWeakValue - 32

Detailed Description

Unpack the count and tag fields from the packed atomic integer form.

Definition at line 191 of file IntrusiveRefCounts.h.

Constructor & Destructor Documentation

◆ RefCountPair() [1/2]

xrpl::IntrusiveRefCounts::RefCountPair::RefCountPair ( IntrusiveRefCounts::FieldType v)
noexcept

Definition at line 410 of file IntrusiveRefCounts.h.

◆ RefCountPair() [2/2]

xrpl::IntrusiveRefCounts::RefCountPair::RefCountPair ( IntrusiveRefCounts::CountType s,
IntrusiveRefCounts::CountType w )
noexcept

Definition at line 422 of file IntrusiveRefCounts.h.

Member Function Documentation

◆ combinedValue()

IntrusiveRefCounts::FieldType xrpl::IntrusiveRefCounts::RefCountPair::combinedValue ( ) const
nodiscardnoexcept

Convert back to the packed integer form.

Definition at line 434 of file IntrusiveRefCounts.h.

Member Data Documentation

◆ strong

CountType xrpl::IntrusiveRefCounts::RefCountPair::strong

Definition at line 193 of file IntrusiveRefCounts.h.

◆ weak

CountType xrpl::IntrusiveRefCounts::RefCountPair::weak

Definition at line 194 of file IntrusiveRefCounts.h.

◆ partialDestroyStartedBit

FieldType xrpl::IntrusiveRefCounts::RefCountPair::partialDestroyStartedBit {0}

The partialDestroyStartedBit is set to on when the partial destroy function is started.

It is not a boolean; it is a uint32 with all bits zero with the possible exception of the partialDestroyStartedMask bit. This is done so it can be directly masked into the combinedValue.

Definition at line 201 of file IntrusiveRefCounts.h.

◆ partialDestroyFinishedBit

FieldType xrpl::IntrusiveRefCounts::RefCountPair::partialDestroyFinishedBit {0}

The partialDestroyFinishedBit is set to on when the partial destroy function has finished.

Definition at line 205 of file IntrusiveRefCounts.h.

◆ kMaxStrongValue

CountType xrpl::IntrusiveRefCounts::RefCountPair::kMaxStrongValue
staticconstexpr
Initial value:
=
static_cast<CountType>((kOne << kStrongCountNumBits) - 1)
static constexpr FieldType kOne
static constexpr size_t kStrongCountNumBits

Definition at line 213 of file IntrusiveRefCounts.h.

◆ kMaxWeakValue

CountType xrpl::IntrusiveRefCounts::RefCountPair::kMaxWeakValue
staticconstexpr
Initial value:
=
static_cast<CountType>((kOne << kWeakCountNumBits) - 1)
static constexpr size_t kWeakCountNumBits

Definition at line 215 of file IntrusiveRefCounts.h.

◆ kCheckStrongMaxValue

CountType xrpl::IntrusiveRefCounts::RefCountPair::kCheckStrongMaxValue = kMaxStrongValue - 32
staticconstexpr

Put an extra margin to detect when running up against limits.

This is only used in debug code, and is useful if we reduce the number of bits in the strong and weak counts (to 16 and 14 bits).

Definition at line 221 of file IntrusiveRefCounts.h.

◆ kCheckWeakMaxValue

CountType xrpl::IntrusiveRefCounts::RefCountPair::kCheckWeakMaxValue = kMaxWeakValue - 32
staticconstexpr

Definition at line 222 of file IntrusiveRefCounts.h.