20 #ifndef _COUPONLIST_HPP_
21 #define _COUPONLIST_HPP_
23 #include "HllSketchImpl.hpp"
24 #include "coupon_iterator.hpp"
31 class HllSketchImplFactory;
34 class CouponList :
public HllSketchImpl<A> {
36 using vector_bytes = std::vector<uint8_t, typename std::allocator_traits<A>::template rebind_alloc<uint8_t>>;
38 CouponList(uint8_t lgConfigK,
target_hll_type tgtHllType, hll_mode mode,
const A& allocator);
41 static CouponList* newList(
const void* bytes,
size_t len,
const A& allocator);
42 static CouponList* newList(std::istream& is,
const A& allocator);
43 virtual vector_bytes serialize(
bool compact,
unsigned header_size_bytes)
const;
44 virtual void serialize(std::ostream& os,
bool compact)
const;
46 virtual ~CouponList() =
default;
47 virtual std::function<void(HllSketchImpl<A>*)> get_deleter()
const;
49 virtual CouponList* copy()
const;
52 virtual HllSketchImpl<A>* couponUpdate(uint32_t coupon);
54 virtual double getEstimate()
const;
55 virtual double getCompositeEstimate()
const;
56 virtual double getUpperBound(uint8_t numStdDev)
const;
57 virtual double getLowerBound(uint8_t numStdDev)
const;
59 virtual bool isEmpty()
const;
60 virtual uint32_t getCouponCount()
const;
62 coupon_iterator<A> begin(
bool all =
false)
const;
63 coupon_iterator<A> end()
const;
66 using ClAlloc =
typename std::allocator_traits<A>::template rebind_alloc<CouponList<A>>;
68 using vector_int = std::vector<uint32_t, typename std::allocator_traits<A>::template rebind_alloc<uint32_t>>;
70 HllSketchImpl<A>* promoteHeapListToSet(CouponList& list);
71 HllSketchImpl<A>* promoteHeapListOrSetToHll(CouponList& src);
73 virtual uint32_t getUpdatableSerializationBytes()
const;
74 virtual uint32_t getCompactSerializationBytes()
const;
75 virtual uint32_t getMemDataStart()
const;
76 virtual uint8_t getPreInts()
const;
77 virtual bool isCompact()
const;
78 virtual bool isOutOfOrderFlag()
const;
79 virtual void putOutOfOrderFlag(
bool oooFlag);
81 virtual A getAllocator()
const;
83 uint32_t couponCount_;
87 friend class HllSketchImplFactory<A>;
DataSketches namespace.
Definition: binomial_bounds.hpp:38
target_hll_type
Specifies the target type of HLL sketch to be created.
Definition: hll.hpp:72