20#include <xrpl/protocol/detail/STVar.h>
22#include <xrpl/basics/contract.h>
23#include <xrpl/protocol/STAccount.h>
24#include <xrpl/protocol/STAmount.h>
25#include <xrpl/protocol/STArray.h>
26#include <xrpl/protocol/STBase.h>
27#include <xrpl/protocol/STBitString.h>
28#include <xrpl/protocol/STBlob.h>
29#include <xrpl/protocol/STCurrency.h>
30#include <xrpl/protocol/STInteger.h>
31#include <xrpl/protocol/STIssue.h>
32#include <xrpl/protocol/STNumber.h>
33#include <xrpl/protocol/STObject.h>
34#include <xrpl/protocol/STPathSet.h>
35#include <xrpl/protocol/STVector256.h>
36#include <xrpl/protocol/STXChainBridge.h>
37#include <xrpl/protocol/XChainAttestations.h>
54 if (other.
p_ !=
nullptr)
111 :
STVar(STI_NOTPRESENT, name)
118 Throw<std::runtime_error>(
"Maximum nesting depth of STVar exceeded");
125 (
id == STI_NOTPRESENT) || (
id == name.fieldType),
126 "ripple::detail::STVar::STVar(SerializedTypeID) : valid type input");
141template <
typename... Args>
146 auto constructWithDepth = [&]<
typename T>() {
151 construct<T>(std::forward<Args>(args)...);
157 construct<T>(std::forward<Args>(args)..., depth);
161 constexpr bool alwaysFalse =
163 static_assert(alwaysFalse,
"Invalid STVar constructor arguments");
169 case STI_NOTPRESENT: {
173 construct<STBase>(field);
177 construct<STUInt8>(std::forward<Args>(args)...);
180 construct<STUInt16>(std::forward<Args>(args)...);
183 construct<STUInt32>(std::forward<Args>(args)...);
186 construct<STUInt64>(std::forward<Args>(args)...);
189 construct<STAmount>(std::forward<Args>(args)...);
192 construct<STUInt128>(std::forward<Args>(args)...);
195 construct<STUInt160>(std::forward<Args>(args)...);
198 construct<STUInt192>(std::forward<Args>(args)...);
201 construct<STUInt256>(std::forward<Args>(args)...);
204 construct<STVector256>(std::forward<Args>(args)...);
207 construct<STBlob>(std::forward<Args>(args)...);
210 construct<STAccount>(std::forward<Args>(args)...);
213 construct<STPathSet>(std::forward<Args>(args)...);
216 constructWithDepth.template operator()<
STObject>();
219 constructWithDepth.template operator()<
STArray>();
222 construct<STIssue>(std::forward<Args>(args)...);
224 case STI_XCHAIN_BRIDGE:
225 construct<STXChainBridge>(std::forward<Args>(args)...);
228 construct<STCurrency>(std::forward<Args>(args)...);
231 Throw<std::runtime_error>(
"Unknown object type");
virtual STBase * move(std::size_t n, void *buf)
virtual ~STBase()=default
virtual STBase * copy(std::size_t n, void *buf) const
STVar & operator=(STVar const &rhs)
std::aligned_storage< max_size >::type d_
void constructST(SerializedTypeID id, int depth, Args &&... arg)
Construct requested Serializable Type according to id.
static std::size_t constexpr max_size
T forward_as_tuple(T... args)
nonPresentObject_t nonPresentObject
defaultObject_t defaultObject
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.