Turi Create  4.0
toolkit_function_response.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_TOOLKIT_RESPONSE_TYPE_HPP
7 #define TURI_UNITY_TOOLKIT_RESPONSE_TYPE_HPP
8 #include <string>
9 #include <model_server/lib/variant.hpp>
10 #include <core/storage/serialization/serialization_includes.hpp>
11 
12 namespace turi {
13 
14 /**
15  * \ingroup unity
16  * The response from a toolkit
17  */
19  /**
20  * Whether the toolkit was executed successfully
21  */
22  bool success = true;
23 
24  /**
25  * Any other messages to be printed.
26  */
27  std::string message;
28 
29  /**
30  * The returned parameters. (Details will vary from toolkit to toolkit)
31  */
32  variant_map_type params;
33 
34  void save(oarchive& oarc) const {
35  log_func_entry();
36  oarc << success << message << params;
37  }
38 
39  void load(iarchive& iarc) {
40  log_func_entry();
41  iarc >> success >> message >> params;
42  }
43 };
44 
45 
46 
47 } // turicreate
48 
49 #endif // TURI_UNITY_TOOLKIT_RESPONSE_TYPE_HPP
The serialization input archive object which, provided with a reference to an istream, will read from the istream, providing deserialization capabilities.
Definition: iarchive.hpp:60
The serialization output archive object which, provided with a reference to an ostream, will write to the ostream, providing serialization capabilities.
Definition: oarchive.hpp:80