xrpld
Loading...
Searching...
No Matches
Condition.h
1#pragma once
2
3#include <xrpl/basics/Buffer.h>
4#include <xrpl/basics/Slice.h>
5#include <xrpl/conditions/detail/utils.h>
6
7#include <cstddef>
8#include <cstdint>
9#include <memory>
10#include <set>
11#include <system_error>
12#include <utility>
13
15
23
25{
26public:
35 static constexpr std::size_t kMaxSerializedCondition = 128;
36
50
51public:
53
61
66
71
73 {
74 }
75
76 Condition(Type t, std::uint32_t c, Buffer&& fp) : type(t), fingerprint(std::move(fp)), cost(c)
77 {
78 }
79
80 ~Condition() = default;
81
82 Condition(Condition const&) = default;
83 Condition(Condition&&) = default;
84
85 Condition() = delete;
86};
87
88inline bool
89operator==(Condition const& lhs, Condition const& rhs)
90{
91 return lhs.type == rhs.type && lhs.cost == rhs.cost && lhs.subtypes == rhs.subtypes &&
92 lhs.fingerprint == rhs.fingerprint;
93}
94
95} // namespace xrpl::cryptoconditions
Like std::vector<char> but better.
Definition Buffer.h:19
An immutable linear range of bytes.
Definition Slice.h:28
Buffer fingerprint
An identifier for this condition.
Definition Condition.h:60
std::set< Type > subtypes
For compound conditions, set of conditions includes.
Definition Condition.h:70
Condition(Condition &&)=default
static constexpr std::size_t kMaxSerializedCondition
The largest binary condition we support.
Definition Condition.h:35
Condition(Type t, std::uint32_t c, Buffer &&fp)
Definition Condition.h:76
std::uint32_t cost
The cost associated with this condition.
Definition Condition.h:65
Condition(Type t, std::uint32_t c, Slice fp)
Definition Condition.h:72
static std::unique_ptr< Condition > deserialize(Slice s, std::error_code &ec)
Load a condition from its binary form.
Condition(Condition const &)=default
STL namespace.
bool operator==(Condition const &lhs, Condition const &rhs)
Definition Condition.h:89