xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
protocol
STVector256.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/SField.h>
7
#include <xrpl/protocol/STBase.h>
8
#include <xrpl/protocol/Serializer.h>
9
10
#include <
cstddef
>
11
#include <
utility
>
12
#include <
vector
>
13
14
namespace
xrpl
{
15
16
class
STVector256
:
public
STBase
,
public
CountedObject
<STVector256>
17
{
18
std::vector<UInt256>
value_
;
19
20
public
:
21
using
value_type
=
std::vector<UInt256>
const
&;
22
23
STVector256
() =
default
;
24
25
explicit
STVector256
(
SField
const
& n);
26
explicit
STVector256
(
std::vector<UInt256>
vector);
27
STVector256
(
SField
const
& n,
std::vector<UInt256>
vector);
28
STVector256
(
SerialIter
& sit,
SField
const
& name);
29
30
[[nodiscard]]
SerializedTypeID
31
getSType
()
const override
;
32
33
void
34
add
(
Serializer
& s)
const override
;
35
36
[[nodiscard]]
json::Value
getJson
(
JsonOptions
)
const override
;
37
38
[[nodiscard]]
bool
39
isEquivalent
(
STBase
const
& t)
const override
;
40
41
[[nodiscard]]
bool
42
isDefault
()
const override
;
43
44
STVector256
&
45
operator=
(
std::vector<UInt256>
const
& v);
46
47
STVector256
&
48
operator=
(
std::vector<UInt256>
&& v);
49
50
void
51
setValue
(
STVector256
const
& v);
52
56
explicit
57
operator
std::vector<UInt256>
()
const
;
58
59
[[nodiscard]]
std::size_t
60
size
()
const
;
61
62
void
63
resize
(
std::size_t
n);
64
65
[[nodiscard]]
bool
66
empty
()
const
;
67
68
std::vector<UInt256>::reference
69
operator[]
(
std::vector<UInt256>::size_type
n);
70
71
std::vector<UInt256>::const_reference
72
operator[]
(
std::vector<UInt256>::size_type
n)
const
;
73
74
[[nodiscard]]
std::vector<UInt256>
const
&
75
value
()
const
;
76
77
std::vector<UInt256>::iterator
78
insert
(std::vector<UInt256>::const_iterator pos,
UInt256
const
&
value
);
79
80
void
81
pushBack
(
UInt256
const
& v);
82
83
std::vector<UInt256>::iterator
84
begin
();
85
86
[[nodiscard]] std::vector<UInt256>::const_iterator
87
begin
()
const
;
88
89
std::vector<UInt256>::iterator
90
end
();
91
92
[[nodiscard]] std::vector<UInt256>::const_iterator
93
end
()
const
;
94
95
std::vector<UInt256>::iterator
96
erase
(std::vector<UInt256>::iterator position);
97
98
void
99
clear
() noexcept;
100
101
private:
102
STBase
*
103
copy
(
std
::
size_t
n,
void
* buf) const override;
104
STBase
*
105
move
(
std
::
size_t
n,
void
* buf) override;
106
107
friend class
detail
::
STVar
;
108
};
109
110
inline
STVector256
::
STVector256
(
SField
const& n) :
STBase
(n)
111
{
112
}
113
114
inline
STVector256::STVector256
(
std::vector<UInt256>
vector) :
value_
(
std
::
move
(vector))
115
{
116
}
117
118
inline
STVector256::STVector256
(
SField
const
& n,
std::vector<UInt256>
vector)
119
:
STBase
(n),
value_
(
std
::
move
(vector))
120
{
121
}
122
123
inline
STVector256
&
124
STVector256::operator=
(
std::vector<UInt256>
const
& v)
125
{
126
value_
= v;
127
return
*
this
;
128
}
129
130
inline
STVector256
&
131
STVector256::operator=
(
std::vector<UInt256>
&& v)
132
{
133
value_
= std::move(v);
134
return
*
this
;
135
}
136
137
inline
void
138
STVector256::setValue
(
STVector256
const
& v)
139
{
140
value_
= v.
value_
;
141
}
142
146
inline
STVector256::
147
operator
std::vector<UInt256>
()
const
148
{
149
return
value_
;
150
}
151
152
inline
std::size_t
153
STVector256::size
()
const
154
{
155
return
value_
.size();
156
}
157
158
inline
void
159
STVector256::resize
(
std::size_t
n)
160
{
161
value_
.resize(n);
162
}
163
164
inline
bool
165
STVector256::empty
()
const
166
{
167
return
value_
.empty();
168
}
169
170
inline
std::vector<UInt256>::reference
171
STVector256::operator[]
(
std::vector<UInt256>::size_type
n)
172
{
173
return
value_
[n];
174
}
175
176
inline
std::vector<UInt256>::const_reference
177
STVector256::operator[]
(
std::vector<UInt256>::size_type
n)
const
178
{
179
return
value_
[n];
180
}
181
182
inline
std::vector<UInt256>
const
&
183
STVector256::value
()
const
184
{
185
return
value_
;
186
}
187
188
inline
std::vector<UInt256>::iterator
189
STVector256::insert
(std::vector<UInt256>::const_iterator pos,
UInt256
const
&
value
)
190
{
191
return
value_
.insert(pos,
value
);
192
}
193
194
inline
void
195
STVector256::pushBack
(
UInt256
const
& v)
196
{
197
value_
.push_back(v);
198
}
199
200
inline
std::vector<UInt256>::iterator
201
STVector256::begin
()
202
{
203
return
value_
.begin();
204
}
205
206
inline
std::vector<UInt256>::const_iterator
207
STVector256::begin
()
const
208
{
209
return
value_
.begin();
210
}
211
212
inline
std::vector<UInt256>::iterator
213
STVector256::end
()
214
{
215
return
value_
.end();
216
}
217
218
inline
std::vector<UInt256>::const_iterator
219
STVector256::end
()
const
220
{
221
return
value_
.end();
222
}
223
224
inline
std::vector<UInt256>::iterator
225
STVector256::erase
(std::vector<UInt256>::iterator position)
226
{
227
return
value_
.erase(position);
228
}
229
230
inline
void
231
STVector256::clear
() noexcept
232
{
233
value_
.clear();
234
}
235
236
}
// namespace xrpl
json::Value
Represents a JSON value.
Definition
json_value.h:117
xrpl::CountedObject< STVector256 >::CountedObject
CountedObject() noexcept
Definition
CountedObject.h:119
xrpl::SField
Identifies fields.
Definition
SField.h:132
xrpl::STBase::STBase
STBase()
Definition
STBase.cpp:15
xrpl::STVector256
Definition
STVector256.h:17
xrpl::STVector256::value
std::vector< UInt256 > const & value() const
Definition
STVector256.h:183
xrpl::STVector256::getJson
json::Value getJson(JsonOptions) const override
Definition
STVector256.cpp:76
xrpl::STVector256::clear
void clear() noexcept
Definition
STVector256.h:231
xrpl::STVector256::setValue
void setValue(STVector256 const &v)
Definition
STVector256.h:138
xrpl::STVector256::size
std::size_t size() const
Definition
STVector256.h:153
xrpl::STVector256::add
void add(Serializer &s) const override
Definition
STVector256.cpp:61
xrpl::STVector256::insert
std::vector< UInt256 >::iterator insert(std::vector< UInt256 >::const_iterator pos, UInt256 const &value)
Definition
STVector256.h:189
xrpl::STVector256::resize
void resize(std::size_t n)
Definition
STVector256.h:159
xrpl::STVector256::empty
bool empty() const
Definition
STVector256.h:165
xrpl::STVector256::isEquivalent
bool isEquivalent(STBase const &t) const override
Definition
STVector256.cpp:69
xrpl::STVector256::STVar
friend class detail::STVar
Definition
STVector256.h:107
xrpl::STVector256::end
std::vector< UInt256 >::iterator end()
Definition
STVector256.h:213
xrpl::STVector256::move
STBase * move(std::size_t n, void *buf) override
Definition
STVector256.cpp:43
xrpl::STVector256::operator=
STVector256 & operator=(std::vector< UInt256 > const &v)
Definition
STVector256.h:124
xrpl::STVector256::pushBack
void pushBack(UInt256 const &v)
Definition
STVector256.h:195
xrpl::STVector256::getSType
SerializedTypeID getSType() const override
Definition
STVector256.cpp:49
xrpl::STVector256::value_
std::vector< UInt256 > value_
Definition
STVector256.h:18
xrpl::STVector256::STVector256
STVector256()=default
xrpl::STVector256::isDefault
bool isDefault() const override
Definition
STVector256.cpp:55
xrpl::STVector256::erase
std::vector< UInt256 >::iterator erase(std::vector< UInt256 >::iterator position)
Definition
STVector256.h:225
xrpl::STVector256::begin
std::vector< UInt256 >::iterator begin()
Definition
STVector256.h:201
xrpl::STVector256::copy
STBase * copy(std::size_t n, void *buf) const override
Definition
STVector256.cpp:37
xrpl::STVector256::operator[]
std::vector< UInt256 >::reference operator[](std::vector< UInt256 >::size_type n)
Definition
STVector256.h:171
xrpl::STVector256::value_type
std::vector< UInt256 > const & value_type
Definition
STVector256.h:21
xrpl::SerialIter
Definition
Serializer.h:478
xrpl::Serializer
Definition
Serializer.h:23
cstddef
std
STL namespace.
xrpl::detail
Definition
base_uint.h:37
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::UInt256
BaseUInt< 256 > UInt256
Definition
base_uint.h:580
xrpl::SerializedTypeID
SerializedTypeID
Definition
SField.h:94
std::size_t
xrpl::JsonOptions
Note, should be treated as flags that can be | and &.
Definition
STBase.h:22
utility
vector
Generated by
1.17.0