|
TraceMaker
C++ API of the engine
|
Classes | |
| struct | Region |
| struct | Advice |
| struct | Applied |
| What the router is given for an advice file, and what each hint became (for the log, the summary and the viewer). More... | |
| struct | AliasMap |
| Aliases for net names and part references (a redacted stuck report): the advice an advisor writes uses the aliases, and unalias puts the board's names back before the references are checked. More... | |
| struct | ProcessResult |
| struct | AdvisorOptions |
| struct | Consulted |
| struct | StuckInput |
| struct | StuckReport |
Functions | |
| Advice | parse_advice (std::string_view json_text, const std::string &source="advice") |
| Parses and validates the text of an advice file. Throws std::runtime_error naming source and the entry ("regions[1].rect"). | |
| Advice | load_advice_file (const std::string &path) |
| Reads a file (size-limited); throws on a missing file or a syntax or content error. | |
| void | check_advice_refs (const Advice &a, const model::Board &b, std::vector< std::string > *warnings=nullptr) |
| Checks every name against the board: nets, pads (REF.NUM, on one net), copper layers. | |
| Applied | apply_advice (const Advice &a, const model::Board &b) |
| check_advice_refs, then the RouterOptions::AdviceSet: layer masks and costs, and for each region a rule area plus disallow rules (doc 05 §34) that name its nets. | |
| nlohmann::json | advice_to_json (const Advice &a) |
| The advice as JSON, with the board's real names: what is saved beside the output so that --advice FILE repeats a run. | |
| nlohmann::json | advice_schema () |
| The hint types an advisor may use, as JSON (goes into the stuck report so an advisor adapts to the engine it talks to). | |
| void | unalias (Advice &a, const AliasMap &m) |
| ProcessResult | run_process (const std::string &command, const std::string &input, double timeout_s, std::size_t max_out=std::size_t{1}<< 20, std::size_t max_err=std::size_t{1}<< 16) |
| Runs command with /bin/sh -c in its own process group, feeds it input on stdin, and collects stdout (at most max_out bytes) and stderr (at most max_err). | |
| Consulted | consult_advisor (const AdvisorOptions &opt, const nlohmann::json &report, const AliasMap &aliases, const std::string &advice_name) |
| Sends report to the advisor and reads its advice. | |
| StuckReport | build_stuck_report (const StuckInput &in) |
Variables | |
| constexpr std::size_t | kMaxFirstNets = 64 |
| Upper bounds on what one file may ask for (an advisor is not trusted to be sensible, doc 17 §6). | |
| constexpr std::size_t | kMaxPriority = 512 |
| constexpr std::size_t | kMaxRegions = 24 |
| constexpr std::size_t | kMaxPolygon = 64 |
| constexpr std::size_t | kMaxRegionNets = 64 |
| constexpr std::size_t | kMaxNote = 2000 |
| constexpr int | kMaxVariants = 8 |
| constexpr int | kDefaultVariants = 4 |
| nlohmann::json tmk::advice::advice_schema | ( | ) |
The hint types an advisor may use, as JSON (goes into the stuck report so an advisor adapts to the engine it talks to).
| nlohmann::json tmk::advice::advice_to_json | ( | const Advice & | a | ) |
The advice as JSON, with the board's real names: what is saved beside the output so that --advice FILE repeats a run.
| Applied tmk::advice::apply_advice | ( | const Advice & | a, |
| const model::Board & | b ) |
check_advice_refs, then the RouterOptions::AdviceSet: layer masks and costs, and for each region a rule area plus disallow rules (doc 05 §34) that name its nets.
a is not changed.
| StuckReport tmk::advice::build_stuck_report | ( | const StuckInput & | in | ) |
| void tmk::advice::check_advice_refs | ( | const Advice & | a, |
| const model::Board & | b, | ||
| std::vector< std::string > * | warnings = nullptr ) |
Checks every name against the board: nets, pads (REF.NUM, on one net), copper layers.
Throws std::runtime_error listing the unknown ones with a "did you mean" where one is close. Warnings (entries without effect) go to warnings.
| Consulted tmk::advice::consult_advisor | ( | const AdvisorOptions & | opt, |
| const nlohmann::json & | report, | ||
| const AliasMap & | aliases, | ||
| const std::string & | advice_name ) |
Sends report to the advisor and reads its advice.
The command line itself is not logged or put in the summary (it may carry credentials); only the program name is.
| Advice tmk::advice::load_advice_file | ( | const std::string & | path | ) |
Reads a file (size-limited); throws on a missing file or a syntax or content error.
| Advice tmk::advice::parse_advice | ( | std::string_view | json_text, |
| const std::string & | source = "advice" ) |
Parses and validates the text of an advice file. Throws std::runtime_error naming source and the entry ("regions[1].rect").
| ProcessResult tmk::advice::run_process | ( | const std::string & | command, |
| const std::string & | input, | ||
| double | timeout_s, | ||
| std::size_t | max_out = std::size_t{1}<< 20, | ||
| std::size_t | max_err = std::size_t{1}<< 16 ) |
Runs command with /bin/sh -c in its own process group, feeds it input on stdin, and collects stdout (at most max_out bytes) and stderr (at most max_err).
After timeout_s seconds the whole group is killed.
|
inlineconstexpr |
Definition at line 54 of file advice.hpp.
|
inlineconstexpr |
Upper bounds on what one file may ask for (an advisor is not trusted to be sensible, doc 17 §6).
Definition at line 47 of file advice.hpp.
|
inlineconstexpr |
Definition at line 52 of file advice.hpp.
|
inlineconstexpr |
Definition at line 50 of file advice.hpp.
|
inlineconstexpr |
Definition at line 48 of file advice.hpp.
|
inlineconstexpr |
Definition at line 51 of file advice.hpp.
|
inlineconstexpr |
Definition at line 49 of file advice.hpp.
|
inlineconstexpr |
Definition at line 53 of file advice.hpp.