Turi Create
4.0
toolkit_function_specification.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_TOOLKIT_FUNCTION_SPECIFICATION_HPP
7
#define TURI_TOOLKIT_FUNCTION_SPECIFICATION_HPP
8
#include <string>
9
#include <functional>
10
#include <model_server/lib/toolkit_function_response.hpp>
11
#include <model_server/lib/toolkit_function_invocation.hpp>
12
namespace
turi
{
13
14
15
/**
16
* \ingroup unity
17
* Each toolkit is specified by filling in \ref toolkit_function_specification struct.
18
* The contents of the struct describe user-facing documentation and default
19
* options, as well as a callback to actual toolkit execution.
20
*/
21
struct
toolkit_function_specification
{
22
/**
23
* A short name used to identify this toolkit. For instance,
24
* LDA, or PageRank.
25
*/
26
std::string
name
;
27
28
/**
29
* A list of required configurable parameters and their default values.
30
*/
31
variant_map_type
default_options
;
32
33
/**
34
* Toolkit properties.
35
* The following keys are recognized:
36
* - "arguments": value must a flex_list containing a list of
37
* the argument names.
38
* - "file": The file which the toolkit was loaded from
39
* - "documentation": A documentation string
40
*/
41
std::map<std::string, flexible_type>
description
;
42
43
/**
44
* A pointer to the actual execution function. All parameters to the
45
* execution are passed in the \ref toolkit_function_invocation struct.
46
* Returns an std::pair<bool, options_map> with status results.
47
*
48
* \note this can be generated easily using toolkit_function_wrapper_impl::make_spec
49
*/
50
std::function<toolkit_function_response_type(toolkit_function_invocation&)>
toolkit_execute_function
;
51
52
/**
53
* A pointer to a simple version of the toolkit execution function which can be
54
* executed natively without a toolkit_function_invocation. It will not have
55
* some of the error management/reporting capabilities of the invocation object,
56
* and does not have named parameters. But it is much simpler.
57
*/
58
std::function<variant_type(const std::vector<variant_type>& invoke)>
native_execute_function
;
59
};
60
61
}
// namespace turi
62
63
#endif
turi::toolkit_function_specification::native_execute_function
std::function< variant_type(const std::vector< variant_type > &invoke)> native_execute_function
Definition:
toolkit_function_specification.hpp:58
turi::toolkit_function_specification::description
std::map< std::string, flexible_type > description
Definition:
toolkit_function_specification.hpp:41
turi
SKD.
Definition:
capi_initialization.hpp:11
turi::toolkit_function_specification
Definition:
toolkit_function_specification.hpp:21
turi::toolkit_function_specification::toolkit_execute_function
std::function< toolkit_function_response_type(toolkit_function_invocation &)> toolkit_execute_function
Definition:
toolkit_function_specification.hpp:50
turi::toolkit_function_specification::default_options
variant_map_type default_options
Definition:
toolkit_function_specification.hpp:31
turi::toolkit_function_specification::name
std::string name
Definition:
toolkit_function_specification.hpp:26
model_server
lib
toolkit_function_specification.hpp
Generated by
1.8.13