xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
protocol
STLedgerEntry.h
1
#pragma once
2
3
#include <xrpl/basics/CountedObject.h>
4
#include <xrpl/basics/base_uint.h>
5
#include <xrpl/json/json_value.h>
6
#include <xrpl/protocol/Keylet.h>
7
#include <xrpl/protocol/LedgerFormats.h>
8
#include <xrpl/protocol/SField.h>
9
#include <xrpl/protocol/STBase.h>
10
#include <xrpl/protocol/STObject.h>
11
#include <xrpl/protocol/Serializer.h>
12
13
#include <
cstddef
>
14
#include <
cstdint
>
15
#include <
memory
>
16
#include <
string
>
17
18
namespace
xrpl
{
19
20
class
Rules
;
21
namespace
test
{
22
class
InvariantsMisc_test
;
23
}
// namespace test
24
28
class
STLedgerEntry
final :
public
STObject
,
public
CountedObject
<STLedgerEntry>
29
{
30
UInt256
key_
;
31
LedgerEntryType
type_
;
32
33
public
:
34
using
pointer
=
std::shared_ptr<STLedgerEntry>
;
35
using
Ref
=
std::shared_ptr<STLedgerEntry>
const
&;
36
using
const_pointer
=
std::shared_ptr<STLedgerEntry const>
;
37
using
ConstRef
=
std::shared_ptr<STLedgerEntry const>
const
&;
38
42
explicit
STLedgerEntry
(
Keylet
const
& k);
43
STLedgerEntry
(
LedgerEntryType
type,
UInt256
const
&
key
);
44
STLedgerEntry
(
SerialIter
& sit,
UInt256
const
& index);
45
STLedgerEntry
(
SerialIter
&& sit,
UInt256
const
& index);
46
STLedgerEntry
(
STObject
const
&
object
,
UInt256
const
& index);
47
48
[[nodiscard]]
SerializedTypeID
49
getSType
()
const override
;
50
51
[[nodiscard]]
std::string
52
getFullText
()
const override
;
53
54
[[nodiscard]]
std::string
55
getText
()
const override
;
56
57
[[nodiscard]]
json::Value
58
getJson
(
JsonOptions
options =
JsonOptions::Values::None
)
const override
;
59
65
[[nodiscard]]
UInt256
const
&
66
key
()
const
;
67
68
[[nodiscard]]
LedgerEntryType
69
getType
()
const
;
70
71
// is this a ledger entry that can be threaded
72
[[nodiscard]]
bool
73
isThreadedType
(
Rules
const
& rules)
const
;
74
75
bool
76
thread
(
77
UInt256
const
& txID,
78
std::uint32_t
ledgerSeq,
79
UInt256
& prevTxID,
80
std::uint32_t
& prevLedgerID);
81
82
private
:
83
/* Make STObject comply with the template for this SLE type
84
Can throw
85
*/
86
void
87
setSLEType
();
88
89
friend
test::InvariantsMisc_test
;
// this test wants access to the
90
// private type_
91
92
STBase
*
93
copy
(
std::size_t
n,
void
* buf)
const override
;
94
STBase
*
95
move
(
std::size_t
n,
void
* buf)
override
;
96
97
friend
class
detail::STVar
;
98
};
99
100
using
SLE
=
STLedgerEntry
;
101
102
inline
STLedgerEntry::STLedgerEntry
(
LedgerEntryType
type,
UInt256
const
&
key
)
103
:
STLedgerEntry
(
Keylet
(type,
key
))
104
{
105
}
106
107
inline
STLedgerEntry::STLedgerEntry
(
108
SerialIter
&& sit,
// NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved)
109
UInt256
const
& index)
110
:
STLedgerEntry
(sit, index)
111
{
112
}
113
119
inline
UInt256
const
&
120
STLedgerEntry::key
()
const
121
{
122
return
key_
;
123
}
124
125
inline
LedgerEntryType
126
STLedgerEntry::getType
()
const
127
{
128
return
type_
;
129
}
130
131
}
// namespace xrpl
std::string
json::Value
Represents a JSON value.
Definition
json_value.h:117
xrpl::CountedObject< STLedgerEntry >::CountedObject
CountedObject() noexcept
Definition
CountedObject.h:119
xrpl::Rules
Rules controlling protocol behavior.
Definition
Rules.h:40
xrpl::STBase
A type which can be exported to a well known binary format.
Definition
STBase.h:129
xrpl::STLedgerEntry
A serialized ledger entry, commonly abbreviated "SLE".
Definition
STLedgerEntry.h:29
xrpl::STLedgerEntry::type_
LedgerEntryType type_
Definition
STLedgerEntry.h:31
xrpl::STLedgerEntry::thread
bool thread(UInt256 const &txID, std::uint32_t ledgerSeq, UInt256 &prevTxID, std::uint32_t &prevLedgerID)
Definition
STLedgerEntry.cpp:144
xrpl::STLedgerEntry::key
UInt256 const & key() const
Returns the 'key' (or 'index') of this item.
Definition
STLedgerEntry.h:120
xrpl::STLedgerEntry::pointer
std::shared_ptr< STLedgerEntry > pointer
Definition
STLedgerEntry.h:34
xrpl::STLedgerEntry::getFullText
std::string getFullText() const override
Definition
STLedgerEntry.cpp:74
xrpl::STLedgerEntry::copy
STBase * copy(std::size_t n, void *buf) const override
Definition
STLedgerEntry.cpp:92
xrpl::STLedgerEntry::key_
UInt256 key_
Definition
STLedgerEntry.h:30
xrpl::STLedgerEntry::getType
LedgerEntryType getType() const
Definition
STLedgerEntry.h:126
xrpl::STLedgerEntry::getSType
SerializedTypeID getSType() const override
Definition
STLedgerEntry.cpp:104
xrpl::STLedgerEntry::ConstRef
std::shared_ptr< STLedgerEntry const > const & ConstRef
Definition
STLedgerEntry.h:37
xrpl::STLedgerEntry::Ref
std::shared_ptr< STLedgerEntry > const & Ref
Definition
STLedgerEntry.h:35
xrpl::STLedgerEntry::STLedgerEntry
STLedgerEntry(Keylet const &k)
Create an empty object with the given key and type.
Definition
STLedgerEntry.cpp:32
xrpl::STLedgerEntry::getText
std::string getText() const override
Definition
STLedgerEntry.cpp:110
xrpl::STLedgerEntry::isThreadedType
bool isThreadedType(Rules const &rules) const
Definition
STLedgerEntry.cpp:132
xrpl::STLedgerEntry::move
STBase * move(std::size_t n, void *buf) override
Definition
STLedgerEntry.cpp:98
xrpl::STLedgerEntry::getJson
json::Value getJson(JsonOptions options=JsonOptions::Values::None) const override
Definition
STLedgerEntry.cpp:116
xrpl::STLedgerEntry::const_pointer
std::shared_ptr< STLedgerEntry const > const_pointer
Definition
STLedgerEntry.h:36
xrpl::STLedgerEntry::setSLEType
void setSLEType()
Definition
STLedgerEntry.cpp:61
xrpl::STObject::STObject
STObject(STObject const &)=default
xrpl::SerialIter
Definition
Serializer.h:478
xrpl::detail::STVar
Definition
STVar.h:36
xrpl::test::InvariantsMisc_test
Definition
InvariantsMisc_test.cpp:62
cstddef
cstdint
std::uint32_t
memory
xrpl::test
Definition
STLedgerEntry.h:21
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::SLE
STLedgerEntry SLE
Definition
ServiceRegistry.h:42
xrpl::UInt256
BaseUInt< 256 > UInt256
Definition
base_uint.h:580
xrpl::SerializedTypeID
SerializedTypeID
Definition
SField.h:94
xrpl::LedgerEntryType
LedgerEntryType
Identifiers for on-ledger objects.
Definition
LedgerFormats.h:40
std::shared_ptr
std::size_t
string
xrpl::JsonOptions
Note, should be treated as flags that can be | and &.
Definition
STBase.h:22
xrpl::JsonOptions::Values::None
@ None
Definition
STBase.h:27
xrpl::Keylet
A pair of SHAMap key and LedgerEntryType.
Definition
Keylet.h:20
Generated by
1.17.0