20#ifndef ARRAY_OF_STRINGS_SKETCH_HPP_
21#define ARRAY_OF_STRINGS_SKETCH_HPP_
26#include "array_tuple_sketch.hpp"
31using array_of_strings = array<std::string>;
34class default_array_of_strings_update_policy {
36 default_array_of_strings_update_policy() =
default;
38 array_of_strings create()
const;
40 void update(array_of_strings& array,
const array_of_strings& input)
const;
42 void update(array_of_strings& array,
const array_of_strings* input)
const;
55template<
typename Allocator = std::allocator<array_of_
strings>>
57 using summary_allocator =
typename std::allocator_traits<Allocator>::template rebind_alloc<array_of_strings>;
61 void serialize(std::ostream& os,
const array_of_strings* items,
unsigned num)
const;
62 void deserialize(std::istream& is, array_of_strings* items,
unsigned num)
const;
63 size_t serialize(
void* ptr,
size_t capacity,
const array_of_strings* items,
unsigned num)
const;
64 size_t deserialize(
const void* ptr,
size_t capacity, array_of_strings* items,
unsigned num)
const;
65 size_t size_of_item(
const array_of_strings& item)
const;
68 summary_allocator summary_allocator_;
69 static void check_num_nodes(uint8_t num_nodes);
70 static uint32_t compute_total_bytes(
const array_of_strings& item);
92template<
typename Allocator = std::allocator<array_of_
strings>>
97 using vector_bytes =
typename Base::vector_bytes;
106 template<
typename Sketch>
117 template<
typename SerDe = default_array_of_
strings_serde<Allocator>>
119 const SerDe& sd = SerDe(),
const Allocator& allocator = Allocator());
130 template<
typename SerDe = default_array_of_
strings_serde<Allocator>>
132 const SerDe& sd = SerDe(),
const Allocator& allocator = Allocator());
141template<
typename Allocator = std::allocator<array_of_
strings>,
142 typename Policy = default_array_of_
strings_update_policy>
156template<
typename Allocator = std::allocator<array_of_
strings>,
typename Policy = default_array_of_
strings_update_policy>
162#include "array_of_strings_sketch_impl.hpp"
Extended class of compact_tuple_sketch for array of strings.
Definition array_of_strings_sketch.hpp:94
static compact_array_of_strings_tuple_sketch deserialize(std::istream &is, uint64_t seed=DEFAULT_SEED, const SerDe &sd=SerDe(), const Allocator &allocator=Allocator())
This method deserializes a sketch from a given stream.
static compact_array_of_strings_tuple_sketch deserialize(const void *bytes, size_t size, uint64_t seed=DEFAULT_SEED, const SerDe &sd=SerDe(), const Allocator &allocator=Allocator())
This method deserializes a sketch from a given array of bytes.
Compact Tuple sketch.
Definition tuple_sketch.hpp:457
void serialize(std::ostream &os, const SerDe &sd=SerDe()) const
This method serializes the sketch into a given stream in a binary form.
Definition tuple_sketch_impl.hpp:401
Update Tuple sketch.
Definition tuple_sketch.hpp:222
DataSketches namespace.
Definition binomial_bounds.hpp:38
compact_array_of_strings_tuple_sketch< Allocator > compact_array_of_strings_sketch(const update_array_of_strings_tuple_sketch< Allocator, Policy > &sketch, bool ordered=true)
Converts an array of strings tuple sketch to a compact sketch (ordered or unordered).
Definition array_of_strings_sketch_impl.hpp:67
uint64_t hash_array_of_strings_key(const array_of_strings &key)
Hashes an array of strings using ArrayOfStrings-compatible hashing.
Definition array_of_strings_sketch_impl.hpp:53
Serializer/deserializer for an array of strings.
Definition array_of_strings_sketch.hpp:56