|
Motion Master 6.0.0-alpha.86
Next-generation motion control software
|
The handle a procedure body uses to report where it has got to. More...
#include <procedure.h>
Public Member Functions | |
| ProgressReporter (std::vector< ProgressStep > steps) | |
| Seeds the reporter from a procedure's step template. | |
| void | start (std::string_view id) |
Marks the step id as running, clearing any value or error left by a previous run. | |
| void | succeed (std::string_view id) |
Marks the step id as succeeded with no value — the step did something rather than measured something. | |
| template<typename T > | |
| void | succeed (std::string_view id, const T &value) |
Marks the step id as succeeded, recording what it produced. | |
| void | succeed (std::string_view id, nlohmann::json value) |
Marks the step id as succeeded with an already-built JSON value. | |
| void | fail (std::string_view id, std::string error) |
Marks the step id as failed, recording error as the reason. | |
| std::vector< ProgressStep > | steps () const |
A copy of the current step array — the snapshot's steps. | |
The handle a procedure body uses to report where it has got to.
A body is a plain function over one of these — runXxx(SomanetDrive&, ProgressReporter&,
std::stop_token) — which is what keeps the orchestration transport-free and testable: a test drives the body with its own reporter and asserts the resulting step array, with no manager, no thread, and no HTTP anywhere near it.
Seeded from the procedure's step template (ids in order, all kIdle) and mutated in place as the run progresses. Thread-safe: the body writes from its own thread while a poll reads steps from an HTTP thread.
|
inlineexplicit |
Seeds the reporter from a procedure's step template.
| void mm::node::ProgressReporter::fail | ( | std::string_view | id, |
| std::string | error | ||
| ) |
Marks the step id as failed, recording error as the reason.
| void mm::node::ProgressReporter::start | ( | std::string_view | id | ) |
Marks the step id as running, clearing any value or error left by a previous run.
| std::vector< ProgressStep > mm::node::ProgressReporter::steps | ( | ) | const |
A copy of the current step array — the snapshot's steps.
| void mm::node::ProgressReporter::succeed | ( | std::string_view | id | ) |
Marks the step id as succeeded with no value — the step did something rather than measured something.
|
inline |
Marks the step id as succeeded, recording what it produced.
value is anything convertible to JSON: a number, a string, a byte vector, or — the usual case for a measurement — a procedure-specific struct with its own to_json declared beside the procedure. The conversion happens here so each body keeps its own typed vocabulary without every procedure needing a distinct step or snapshot type.
| void mm::node::ProgressReporter::succeed | ( | std::string_view | id, |
| nlohmann::json | value | ||
| ) |
Marks the step id as succeeded with an already-built JSON value.