20#include <xrpl/basics/Log.h>
21#include <xrpl/basics/contract.h>
22#include <xrpl/beast/utility/instrumentation.h>
23#include <xrpl/json/json_value.h>
24#include <xrpl/protocol/AccountID.h>
25#include <xrpl/protocol/SField.h>
26#include <xrpl/protocol/STBase.h>
27#include <xrpl/protocol/STPathSet.h>
28#include <xrpl/protocol/Serializer.h>
29#include <xrpl/protocol/UintTypes.h>
30#include <xrpl/protocol/jss.h>
51 hash_account += (hash_account * 257) ^ x;
54 hash_currency += (hash_currency * 509) ^ x;
57 hash_issuer += (hash_issuer * 911) ^ x;
59 return (hash_account ^ hash_currency ^ hash_issuer);
67 int iType = sit.
get8();
74 JLOG(
debugLog().error()) <<
"Empty path in pathset";
75 Throw<std::runtime_error>(
"empty path");
87 <<
"Bad path element " << iType <<
" in pathset";
88 Throw<std::runtime_error>(
"bad path element");
109 path.emplace_back(account, currency, issuer, hasCurrency);
123 return emplace(n, buf, std::move(*
this));
129 value.push_back(base);
166 for (
auto& p :
mPath)
168 if (p.getAccountID() == account && p.getCurrency() == currency &&
169 p.getIssuerID() == issuer)
181 for (
auto it :
mPath)
184 auto const iType = it.getNodeType();
186 elem[jss::type] = iType;
189 elem[jss::account] =
to_string(it.getAccountID());
192 elem[jss::currency] =
to_string(it.getCurrency());
195 elem[jss::issuer] =
to_string(it.getIssuerID());
207 for (
auto it :
value)
208 ret.
append(it.getJson(options));
223 getFName().isBinary(),
"ripple::STPathSet::add : field is binary");
225 getFName().fieldType == STI_PATHSET,
226 "ripple::STPathSet::add : valid field type");
229 for (
auto const& spPath :
value)
234 for (
auto const& speElement : spPath)
236 int iType = speElement.getNodeType();
Value & append(Value const &value)
Append value to array at the end.
A type which can be exported to a well known binary format.
SField const & getFName() const
static STBase * emplace(std::size_t n, void *buf, T &&val)
Currency const & getCurrency() const
static std::size_t get_hash(STPathElement const &element)
AccountID const & getAccountID() const
AccountID const & getIssuerID() const
STBase * move(std::size_t n, void *buf) override
bool isDefault() const override
std::vector< STPath > value
bool isEquivalent(STBase const &t) const override
STBase * copy(std::size_t n, void *buf) const override
void push_back(STPath const &e)
bool assembleAdd(STPath const &base, STPathElement const &tail)
Json::Value getJson(JsonOptions) const override
SerializedTypeID getSType() const override
void add(Serializer &s) const override
std::vector< STPathElement > mPath
Json::Value getJson(JsonOptions) const
void push_back(STPathElement const &e)
bool hasSeen(AccountID const &account, Currency const ¤cy, AccountID const &issuer) const
int addBitString(base_uint< Bits, Tag > const &v)
int add8(unsigned char i)
@ arrayValue
array value (ordered list)
@ objectValue
object value (collection of name/value pairs).
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
beast::Journal debugLog()
Returns a debug journal.
std::string to_string(base_uint< Bits, Tag > const &a)
Note, should be treated as flags that can be | and &.