datasketches-cpp
tuple_union_impl.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 namespace datasketches {
21 
22 template<typename S, typename P, typename A>
23 tuple_union<S, P, A>::tuple_union(uint8_t lg_cur_size, uint8_t lg_nom_size, resize_factor rf, float p, uint64_t theta, uint64_t seed, const P& policy, const A& allocator):
24 state_(lg_cur_size, lg_nom_size, rf, p, theta, seed, internal_policy(policy), allocator)
25 {}
26 
27 template<typename S, typename P, typename A>
28 template<typename SS>
29 void tuple_union<S, P, A>::update(SS&& sketch) {
30  state_.update(std::forward<SS>(sketch));
31 }
32 
33 template<typename S, typename P, typename A>
34 auto tuple_union<S, P, A>::get_result(bool ordered) const -> CompactSketch {
35  return state_.get_result(ordered);
36 }
37 
38 template<typename S, typename P, typename A>
40  return state_.reset();
41 }
42 
43 template<typename S, typename P, typename A>
44 tuple_union<S, P, A>::builder::builder(const P& policy, const A& allocator):
45 tuple_base_builder<builder, P, A>(policy, allocator) {}
46 
47 template<typename S, typename P, typename A>
49  return tuple_union(this->starting_lg_size(), this->lg_k_, this->rf_, this->p_, this->starting_theta(), this->seed_, this->policy_, this->allocator_);
50 }
51 
52 } /* namespace datasketches */
Compact Tuple sketch.
Definition: tuple_sketch.hpp:416
Tuple base builder.
Definition: tuple_sketch.hpp:614
Tuple union builder.
Definition: tuple_union.hpp:101
tuple_union build() const
Create an instance of the union with predefined parameters.
Definition: tuple_union_impl.hpp:48
Tuple Union.
Definition: tuple_union.hpp:45
void reset()
Reset the union to the initial empty state.
Definition: tuple_union_impl.hpp:39
DataSketches namespace.
Definition: binomial_bounds.hpp:38