xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
shamap
SHAMapMissingNode.h
1
#pragma once
2
3
#include <xrpl/basics/SHAMapHash.h>
4
#include <xrpl/basics/base_uint.h>
5
#include <xrpl/basics/safe_cast.h>
6
7
#include <
stdexcept
>
8
#include <
string
>
9
#include <
type_traits
>
10
11
namespace
xrpl
{
12
13
enum class
SHAMapType
{
14
TRANSACTION = 1,
// A tree of transactions
15
STATE
= 2,
// A tree of state nodes
16
FREE
= 3,
// A tree not part of a ledger
17
};
18
19
inline
std::string
20
to_string
(
SHAMapType
t)
21
{
22
switch
(t)
23
{
24
case
SHAMapType::TRANSACTION
:
25
return
"Transaction Tree"
;
26
case
SHAMapType::STATE
:
27
return
"State Tree"
;
28
case
SHAMapType::FREE
:
29
return
"Free Tree"
;
30
default
:
31
return
std::to_string
(
safeCast
<
std::underlying_type_t<SHAMapType>
>(t));
32
}
33
}
34
35
class
SHAMapMissingNode
:
public
std::runtime_error
36
{
37
public
:
38
SHAMapMissingNode
(
SHAMapType
t,
SHAMapHash
const
& hash)
39
:
std
::
runtime_error
(
"Missing Node: "
+
to_string
(t) +
": hash "
+
to_string
(hash))
40
{
41
}
42
43
SHAMapMissingNode
(
SHAMapType
t,
UInt256
const
&
id
)
44
:
std
::
runtime_error
(
"Missing Node: "
+
to_string
(t) +
": id "
+
to_string
(id))
45
{
46
}
47
};
48
49
}
// namespace xrpl
std::string
xrpl::SHAMapHash
Definition
SHAMapHash.h:16
xrpl::SHAMapMissingNode::SHAMapMissingNode
SHAMapMissingNode(SHAMapType t, UInt256 const &id)
Definition
SHAMapMissingNode.h:43
xrpl::SHAMapMissingNode::SHAMapMissingNode
SHAMapMissingNode(SHAMapType t, SHAMapHash const &hash)
Definition
SHAMapMissingNode.h:38
std
STL namespace.
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::safeCast
constexpr Dest safeCast(Src s) noexcept
Definition
safe_cast.h:21
xrpl::to_string
std::string to_string(BaseUInt< Bits, Tag > const &a)
Definition
base_uint.h:657
xrpl::UInt256
BaseUInt< 256 > UInt256
Definition
base_uint.h:580
xrpl::SHAMapType
SHAMapType
Definition
SHAMapMissingNode.h:13
xrpl::SHAMapType::STATE
@ STATE
Definition
SHAMapMissingNode.h:15
xrpl::SHAMapType::FREE
@ FREE
Definition
SHAMapMissingNode.h:16
xrpl::SHAMapType::TRANSACTION
@ TRANSACTION
Definition
SHAMapMissingNode.h:14
std::runtime_error
stdexcept
string
std::to_string
T to_string(T... args)
type_traits
std::underlying_type_t
Generated by
1.17.0