20 #ifndef TUPLE_UNION_HPP_
21 #define TUPLE_UNION_HPP_
23 #include "tuple_sketch.hpp"
24 #include "theta_union_base.hpp"
29 template<
typename Summary>
30 struct default_tuple_union_policy {
31 void operator()(Summary& summary,
const Summary& other)
const {
42 typename Policy = default_tuple_union_policy<Summary>,
43 typename Allocator = std::allocator<Summary>
47 using Entry = std::pair<uint64_t, Summary>;
48 using ExtractKey = pair_extract_key<uint64_t, Summary>;
51 using AllocEntry =
typename std::allocator_traits<Allocator>::template rebind_alloc<Entry>;
56 struct internal_policy {
57 internal_policy(
const Policy& external_policy): external_policy_(external_policy) {}
58 void operator()(Entry& internal_entry,
const Entry& incoming_entry)
const {
59 external_policy_(internal_entry.second, incoming_entry.second);
61 void operator()(Entry& internal_entry, Entry&& incoming_entry)
const {
62 external_policy_(internal_entry.second, std::move(incoming_entry.second));
64 const Policy& get_external_policy()
const {
return external_policy_; }
65 Policy external_policy_;
68 using State = theta_union_base<Entry, ExtractKey, internal_policy, Sketch, CompactSketch, AllocEntry>;
77 template<
typename FwdSketch>
96 tuple_union(uint8_t lg_cur_size, uint8_t lg_nom_size, resize_factor rf,
float p, uint64_t theta, uint64_t seed,
const Policy& policy,
const Allocator& allocator);
100 template<
typename S,
typename P,
typename A>
109 builder(
const P& policy = P(),
const A& allocator = A());
120 #include "tuple_union_impl.hpp"
Compact Tuple sketch.
Definition: tuple_sketch.hpp:416
Tuple base builder.
Definition: tuple_sketch.hpp:614
Base class for Tuple sketch.
Definition: tuple_sketch.hpp:54
Tuple union builder.
Definition: tuple_union.hpp:101
Tuple Union.
Definition: tuple_union.hpp:45
CompactSketch get_result(bool ordered=true) const
Produces a copy of the current state of the union as a compact sketch.
Definition: tuple_union_impl.hpp:34
void update(FwdSketch &&sketch)
Update the union with a given sketch.
void reset()
Reset the union to the initial empty state.
Definition: tuple_union_impl.hpp:39
datasketches::resize_factor resize_factor
hash table resize factor
Definition: theta_constants.hpp:31
DataSketches namespace.
Definition: binomial_bounds.hpp:38