xrpld
Loading...
Searching...
No Matches
xrpl::SHAMapNodeID Class Reference

Identifies a node inside a SHAMap. More...

#include <SHAMapNodeID.h>

Inheritance diagram for xrpl::SHAMapNodeID:
Collaboration diagram for xrpl::SHAMapNodeID:

Public Member Functions

 SHAMapNodeID ()=default
 SHAMapNodeID (SHAMapNodeID const &other)=default
 SHAMapNodeID (unsigned int depth, uint256 const &hash)
SHAMapNodeIDoperator= (SHAMapNodeID const &other)=default
bool isRoot () const
std::string getRawString () const
unsigned int getDepth () const
uint256 const & getNodeID () const
SHAMapNodeID getChildNodeID (unsigned int m) const
std::strong_ordering operator<=> (SHAMapNodeID const &n) const
 Comparison operators.
bool operator== (SHAMapNodeID const &n) const
 Equality, which the spaceship above does not provide.

Static Public Member Functions

static SHAMapNodeID createID (int depth, uint256 const &key)
 Create a SHAMapNodeID of a node with the depth of the node and the key of a leaf.

Public Attributes

friend Object

Static Private Member Functions

static auto & getCounter () noexcept

Private Attributes

uint256 id_
unsigned int depth_ = 0

Detailed Description

Identifies a node inside a SHAMap.

Definition at line 19 of file SHAMapNodeID.h.

Constructor & Destructor Documentation

◆ SHAMapNodeID() [1/3]

xrpl::SHAMapNodeID::SHAMapNodeID ( )
default

◆ SHAMapNodeID() [2/3]

xrpl::SHAMapNodeID::SHAMapNodeID ( SHAMapNodeID const & other)
default

◆ SHAMapNodeID() [3/3]

xrpl::SHAMapNodeID::SHAMapNodeID ( unsigned int depth,
uint256 const & hash )

Definition at line 44 of file SHAMapNodeID.cpp.

Member Function Documentation

◆ operator=()

SHAMapNodeID & xrpl::SHAMapNodeID::operator= ( SHAMapNodeID const & other)
default

◆ isRoot()

bool xrpl::SHAMapNodeID::isRoot ( ) const
nodiscard

Definition at line 34 of file SHAMapNodeID.h.

◆ getRawString()

std::string xrpl::SHAMapNodeID::getRawString ( ) const
nodiscard

Definition at line 54 of file SHAMapNodeID.cpp.

◆ getDepth()

unsigned int xrpl::SHAMapNodeID::getDepth ( ) const
nodiscard

Definition at line 44 of file SHAMapNodeID.h.

◆ getNodeID()

uint256 const & xrpl::SHAMapNodeID::getNodeID ( ) const
nodiscard

Definition at line 50 of file SHAMapNodeID.h.

◆ getChildNodeID()

SHAMapNodeID xrpl::SHAMapNodeID::getChildNodeID ( unsigned int m) const
nodiscard

Definition at line 63 of file SHAMapNodeID.cpp.

◆ createID()

SHAMapNodeID xrpl::SHAMapNodeID::createID ( int depth,
uint256 const & key )
static

Create a SHAMapNodeID of a node with the depth of the node and the key of a leaf.

Parameters
depththe depth of the node
keythe key of a leaf
Returns
SHAMapNodeID of the node

Definition at line 130 of file SHAMapNodeID.cpp.

◆ operator<=>()

std::strong_ordering xrpl::SHAMapNodeID::operator<=> ( SHAMapNodeID const & n) const

Comparison operators.

<, >, <= and >= are synthesized from the spaceship. It is written out rather than defaulted because the ordering is by depth first, and the members are not declared in that order.

Definition at line 76 of file SHAMapNodeID.h.

◆ operator==()

bool xrpl::SHAMapNodeID::operator== ( SHAMapNodeID const & n) const

Equality, which the spaceship above does not provide.

Only a defaulted operator<=> implicitly declares a defaulted operator==; the one above is user-provided, so == has to be written. It cannot be defaulted either, because a defaulted == would also compare the CountedObject base, which is not equality comparable.

Definition at line 91 of file SHAMapNodeID.h.

◆ getCounter()

auto & xrpl::CountedObject< SHAMapNodeID >::getCounter ( )
staticprivatenoexceptinherited

Definition at line 113 of file CountedObject.h.

Member Data Documentation

◆ id_

uint256 xrpl::SHAMapNodeID::id_
private

Definition at line 22 of file SHAMapNodeID.h.

◆ depth_

unsigned int xrpl::SHAMapNodeID::depth_ = 0
private

Definition at line 23 of file SHAMapNodeID.h.

◆ Object

Definition at line 138 of file CountedObject.h.