Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
mm::node::ProcedureCatalogueEntry Struct Reference

One procedure, as the catalogue knows it: what it is, who has it, and how to run it. More...

#include <procedure_catalogue.h>

Collaboration diagram for mm::node::ProcedureCatalogueEntry:
[legend]

Public Attributes

ProcedureDescriptor descriptor
 What a client is told about it.
 
std::function< bool(Device &device)> applies
 Whether device supports this procedure.
 
std::function< std::expected< ProcedureBody, std::string >(const nlohmann::json &request)> makeBody
 Turns a client's request into the body that will run.
 

Detailed Description

One procedure, as the catalogue knows it: what it is, who has it, and how to run it.

Member Data Documentation

◆ applies

std::function<bool(Device& device)> mm::node::ProcedureCatalogueEntry::applies

Whether device supports this procedure.

Normally a profile check — an OS command procedure asks whether a SomanetDrive binds. It is what keeps a vendor's procedures off a third-party device's list instead of offering controls that could only ever fail, and it is why the list is per device rather than global.

◆ descriptor

ProcedureDescriptor mm::node::ProcedureCatalogueEntry::descriptor

What a client is told about it.

◆ makeBody

std::function<std::expected<ProcedureBody, std::string>(const nlohmann::json& request)> mm::node::ProcedureCatalogueEntry::makeBody

Turns a client's request into the body that will run.

Where a procedure's parameter validation lives, which is why it returns a plain string error: the caller reports it verbatim as a bad request. A procedure taking no parameters ignores the argument (an absent request body arrives as an empty object, so it need not be sent at all).

The variant is which of the two body shapes the procedure needs: almost all take a borrowed Device&, while one that must change AL state takes the manager and borrows per step (see overload, so the choice costs an entry nothing but naming the right signature.


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