Turi Create  4.0
unity_graph_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_GRAPH_INTERFACE_HPP
7 #define TURI_UNITY_GRAPH_INTERFACE_HPP
8 #include <memory>
9 #include <vector>
10 #include <string>
11 #include <core/data/flexible_type/flexible_type.hpp>
12 #include <model_server/lib/options_map.hpp>
13 #include <model_server/lib/api/unity_sframe_interface.hpp>
14 #include <core/system/cppipc/magic_macros.hpp>
15 
16 namespace turi {
17 
18 
19 #if DOXYGEN_DOCUMENTATION
20 // Doxygen fake documentation
21 
22 /**
23  * The \ref turi::unity_graph and \ref turi::unity_sgraph_base classes
24  * implement a graph object on the server side which is exposed to the
25  * client via the cppipc system. The unity_graph is a lazily evaluated, immutable
26  * graph datastructure where most operations do not take time, and instead,
27  * the graph is only fully constructed when accessed. See
28  * \ref turi::unity_graph for detailed documentation on the functions.
29  */
31  options_map_t summary();
32  std::vector<std::string> get_fields();
33  std::shared_ptr<unity_sframe_base> get_vertices(const std::vector<flexible_type>&,
34  const options_map_t&);
35  std::shared_ptr<unity_sframe_base> get_edges(const std::vector<flexible_type>&
36  const std::vector<flexible_type>&
37  const options_map_t&);
38  bool save_graph(std::string)
39  bool load_graph(std::string)
40  std::shared_ptr<unity_sgraph_base> clone()
41  std::shared_ptr<unity_sgraph_base> add_vertices(dataframe_t&, const std::string&)
42  std::shared_ptr<unity_sgraph_base> add_vertices(unity_sframe&, const std::string&)
43  std::shared_ptr<unity_sgraph_base> add_vertices_from_file(const std::string&, const std::string&, char, bool)
44  std::shared_ptr<unity_sgraph_base> add_edges_from_file(const std::string&, const std::string&, const std::string&, char, bool)
45  std::shared_ptr<unity_sgraph_base> add_edges(dataframe_t&, const std::string&, const std::string&)
46  std::shared_ptr<unity_sgraph_base> select_fields(const std::vector<std::string>&)
47  std::shared_ptr<unity_sgraph_base> copy_field(std::string, std::string)
48  std::shared_ptr<unity_sgraph_base> delete_field(std::string)
49 }
50 
51 #endif
52 
54  (options_map_t, summary, )
55  (std::vector<std::string>, get_vertex_fields, (size_t))
56  (std::vector<std::string>, get_edge_fields, (size_t)(size_t))
57  (std::vector<flex_type_enum>, get_vertex_field_types, (size_t))
58  (std::vector<flex_type_enum>, get_edge_field_types, (size_t)(size_t))
59 
60  (std::shared_ptr<unity_sframe_base>, get_vertices,
61  (const std::vector<flexible_type>&)(const options_map_t&)(size_t))
62  (std::shared_ptr<unity_sframe_base>, get_edges,
63  (const std::vector<flexible_type>&)
64  (const std::vector<flexible_type>&)
65  (const options_map_t&)(size_t)(size_t))
66  // (bool, save_graph_as_json, (std::string))
67  (bool, save_graph, (std::string)(std::string))
68  (bool, load_graph, (std::string))
69  (std::shared_ptr<unity_sgraph_base>, clone, )
70  (std::shared_ptr<unity_sgraph_base>, add_vertices, (std::shared_ptr<unity_sframe_base>)(const std::string&)(size_t))
71  (std::shared_ptr<unity_sgraph_base>, add_edges, (std::shared_ptr<unity_sframe_base>)(const std::string&)(const std::string&)(size_t)(size_t))
72 
73  (std::shared_ptr<unity_sgraph_base>, select_vertex_fields, (const std::vector<std::string>&)(size_t))
74  (std::shared_ptr<unity_sgraph_base>, copy_vertex_field, (std::string)(std::string)(size_t))
75  (std::shared_ptr<unity_sgraph_base>, add_vertex_field, (std::shared_ptr<unity_sarray_base>)(std::string))
76  (std::shared_ptr<unity_sgraph_base>, delete_vertex_field, (std::string)(size_t))
77  (std::shared_ptr<unity_sgraph_base>, rename_vertex_fields, (const std::vector<std::string>&)(const std::vector<std::string>&))
78  (std::shared_ptr<unity_sgraph_base>, swap_vertex_fields, (const std::string&)(const std::string&))
79 
80  (std::shared_ptr<unity_sgraph_base>, select_edge_fields, (const std::vector<std::string>&)(size_t)(size_t))
81  (std::shared_ptr<unity_sgraph_base>, add_edge_field, (std::shared_ptr<unity_sarray_base>)(std::string))
82  (std::shared_ptr<unity_sgraph_base>, copy_edge_field, (std::string)(std::string)(size_t)(size_t))
83  (std::shared_ptr<unity_sgraph_base>, delete_edge_field, (std::string)(size_t)(size_t))
84  (std::shared_ptr<unity_sgraph_base>, rename_edge_fields, (const std::vector<std::string>&)(const std::vector<std::string>&))
85  (std::shared_ptr<unity_sgraph_base>, swap_edge_fields, (const std::string&)(const std::string&))
86 
87  (std::shared_ptr<unity_sgraph_base>, lambda_triple_apply, (const std::string&)(const std::vector<std::string>&))
88  (std::shared_ptr<unity_sgraph_base>, lambda_triple_apply_native, (const function_closure_info&)(const std::vector<std::string>&))
89 )
90 
91 } // namespace turi
92 #endif // TURI_UNITY_GRAPH_INTERFACE_HPP
std::map< std::string, flexible_type > options_map_t
Definition: options_map.hpp:14
#define GENERATE_INTERFACE_AND_PROXY(base_name, proxy_name, functions)