Turi Create  4.0
unity_sketch_interface.hpp
1 /* Copyright © 2017 Apple Inc. All rights reserved.
2  *
3  * Use of this source code is governed by a BSD-3-clause license that can
4  * be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5  */
6 #ifndef TURI_UNITY_SKETCH_INTERFACE_HPP
7 #define TURI_UNITY_SKETCH_INTERFACE_HPP
8 #include <memory>
9 #include <vector>
10 #include <map>
11 #include <string>
12 
13 #include <core/data/flexible_type/flexible_type.hpp>
14 #include <model_server/lib/api/unity_sarray_interface.hpp>
15 #include <core/system/cppipc/magic_macros.hpp>
16 
17 namespace turi {
18 class unity_sketch_base;
19 
20 typedef std::pair<flexible_type, size_t> item_count;
21 typedef std::map<flexible_type, std::shared_ptr<unity_sketch_base>> sub_sketch_map;
22 
23 GENERATE_INTERFACE_AND_PROXY(unity_sketch_base, unity_sketch_proxy,
24  (void, construct_from_sarray, (std::shared_ptr<unity_sarray_base>)(bool)(const std::vector<flexible_type>&))
25  (double, get_quantile, (double))
26  (double, frequency_count, (flexible_type))
27  (std::vector<item_count>, frequent_items, )
28  (double, num_unique, )
29  (double, mean, )
30  (double, max, )
31  (double, min, )
32  (double, var, )
33  (size_t, size, )
34  (double, sum, )
35  (size_t, num_undefined, )
36  (bool, sketch_ready, )
37  (size_t, num_elements_processed, )
38  (std::shared_ptr<unity_sketch_base>, element_summary, )
39  (std::shared_ptr<unity_sketch_base>, element_length_summary, )
40  (std::shared_ptr<unity_sketch_base>, dict_key_summary, )
41  (std::shared_ptr<unity_sketch_base>, dict_value_summary, )
42  (sub_sketch_map, element_sub_sketch, (const std::vector<flexible_type>&))
43  (void, cancel, )
44 )
45 
46 } // namespace turi
47 #endif // TURI_UNITY_GRAPH_INTERFACE_HPP
#define GENERATE_INTERFACE_AND_PROXY(base_name, proxy_name, functions)