EasyLocalAPI reference iolab-uniud/easylocal

easylocal::rest::app_blueprint

A Crow blueprint that serves an app over HTTP, with its runs executed by a pool of worker threads.

Synopsis

Declared in <easylocal/adapters/rest/blueprint.hpp>

template<
    std::copy_constructible App,
    detail::blueprint_codec<App> Codec>
class app_blueprint;

Description

Its routes list the runners and the parameters, submit a run of a runner (each on its own Session, with optional seed, parameter overrides, target and initial solution), report its state, progress and solution (with a cost::pareto cost, its front too), cancel it and forget it. It is neither copyable nor movable, since its routes refer to it: keep it alive as long as the Crow app uses its blueprint. Calls to the codec are serialized.

Each value goes through the codec when it has the member, or else through the problem's text hook, as a JSON string: the Input by decode_input(json) or read_input, a solution by encode_solution(input, solution) or write_solution, a cost by encode_cost(cost) or as a JSON number (cost::to_text for a structured cost), an initial solution by decode_initial_solution(input, json) or read_solution, a target by decode_cost(json) or the text of read_cost. Requires a copyable app and, for the Input, the solution and the cost, a codec member or a text hook.

Type Aliases

NameDescription
app_type The app served.
bound_app_type The app bound to an Input, as bind() returns it.
codec_type The codec that turns the problem's values into JSON and back.
cost_type The cost of a solution.
input_type The Input of the problem.
session_type The Session that executes one run.
solution_manager_type The solution manager of the bound app.
solution_type The Solution of the problem.

Member Functions

NameDescription
app_blueprint [constructor] [deleted]Not copyable or movable: its routes refer to it.
app_blueprint [constructor] [deleted]Not copyable or movable: its routes refer to it.
app_blueprint [constructor]From the prefix of its routes, the app, the codec and the options.
~app_blueprint [destructor]Stops the runs: those queued end cancelled without starting, those running stop at their next check; then waits for them.
operator= [deleted]Not copyable or movable: its routes refer to it.
operator= [deleted]Not copyable or movable: its routes refer to it.
crow_blueprint The Crow blueprint, to register on a Crow app.
prefix The prefix of the routes, without leading and trailing slashes.

Non-Member Functions

NameDescription
blueprintThe app_blueprint that serves the app with the codec under the prefix.
blueprintThe app_blueprint that serves the app under the prefix through the problem's text hooks, without a codec (text_codec).