20 #ifndef COMPACT_THETA_SKETCH_PARSER_HPP_
21 #define COMPACT_THETA_SKETCH_PARSER_HPP_
28 class compact_theta_sketch_parser {
30 struct compact_theta_sketch_data {
36 const void* entries_start_ptr;
40 static compact_theta_sketch_data parse(
const void* ptr,
size_t size, uint64_t seed,
bool dump_on_error =
false);
44 static const size_t COMPACT_SKETCH_PRE_LONGS_BYTE = 0;
45 static const size_t COMPACT_SKETCH_SERIAL_VERSION_BYTE = 1;
46 static const size_t COMPACT_SKETCH_TYPE_BYTE = 2;
47 static const size_t COMPACT_SKETCH_FLAGS_BYTE = 5;
48 static const size_t COMPACT_SKETCH_SEED_HASH_U16 = 3;
49 static const size_t COMPACT_SKETCH_SINGLE_ENTRY_U64 = 1;
50 static const size_t COMPACT_SKETCH_NUM_ENTRIES_U32 = 2;
51 static const size_t COMPACT_SKETCH_ENTRIES_EXACT_U64 = 2;
52 static const size_t COMPACT_SKETCH_ENTRIES_ESTIMATION_U64 = 3;
53 static const size_t COMPACT_SKETCH_THETA_U64 = 2;
54 static const size_t COMPACT_SKETCH_V4_ENTRY_BITS_BYTE = 3;
55 static const size_t COMPACT_SKETCH_V4_NUM_ENTRIES_BYTES_BYTE = 4;
56 static const size_t COMPACT_SKETCH_V4_THETA_U64 = 1;
57 static const size_t COMPACT_SKETCH_V4_PACKED_DATA_EXACT_BYTE = 8;
58 static const size_t COMPACT_SKETCH_V4_PACKED_DATA_ESTIMATION_BYTE = 16;
60 static const uint8_t COMPACT_SKETCH_IS_EMPTY_FLAG = 2;
61 static const uint8_t COMPACT_SKETCH_IS_ORDERED_FLAG = 4;
63 static const uint8_t COMPACT_SKETCH_TYPE = 3;
65 static void check_memory_size(
const void* ptr,
size_t actual_bytes,
size_t expected_bytes,
bool dump_on_error);
66 static std::string hex_dump(
const uint8_t* ptr,
size_t size);
71 #include "compact_theta_sketch_parser_impl.hpp"
DataSketches namespace.
Definition: binomial_bounds.hpp:38