Turi Create  4.0
turi::toolkit_function_registry Class Reference

#include <model_server/lib/toolkit_function_registry.hpp>

Public Member Functions

bool register_toolkit_function (toolkit_function_specification spec, std::string prefix="")
 
bool register_toolkit_function (std::vector< toolkit_function_specification > spec, std::string prefix="")
 
bool unregister_toolkit_function (std::string name)
 
const toolkit_function_specificationget_toolkit_function_info (std::string toolkit_fn_name)
 
std::function< variant_type(const std::vector< variant_type > &)> get_native_function (std::string name)
 
std::function< variant_type(const std::vector< variant_type > &)> get_native_function (const function_closure_info &name)
 
std::vector< std::string > available_toolkit_functions ()
 

Detailed Description

Defines a collection of toolkits. Has the ability to add/register new toolkits, and get information about the toolkits.

Definition at line 19 of file toolkit_function_registry.hpp.

Member Function Documentation

◆ available_toolkit_functions()

std::vector<std::string> turi::toolkit_function_registry::available_toolkit_functions ( )

Returns a list of names of all registered toolkits.

Returns
A vector of string where each string is a toolkit name.

◆ get_native_function() [1/2]

std::function<variant_type(const std::vector<variant_type>&)> turi::toolkit_function_registry::get_native_function ( std::string  name)

Returns the natively callable version of a toolkit function if available. Raises an exception otherwise.

◆ get_native_function() [2/2]

std::function<variant_type(const std::vector<variant_type>&)> turi::toolkit_function_registry::get_native_function ( const function_closure_info name)

Returns the natively callable version of a toolkit function with closure information associated. Raises an exception otherwise.

◆ get_toolkit_function_info()

const toolkit_function_specification* turi::toolkit_function_registry::get_toolkit_function_info ( std::string  toolkit_fn_name)

Gets the complete specification infomation about a toolkit.

Returns
Returns a pointer to the toolkit_function_specification on success. Returns NULL if a toolkit with the specified name has not been registered.
Note
Registering, or unregistering toolkits invalidates this pointer.

◆ register_toolkit_function() [1/2]

bool turi::toolkit_function_registry::register_toolkit_function ( toolkit_function_specification  spec,
std::string  prefix = "" 
)

Registers a toolkit specification. See toolkit_function_specification for details. After registration, information about the toolkit will be queryable via the other toolkit_function_registry function. unregister_toolkit_function will remove the toolkit from the registry.

Returns
Returns true on success. Returns false if some other toolkit with the same name has already been registered.

◆ register_toolkit_function() [2/2]

bool turi::toolkit_function_registry::register_toolkit_function ( std::vector< toolkit_function_specification spec,
std::string  prefix = "" 
)

Registers a collection of toolkit specifications. See toolkit_function_specification for details. After registration, information about the toolkits will be queryable via the other toolkit_function_registry function. unregister_toolkit_function will remove the toolkit from the registry.

Returns
Returns true on success. Returns false if some other toolkit with the same name has already been registered, in which case, none of the toolkits listed in spec will be registered.

◆ unregister_toolkit_function()

bool turi::toolkit_function_registry::unregister_toolkit_function ( std::string  name)

Unregisters a previously registered toolkit.

Returns
Returns true on success. Returns false if a toolkit with the specified name has not been registered.

The documentation for this class was generated from the following file: