rippled
Loading...
Searching...
No Matches
STVector256.h
1#pragma once
2
3#include <xrpl/basics/CountedObject.h>
4#include <xrpl/protocol/STBase.h>
5#include <xrpl/protocol/STBitString.h>
6#include <xrpl/protocol/STInteger.h>
7
8namespace xrpl {
9
10class STVector256 : public STBase, public CountedObject<STVector256>
11{
13
14public:
16
17 STVector256() = default;
18
19 explicit STVector256(SField const& n);
20 explicit STVector256(std::vector<uint256> const& vector);
21 STVector256(SField const& n, std::vector<uint256> const& vector);
22 STVector256(SerialIter& sit, SField const& name);
23
25 getSType() const override;
26
27 void
28 add(Serializer& s) const override;
29
30 Json::Value getJson(JsonOptions) const override;
31
32 bool
33 isEquivalent(STBase const& t) const override;
34
35 bool
36 isDefault() const override;
37
40
43
44 void
45 setValue(STVector256 const& v);
46
48 explicit
49 operator std::vector<uint256>() const;
50
52 size() const;
53
54 void
56
57 bool
58 empty() const;
59
62
65
67 value() const;
68
71
74
75 void
76 push_back(uint256 const& v);
77
79 begin();
80
82 begin() const;
83
85 end();
86
88 end() const;
89
92
93 void
94 clear() noexcept;
95
96private:
97 STBase*
98 copy(std::size_t n, void* buf) const override;
99 STBase*
100 move(std::size_t n, void* buf) override;
101
102 friend class detail::STVar;
103};
104
105inline STVector256::STVector256(SField const& n) : STBase(n)
106{
107}
108
110{
111}
112
113inline STVector256::STVector256(SField const& n, std::vector<uint256> const& vector) : STBase(n), mValue(vector)
114{
115}
116
117inline STVector256&
119{
120 mValue = v;
121 return *this;
122}
123
124inline STVector256&
126{
127 mValue = std::move(v);
128 return *this;
129}
130
131inline void
133{
134 mValue = v.mValue;
135}
136
138inline STVector256::operator std::vector<uint256>() const
139{
140 return mValue;
141}
142
143inline std::size_t
145{
146 return mValue.size();
147}
148
149inline void
151{
152 return mValue.resize(n);
153}
154
155inline bool
157{
158 return mValue.empty();
159}
160
166
172
173inline std::vector<uint256> const&
175{
176 return mValue;
177}
178
184
187{
188 return mValue.insert(pos, std::move(value));
189}
190
191inline void
193{
194 mValue.push_back(v);
195}
196
199{
200 return mValue.begin();
201}
202
205{
206 return mValue.begin();
207}
208
211{
212 return mValue.end();
213}
214
217{
218 return mValue.end();
219}
220
223{
224 return mValue.erase(position);
225}
226
227inline void
229{
230 return mValue.clear();
231}
232
233} // namespace xrpl
T begin(T... args)
Represents a JSON value.
Definition json_value.h:130
Tracks the number of instances of an object.
Identifies fields.
Definition SField.h:126
A type which can be exported to a well known binary format.
Definition STBase.h:115
std::vector< uint256 >::iterator erase(std::vector< uint256 >::iterator position)
void clear() noexcept
void setValue(STVector256 const &v)
std::size_t size() const
void add(Serializer &s) const override
void resize(std::size_t n)
bool empty() const
bool isEquivalent(STBase const &t) const override
friend class detail::STVar
std::vector< uint256 >::iterator insert(std::vector< uint256 >::const_iterator pos, uint256 const &value)
std::vector< uint256 > const & value() const
STBase * move(std::size_t n, void *buf) override
std::vector< uint256 > mValue
Definition STVector256.h:12
SerializedTypeID getSType() const override
std::vector< uint256 >::iterator begin()
STVector256()=default
STVector256 & operator=(std::vector< uint256 > const &v)
std::vector< uint256 >::reference operator[](std::vector< uint256 >::size_type n)
bool isDefault() const override
void push_back(uint256 const &v)
STBase * copy(std::size_t n, void *buf) const override
std::vector< uint256 >::iterator end()
Json::Value getJson(JsonOptions) const override
T end(T... args)
T erase(T... args)
T insert(T... args)
STL namespace.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
SerializedTypeID
Definition SField.h:90
Note, should be treated as flags that can be | and &.
Definition STBase.h:17