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