19 #ifndef RIPPLE_TEST_CSF_TX_H_INCLUDED
20 #define RIPPLE_TEST_CSF_TX_H_INCLUDED
21 #include <ripple/beast/hash/hash_append.h>
22 #include <ripple/beast/hash/uhash.h>
23 #include <boost/container/flat_set.hpp>
24 #include <boost/iterator/function_output_iterator.hpp>
44 template <
typename T,
typename = std::enable_if_t<std::is_same_v<T, Tx>>>
102 return txs_.insert(t).second;
108 return txs_.erase(
Tx{txId}) > 0;
124 auto it =
txs_.find(
Tx{txId});
125 return it !=
txs_.end();
131 auto it =
txs_.find(
Tx{txId});
132 if (it !=
txs_.end())
158 auto populate_diffs = [&res](
auto const& a,
auto const& b,
bool s) {
159 auto populator = [&](
auto const& tx) { res[tx.id()] = s; };
165 boost::make_function_output_iterator(
std::ref(populator)));
168 populate_diffs(
txs_, other.
txs_,
true);
169 populate_diffs(other.
txs_,
txs_,
false);
195 bool do_comma =
false;
196 for (
auto const& t : ts)
216 template <
class Hasher>
bool operator==(Tx const &o) const
bool erase(Tx::ID const &txId)
static ID calcID(TxSetType const &txs)
boost::container::flat_set< Tx > TxSetType
TxSet is a set of transactions to consider including in the ledger.
bool operator<(Tx const &o) const
std::ostream & operator<<(std::ostream &o, const Tx &t)
std::map< Tx::ID, bool > compare(TxSet const &other) const
TxSetType const & txs() const
typename Hasher::result_type result_type
beast::uhash<>::result_type ID
bool exists(Tx::ID const txId) const
MutableTxSet(TxSet const &s)
TxSetType txs_
The set contains the actual transactions.
ID id_
The unique ID of this tx set.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
T set_difference(T... args)
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.
void hash_append(Hasher &h, Tx const &tx)
Tx const * find(Tx::ID const &txId) const
TxSet(TxSetType const &s)
std::string to_string(TxSetType const &txs)