1#ifndef XRPL_TEST_CSF_TX_H_INCLUDED
2#define XRPL_TEST_CSF_TX_H_INCLUDED
4#include <xrpl/beast/hash/hash_append.h>
5#include <xrpl/beast/hash/uhash.h>
7#include <boost/container/flat_set.hpp>
8#include <boost/iterator/function_output_iterator.hpp>
31 template <
typename T,
typename = std::enable_if_t<std::is_same_v<T, Tx>>>
89 return txs_.insert(t).second;
95 return txs_.erase(
Tx{txId}) > 0;
111 auto it =
txs_.find(
Tx{txId});
112 return it !=
txs_.end();
118 auto it =
txs_.find(
Tx{txId});
119 if (it !=
txs_.end())
145 auto populate_diffs = [&res](
auto const& a,
auto const& b,
bool s) {
146 auto populator = [&](
auto const& tx) { res[tx.id()] = s; };
152 boost::make_function_output_iterator(
std::ref(populator)));
155 populate_diffs(
txs_, other.
txs_,
true);
156 populate_diffs(other.
txs_,
txs_,
false);
182 bool do_comma =
false;
183 for (
auto const& t : ts)
203template <
class Hasher>
bool erase(Tx::ID const &txId)
MutableTxSet(TxSet const &s)
TxSet is a set of transactions to consider including in the ledger.
std::map< Tx::ID, bool > compare(TxSet const &other) const
TxSet(TxSetType const &s)
TxSetType const & txs() const
ID id_
The unique ID of this tx set.
beast::uhash<>::result_type ID
static ID calcID(TxSetType const &txs)
Tx const * find(Tx::ID const &txId) const
bool exists(Tx::ID const txId) const
TxSetType txs_
The set contains the actual transactions.
bool operator<(Tx const &o) const
bool operator==(Tx const &o) const
std::enable_if_t< is_contiguously_hashable< T, Hasher >::value > hash_append(Hasher &h, T const &t) noexcept
Logically concatenate input data to a Hasher.
std::ostream & operator<<(std::ostream &o, Tx const &t)
boost::container::flat_set< Tx > TxSetType
std::string to_string(TxSetType const &txs)
void hash_append(Hasher &h, Tx const &tx)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
T set_difference(T... args)
typename Hasher::result_type result_type