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
72 void
73 push_back(uint256 const& v);
74
76 begin();
77
79 begin() const;
80
82 end();
83
85 end() const;
86
89
90 void
91 clear() noexcept;
92
93private:
94 STBase*
95 copy(std::size_t n, void* buf) const override;
96 STBase*
97 move(std::size_t n, void* buf) override;
98
99 friend class detail::STVar;
100};
101
102inline STVector256::STVector256(SField const& n) : STBase(n)
103{
104}
105
107{
108}
109
111 : STBase(n), mValue(vector)
112{
113}
114
115inline STVector256&
117{
118 mValue = v;
119 return *this;
120}
121
122inline STVector256&
124{
125 mValue = std::move(v);
126 return *this;
127}
128
129inline void
131{
132 mValue = v.mValue;
133}
134
136inline STVector256::
137operator std::vector<uint256>() const
138{
139 return mValue;
140}
141
142inline std::size_t
144{
145 return mValue.size();
146}
147
148inline void
150{
151 return mValue.resize(n);
152}
153
154inline bool
156{
157 return mValue.empty();
158}
159
165
171
172inline std::vector<uint256> const&
174{
175 return mValue;
176}
177
183
184inline void
186{
187 mValue.push_back(v);
188}
189
192{
193 return mValue.begin();
194}
195
198{
199 return mValue.begin();
200}
201
204{
205 return mValue.end();
206}
207
210{
211 return mValue.end();
212}
213
216{
217 return mValue.erase(position);
218}
219
220inline void
222{
223 return mValue.clear();
224}
225
226} // 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
Definition STVector256.h:99
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