rippled
Loading...
Searching...
No Matches
STVector256.h
1#ifndef XRPL_PROTOCOL_STVECTOR256_H_INCLUDED
2#define XRPL_PROTOCOL_STVECTOR256_H_INCLUDED
3
4#include <xrpl/basics/CountedObject.h>
5#include <xrpl/protocol/STBase.h>
6#include <xrpl/protocol/STBitString.h>
7#include <xrpl/protocol/STInteger.h>
8
9namespace ripple {
10
11class STVector256 : public STBase, public CountedObject<STVector256>
12{
14
15public:
17
18 STVector256() = default;
19
20 explicit STVector256(SField const& n);
21 explicit STVector256(std::vector<uint256> const& vector);
22 STVector256(SField const& n, std::vector<uint256> const& vector);
23 STVector256(SerialIter& sit, SField const& name);
24
26 getSType() const override;
27
28 void
29 add(Serializer& s) const override;
30
31 Json::Value getJson(JsonOptions) const override;
32
33 bool
34 isEquivalent(STBase const& t) const override;
35
36 bool
37 isDefault() const override;
38
41
44
45 void
46 setValue(STVector256 const& v);
47
49 explicit
50 operator std::vector<uint256>() const;
51
53 size() const;
54
55 void
57
58 bool
59 empty() const;
60
63
66
68 value() const;
69
72
75
76 void
77 push_back(uint256 const& v);
78
80 begin();
81
83 begin() const;
84
86 end();
87
89 end() const;
90
93
94 void
95 clear() noexcept;
96
97private:
98 STBase*
99 copy(std::size_t n, void* buf) const override;
100 STBase*
101 move(std::size_t n, void* buf) override;
102
103 friend class detail::STVar;
104};
105
106inline STVector256::STVector256(SField const& n) : STBase(n)
107{
108}
109
111 : mValue(vector)
112{
113}
114
116 SField const& n,
117 std::vector<uint256> const& vector)
118 : STBase(n), mValue(vector)
119{
120}
121
122inline STVector256&
124{
125 mValue = v;
126 return *this;
127}
128
129inline STVector256&
131{
132 mValue = std::move(v);
133 return *this;
134}
135
136inline void
138{
139 mValue = v.mValue;
140}
141
143inline STVector256::operator std::vector<uint256>() const
144{
145 return mValue;
146}
147
148inline std::size_t
150{
151 return mValue.size();
152}
153
154inline void
156{
157 return mValue.resize(n);
158}
159
160inline bool
162{
163 return mValue.empty();
164}
165
171
177
178inline std::vector<uint256> const&
180{
181 return mValue;
182}
183
187 uint256 const& value)
188{
189 return mValue.insert(pos, value);
190}
191
194{
195 return mValue.insert(pos, std::move(value));
196}
197
198inline void
200{
201 mValue.push_back(v);
202}
203
206{
207 return mValue.begin();
208}
209
212{
213 return mValue.begin();
214}
215
218{
219 return mValue.end();
220}
221
224{
225 return mValue.end();
226}
227
230{
231 return mValue.erase(position);
232}
233
234inline void
236{
237 return mValue.clear();
238}
239
240} // namespace ripple
241
242#endif
T begin(T... args)
Represents a JSON value.
Definition json_value.h:131
Tracks the number of instances of an object.
Identifies fields.
Definition SField.h:127
A type which can be exported to a well known binary format.
Definition STBase.h:116
void resize(std::size_t n)
std::vector< uint256 > const & value() const
std::vector< uint256 >::iterator begin()
STVector256 & operator=(std::vector< uint256 > const &v)
void add(Serializer &s) const override
SerializedTypeID getSType() const override
void clear() noexcept
std::vector< uint256 >::iterator erase(std::vector< uint256 >::iterator position)
Json::Value getJson(JsonOptions) const override
STBase * copy(std::size_t n, void *buf) const override
bool isDefault() const override
std::size_t size() const
friend class detail::STVar
bool isEquivalent(STBase const &t) const override
void push_back(uint256 const &v)
void setValue(STVector256 const &v)
STBase * move(std::size_t n, void *buf) override
std::vector< uint256 >::reference operator[](std::vector< uint256 >::size_type n)
std::vector< uint256 >::iterator insert(std::vector< uint256 >::const_iterator pos, uint256 const &value)
bool empty() const
std::vector< uint256 > mValue
Definition STVector256.h:13
std::vector< uint256 >::iterator end()
T end(T... args)
T erase(T... args)
T insert(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
SerializedTypeID
Definition SField.h:91
STL namespace.
Note, should be treated as flags that can be | and &.
Definition STBase.h:18