20#include <xrpl/basics/contract.h>
21#include <xrpl/beast/utility/instrumentation.h>
22#include <xrpl/protocol/SField.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/Serializer.h>
38#include <xrpl/protocol/detail/STVar.h>
59 if (other.
p_ !=
nullptr)
116 :
STVar(STI_NOTPRESENT, name)
123 Throw<std::runtime_error>(
"Maximum nesting depth of STVar exceeded");
130 (
id == STI_NOTPRESENT) || (
id == name.fieldType),
131 "ripple::detail::STVar::STVar(SerializedTypeID) : valid type input");
146template <
typename... Args>
151 auto constructWithDepth = [&]<
typename T>() {
156 construct<T>(std::forward<Args>(args)...);
162 construct<T>(std::forward<Args>(args)..., depth);
166 constexpr bool alwaysFalse =
168 static_assert(alwaysFalse,
"Invalid STVar constructor arguments");
174 case STI_NOTPRESENT: {
178 construct<STBase>(field);
182 construct<STUInt8>(std::forward<Args>(args)...);
185 construct<STUInt16>(std::forward<Args>(args)...);
188 construct<STUInt32>(std::forward<Args>(args)...);
191 construct<STUInt64>(std::forward<Args>(args)...);
194 construct<STAmount>(std::forward<Args>(args)...);
197 construct<STNumber>(std::forward<Args>(args)...);
200 construct<STUInt128>(std::forward<Args>(args)...);
203 construct<STUInt160>(std::forward<Args>(args)...);
206 construct<STUInt192>(std::forward<Args>(args)...);
209 construct<STUInt256>(std::forward<Args>(args)...);
212 construct<STVector256>(std::forward<Args>(args)...);
215 construct<STBlob>(std::forward<Args>(args)...);
218 construct<STAccount>(std::forward<Args>(args)...);
221 construct<STPathSet>(std::forward<Args>(args)...);
224 constructWithDepth.template operator()<
STObject>();
227 constructWithDepth.template operator()<
STArray>();
230 construct<STIssue>(std::forward<Args>(args)...);
232 case STI_XCHAIN_BRIDGE:
233 construct<STXChainBridge>(std::forward<Args>(args)...);
236 construct<STCurrency>(std::forward<Args>(args)...);
239 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.