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/STObject.h>
33#include <xrpl/protocol/STPathSet.h>
34#include <xrpl/protocol/STVector256.h>
35#include <xrpl/protocol/STXChainBridge.h>
36#include <xrpl/protocol/Serializer.h>
37#include <xrpl/protocol/detail/STVar.h>
58 if (other.
p_ !=
nullptr)
115 :
STVar(STI_NOTPRESENT, name)
122 Throw<std::runtime_error>(
"Maximum nesting depth of STVar exceeded");
129 (
id == STI_NOTPRESENT) || (
id == name.fieldType),
130 "ripple::detail::STVar::STVar(SerializedTypeID) : valid type input");
145template <
typename... Args>
150 auto constructWithDepth = [&]<
typename T>() {
155 construct<T>(std::forward<Args>(args)...);
161 construct<T>(std::forward<Args>(args)..., depth);
165 constexpr bool alwaysFalse =
167 static_assert(alwaysFalse,
"Invalid STVar constructor arguments");
173 case STI_NOTPRESENT: {
177 construct<STBase>(field);
181 construct<STUInt8>(std::forward<Args>(args)...);
184 construct<STUInt16>(std::forward<Args>(args)...);
187 construct<STUInt32>(std::forward<Args>(args)...);
190 construct<STUInt64>(std::forward<Args>(args)...);
193 construct<STAmount>(std::forward<Args>(args)...);
196 construct<STUInt128>(std::forward<Args>(args)...);
199 construct<STUInt160>(std::forward<Args>(args)...);
202 construct<STUInt192>(std::forward<Args>(args)...);
205 construct<STUInt256>(std::forward<Args>(args)...);
208 construct<STVector256>(std::forward<Args>(args)...);
211 construct<STBlob>(std::forward<Args>(args)...);
214 construct<STAccount>(std::forward<Args>(args)...);
217 construct<STPathSet>(std::forward<Args>(args)...);
220 constructWithDepth.template operator()<
STObject>();
223 constructWithDepth.template operator()<
STArray>();
226 construct<STIssue>(std::forward<Args>(args)...);
228 case STI_XCHAIN_BRIDGE:
229 construct<STXChainBridge>(std::forward<Args>(args)...);
232 construct<STCurrency>(std::forward<Args>(args)...);
235 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.