datasketches-cpp
Toggle main menu visibility
Loading...
Searching...
No Matches
theta
include
theta_intersection.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_HPP_
21
#define THETA_INTERSECTION_HPP_
22
23
#include "theta_sketch.hpp"
24
#include "theta_intersection_base.hpp"
25
26
namespace
datasketches
{
27
28
// forward declaration
29
template
<
typename
A>
class
theta_intersection_alloc
;
30
31
// alias with default allocator for convenience
32
using
theta_intersection =
theta_intersection_alloc<std::allocator<uint64_t>
>;
33
38
template
<
typename
Allocator = std::allocator<u
int
64_t>>
39
class
theta_intersection_alloc
{
40
public
:
41
using
Entry = uint64_t;
42
using
ExtractKey = trivial_extract_key;
43
using
Sketch =
theta_sketch_alloc<Allocator>
;
44
using
CompactSketch =
compact_theta_sketch_alloc<Allocator>
;
45
46
// there is no payload in Theta sketch entry
47
struct
nop_policy {
48
void
operator()(uint64_t internal_entry, uint64_t incoming_entry)
const
{
49
unused(incoming_entry);
50
unused(internal_entry);
51
}
52
};
53
using
State = theta_intersection_base<Entry, ExtractKey, nop_policy, Sketch, CompactSketch, Allocator>;
54
60
explicit
theta_intersection_alloc
(uint64_t seed = DEFAULT_SEED,
const
Allocator& allocator = Allocator());
61
68
template
<
typename
FwdSketch>
69
void
update
(FwdSketch&& sketch);
70
78
CompactSketch
get_result
(
bool
ordered =
true
)
const
;
79
84
bool
has_result
()
const
;
85
86
private
:
87
State state_;
88
};
89
90
}
/* namespace datasketches */
91
92
#include "theta_intersection_impl.hpp"
93
94
#endif
datasketches::compact_theta_sketch_alloc
Compact Theta sketch.
Definition
theta_sketch.hpp:373
datasketches::theta_intersection_alloc
Theta intersection.
Definition
theta_intersection.hpp:39
datasketches::theta_intersection_alloc::get_result
CompactSketch get_result(bool ordered=true) const
Produces a copy of the current state of the intersection.
Definition
theta_intersection_impl.hpp:37
datasketches::theta_intersection_alloc::theta_intersection_alloc
theta_intersection_alloc(uint64_t seed=DEFAULT_SEED, const Allocator &allocator=Allocator())
Constructor.
Definition
theta_intersection_impl.hpp:26
datasketches::theta_intersection_alloc::has_result
bool has_result() const
Returns true if the state of the intersection is defined (not infinite "universe").
Definition
theta_intersection_impl.hpp:42
datasketches::theta_intersection_alloc::update
void update(FwdSketch &&sketch)
Updates the intersection with a given sketch.
Definition
theta_intersection_impl.hpp:32
datasketches::theta_sketch_alloc
Base class for the Theta Sketch, a generalization of the Kth Minimum Value (KMV) sketch.
Definition
theta_sketch.hpp:127
datasketches
DataSketches namespace.
Definition
binomial_bounds.hpp:38
Generated by
1.18.0