Turi Create  4.0
turi::toolkit_class_registry Class Reference

#include <model_server/lib/toolkit_class_registry.hpp>

Public Types

typedef std::map< std::string, flexible_typetoolkit_class_description_type
 

Public Member Functions

bool register_toolkit_class (const std::string &class_name, std::function< model_base *()> constructor, toolkit_class_description_type description=toolkit_class_description_type())
 
bool register_toolkit_class (std::vector< toolkit_class_specification > classes, std::string prefix="")
 
std::shared_ptr< model_baseget_toolkit_class (const std::string &class_name)
 
std::map< std::string, flexible_typeget_toolkit_class_description (const std::string &toolkit_class_name)
 
std::vector< std::string > available_toolkit_classes ()
 

Detailed Description

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

Definition at line 17 of file toolkit_class_registry.hpp.

Member Typedef Documentation

◆ toolkit_class_description_type

Register a model (name, constructor) pair.

Returns false if the model name already exists.

The optional "description" argument describing the model. The following keys are recognized.

  • "functions": A dictionary with key: function name, and value, a list of input parameters.
  • "get_properties": The list of all readable properties of the model
  • "set_properties": The list of all writable properties of the model

Definition at line 31 of file toolkit_class_registry.hpp.

Member Function Documentation

◆ available_toolkit_classes()

std::vector<std::string> turi::toolkit_class_registry::available_toolkit_classes ( )

Returns a list of names of all registered models.

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

◆ get_toolkit_class()

std::shared_ptr<model_base> turi::toolkit_class_registry::get_toolkit_class ( const std::string &  class_name)

Creates a new model object with the given model_name.

Throws an exception if the model_name was not registered.

◆ get_toolkit_class_description()

std::map<std::string, flexible_type> turi::toolkit_class_registry::get_toolkit_class_description ( const std::string &  toolkit_class_name)

Returns the description associated with the model.

Throws an exception if the model_name was not registered.

◆ register_toolkit_class() [1/2]

bool turi::toolkit_class_registry::register_toolkit_class ( const std::string &  class_name,
std::function< model_base *()>  constructor,
toolkit_class_description_type  description = toolkit_class_description_type() 
)

Registers a toolkit class.

◆ register_toolkit_class() [2/2]

bool turi::toolkit_class_registry::register_toolkit_class ( std::vector< toolkit_class_specification classes,
std::string  prefix = "" 
)

Registers a toolkit class.


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