1#include <xrpl/basics/Log.h>
2#include <xrpl/basics/contract.h>
3#include <xrpl/beast/utility/instrumentation.h>
4#include <xrpl/json/json_value.h>
5#include <xrpl/protocol/AccountID.h>
6#include <xrpl/protocol/SField.h>
7#include <xrpl/protocol/STBase.h>
8#include <xrpl/protocol/STPathSet.h>
9#include <xrpl/protocol/Serializer.h>
10#include <xrpl/protocol/UintTypes.h>
11#include <xrpl/protocol/jss.h>
32 hash_account += (hash_account * 257) ^ x;
35 hash_currency += (hash_currency * 509) ^ x;
38 hash_issuer += (hash_issuer * 911) ^ x;
40 return (hash_account ^ hash_currency ^ hash_issuer);
48 int iType = sit.
get8();
55 JLOG(
debugLog().error()) <<
"Empty path in pathset";
56 Throw<std::runtime_error>(
"empty path");
68 <<
"Bad path element " << iType <<
" in pathset";
69 Throw<std::runtime_error>(
"bad path element");
90 path.emplace_back(account, currency, issuer, hasCurrency);
104 return emplace(n, buf, std::move(*
this));
110 value.push_back(base);
147 for (
auto& p :
mPath)
149 if (p.getAccountID() == account && p.getCurrency() == currency &&
150 p.getIssuerID() == issuer)
162 for (
auto it :
mPath)
165 auto const iType = it.getNodeType();
167 elem[jss::type] = iType;
170 elem[jss::account] =
to_string(it.getAccountID());
173 elem[jss::currency] =
to_string(it.getCurrency());
176 elem[jss::issuer] =
to_string(it.getIssuerID());
188 for (
auto it :
value)
189 ret.
append(it.getJson(options));
204 getFName().isBinary(),
"ripple::STPathSet::add : field is binary");
206 getFName().fieldType == STI_PATHSET,
207 "ripple::STPathSet::add : valid field type");
210 for (
auto const& spPath :
value)
215 for (
auto const& speElement : spPath)
217 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 &.