20 #ifndef _HLLSKETCHIMPL_INTERNAL_HPP_
21 #define _HLLSKETCHIMPL_INTERNAL_HPP_
23 #include "HllSketchImpl.hpp"
24 #include "HllSketchImplFactory.hpp"
31 HllSketchImpl<A>::HllSketchImpl(uint8_t lgConfigK,
target_hll_type tgtHllType,
32 hll_mode mode,
bool startFullSize)
33 : lgConfigK_(lgConfigK),
34 tgtHllType_(tgtHllType),
36 startFullSize_(startFullSize)
41 HllSketchImpl<A>::~HllSketchImpl() {
46 switch ((modeByte >> 2) & 0x3) {
48 return target_hll_type::HLL_4;
50 return target_hll_type::HLL_6;
52 return target_hll_type::HLL_8;
54 throw std::invalid_argument(
"Invalid target HLL type");
59 hll_mode HllSketchImpl<A>::extractCurMode(uint8_t modeByte) {
60 switch (modeByte & 0x3) {
62 return hll_mode::LIST;
68 throw std::invalid_argument(
"Invalid current sketch mode");
73 uint8_t HllSketchImpl<A>::makeFlagsByte(
bool compact)
const {
75 flags |= (isEmpty() ? hll_constants::EMPTY_FLAG_MASK : 0);
76 flags |= (compact ? hll_constants::COMPACT_FLAG_MASK : 0);
77 flags |= (isOutOfOrderFlag() ? hll_constants::OUT_OF_ORDER_FLAG_MASK : 0);
78 flags |= (startFullSize_ ? hll_constants::FULL_SIZE_FLAG_MASK : 0);
94 uint8_t HllSketchImpl<A>::makeModeByte()
const {
109 switch (tgtHllType_) {
125 HllSketchImpl<A>* HllSketchImpl<A>::reset() {
126 return HllSketchImplFactory<A>::reset(
this, startFullSize_);
135 uint8_t HllSketchImpl<A>::getLgConfigK()
const {
140 hll_mode HllSketchImpl<A>::getCurMode()
const {
145 bool HllSketchImpl<A>::isStartFullSize()
const {
146 return startFullSize_;
DataSketches namespace.
Definition: binomial_bounds.hpp:38
target_hll_type
Specifies the target type of HLL sketch to be created.
Definition: hll.hpp:72
@ HLL_6
6 bits per entry (fixed size)
Definition: hll.hpp:74
@ HLL_8
8 bits per entry (fastest, fixed size)
Definition: hll.hpp:75
@ HLL_4
4 bits per entry (most compact, size may vary)
Definition: hll.hpp:73