rippled
Loading...
Searching...
No Matches
STLedgerEntry.h
1#ifndef XRPL_PROTOCOL_STLEDGERENTRY_H_INCLUDED
2#define XRPL_PROTOCOL_STLEDGERENTRY_H_INCLUDED
3
4#include <xrpl/protocol/Indexes.h>
5#include <xrpl/protocol/STObject.h>
6
7namespace ripple {
8
9class Rules;
10namespace test {
11class Invariants_test;
12}
13
14class STLedgerEntry final : public STObject, public CountedObject<STLedgerEntry>
15{
18
19public:
24
26 explicit STLedgerEntry(Keylet const& k);
28 STLedgerEntry(SerialIter& sit, uint256 const& index);
29 STLedgerEntry(SerialIter&& sit, uint256 const& index);
30 STLedgerEntry(STObject const& object, uint256 const& index);
31
33 getSType() const override;
34
36 getFullText() const override;
37
39 getText() const override;
40
42 getJson(JsonOptions options = JsonOptions::none) const override;
43
48 uint256 const&
49 key() const;
50
52 getType() const;
53
54 // is this a ledger entry that can be threaded
55 bool
56 isThreadedType(Rules const& rules) const;
57
58 bool
59 thread(
60 uint256 const& txID,
61 std::uint32_t ledgerSeq,
62 uint256& prevTxID,
63 std::uint32_t& prevLedgerID);
64
65private:
66 /* Make STObject comply with the template for this SLE type
67 Can throw
68 */
69 void
70 setSLEType();
71
72 friend test::Invariants_test; // this test wants access to the private
73 // type_
74
75 STBase*
76 copy(std::size_t n, void* buf) const override;
77 STBase*
78 move(std::size_t n, void* buf) override;
79
80 friend class detail::STVar;
81};
82
84
86 : STLedgerEntry(Keylet(type, key))
87{
88}
89
91 : STLedgerEntry(sit, index)
92{
93}
94
99inline uint256 const&
101{
102 return key_;
103}
104
105inline LedgerEntryType
107{
108 return type_;
109}
110
111} // namespace ripple
112
113#endif
Represents a JSON value.
Definition json_value.h:131
Tracks the number of instances of an object.
Rules controlling protocol behavior.
Definition Rules.h:19
A type which can be exported to a well known binary format.
Definition STBase.h:116
STBase * move(std::size_t n, void *buf) override
STLedgerEntry(Keylet const &k)
Create an empty object with the given key and type.
LedgerEntryType getType() const
SerializedTypeID getSType() const override
std::string getFullText() const override
LedgerEntryType type_
bool thread(uint256 const &txID, std::uint32_t ledgerSeq, uint256 &prevTxID, std::uint32_t &prevLedgerID)
Json::Value getJson(JsonOptions options=JsonOptions::none) const override
STBase * copy(std::size_t n, void *buf) const override
bool isThreadedType(Rules const &rules) const
uint256 const & key() const
Returns the 'key' (or 'index') of this item.
std::string getText() const override
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
SerializedTypeID
Definition SField.h:91
LedgerEntryType
Identifiers for on-ledger objects.
Note, should be treated as flags that can be | and &.
Definition STBase.h:18
A pair of SHAMap key and LedgerEntryType.
Definition Keylet.h:20