20 #ifndef TUPLE_INTERSECTION_HPP_
21 #define TUPLE_INTERSECTION_HPP_
23 #include "tuple_sketch.hpp"
24 #include "theta_intersection_base.hpp"
45 typename Allocator = std::allocator<Summary>
49 using Entry = std::pair<uint64_t, Summary>;
50 using ExtractKey = pair_extract_key<uint64_t, Summary>;
53 using AllocEntry =
typename std::allocator_traits<Allocator>::template rebind_alloc<Entry>;
57 struct internal_policy {
58 internal_policy(
const Policy& external_policy): external_policy_(external_policy) {}
59 void operator()(Entry& internal_entry,
const Entry& incoming_entry)
const {
60 external_policy_(internal_entry.second, incoming_entry.second);
62 void operator()(Entry& internal_entry, Entry&& incoming_entry)
const {
63 external_policy_(internal_entry.second, std::move(incoming_entry.second));
65 const Policy& get_external_policy()
const {
return external_policy_; }
66 Policy external_policy_;
69 using State = theta_intersection_base<Entry, ExtractKey, internal_policy, Sketch, CompactSketch, AllocEntry>;
77 explicit tuple_intersection(uint64_t seed = DEFAULT_SEED,
const Policy& policy = Policy(),
const Allocator& allocator = Allocator());
85 template<
typename FwdSketch>
109 #include "tuple_intersection_impl.hpp"
Compact Tuple sketch.
Definition: tuple_sketch.hpp:416
Tuple intersection.
Definition: tuple_intersection.hpp:47
CompactSketch get_result(bool ordered=true) const
Produces a copy of the current state of the intersection.
Definition: tuple_intersection_impl.hpp:34
tuple_intersection(uint64_t seed=DEFAULT_SEED, const Policy &policy=Policy(), const Allocator &allocator=Allocator())
Constructor.
Definition: tuple_intersection_impl.hpp:23
bool has_result() const
Returns true if the state of the intersection is defined (not infinite "universe").
Definition: tuple_intersection_impl.hpp:39
void update(FwdSketch &&sketch)
Updates the intersection with a given sketch.
Base class for Tuple sketch.
Definition: tuple_sketch.hpp:54
DataSketches namespace.
Definition: binomial_bounds.hpp:38