datasketches-cpp
theta_intersection_base.hpp
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #ifndef THETA_INTERSECTION_BASE_HPP_
21 #define THETA_INTERSECTION_BASE_HPP_
22 
23 namespace datasketches {
24 
25 template<
26  typename Entry,
27  typename ExtractKey,
28  typename Policy,
29  typename Sketch,
30  typename CompactSketch,
31  typename Allocator
32 >
33 class theta_intersection_base {
34 public:
35  using hash_table = theta_update_sketch_base<Entry, ExtractKey, Allocator>;
36  using resize_factor = typename hash_table::resize_factor;
37  using comparator = compare_by_key<ExtractKey>;
38  theta_intersection_base(uint64_t seed, const Policy& policy, const Allocator& allocator);
39 
40  template<typename FwdSketch>
41  void update(FwdSketch&& sketch);
42 
43  CompactSketch get_result(bool ordered = true) const;
44 
45  bool has_result() const;
46 
47  const Policy& get_policy() const;
48 
49 private:
50  Policy policy_;
51  bool is_valid_;
52  hash_table table_;
53 };
54 
55 } /* namespace datasketches */
56 
57 #include "theta_intersection_base_impl.hpp"
58 
59 #endif
DataSketches namespace.
Definition: binomial_bounds.hpp:38