20 #ifndef _VAR_OPT_UNION_HPP_
21 #define _VAR_OPT_UNION_HPP_
23 #include "var_opt_sketch.hpp"
24 #include "common_defs.hpp"
31 template<
typename A>
using AllocU8 =
typename std::allocator_traits<A>::template rebind_alloc<uint8_t>;
50 typename A = std::allocator<T>
56 explicit var_opt_union(uint32_t max_k,
const A& allocator = A());
96 template<
typename SerDe = serde<T>>
101 typedef vector_u8<A> vector_bytes;
112 template<
typename SerDe = serde<T>>
113 vector_bytes
serialize(
unsigned header_size_bytes = 0,
const SerDe& sd = SerDe())
const;
121 template<
typename SerDe = serde<T>>
122 void serialize(std::ostream& os,
const SerDe& sd = SerDe())
const;
132 template<
typename SerDe = serde<T>>
144 template<
typename SerDe = serde<T>>
154 using AllocSketch =
typename std::allocator_traits<A>::template rebind_alloc<var_opt_sketch<T, A>>;
155 using AllocDouble =
typename std::allocator_traits<A>::template rebind_alloc<double>;
156 using AllocBool =
typename std::allocator_traits<A>::template rebind_alloc<bool>;
158 static const uint8_t PREAMBLE_LONGS_EMPTY = 1;
159 static const uint8_t PREAMBLE_LONGS_NON_EMPTY = 4;
160 static const uint8_t SER_VER = 2;
161 static const uint8_t FAMILY_ID = 14;
162 static const uint8_t EMPTY_FLAG_MASK = 4;
167 double outer_tau_numer_;
170 uint64_t outer_tau_denom_;
178 var_opt_union(uint64_t n,
double outer_tau_numer, uint64_t outer_tau_denom,
239 double get_outer_tau()
const;
243 bool there_exist_unmarked_h_items_lighter_than_target(
double threshold)
const;
248 static void check_preamble_longs(uint8_t preamble_longs, uint8_t flags);
249 static void check_family_and_serialization_version(uint8_t family_id, uint8_t ser_ver);
254 #include "var_opt_union_impl.hpp"
Provides a unioning operation over var_opt_sketch objects.
Definition: var_opt_union.hpp:52
vector_bytes serialize(unsigned header_size_bytes=0, const SerDe &sd=SerDe()) const
NOTE: This method may be deprecated in a future version.
var_opt_sketch< T, A > get_result() const
Gets the varopt sketch resulting from the union of any input sketches.
Definition: var_opt_union_impl.hpp:425
void update(const var_opt_sketch< T, A > &sk)
Updates this union with the given sketch This method takes an lvalue.
Definition: var_opt_union_impl.hpp:323
static var_opt_union deserialize(const void *bytes, size_t size, const SerDe &sd=SerDe(), const A &allocator=A())
NOTE: This method may be deprecated in a future version.
size_t get_serialized_size_bytes(const SerDe &sd=SerDe()) const
Computes size needed to serialize the current state of the union.
Definition: var_opt_union_impl.hpp:218
void reset()
Resets the union to its default, empty state.
Definition: var_opt_union_impl.hpp:301
string< A > to_string() const
Prints a summary of the union as a string.
Definition: var_opt_union_impl.hpp:309
static var_opt_union deserialize(std::istream &is, const SerDe &sd=SerDe(), const A &allocator=A())
NOTE: This method may be deprecated in a future version.
DataSketches namespace.
Definition: binomial_bounds.hpp:38