ContractRegistry.h File
Contract registry for builder-level validation. More...
Included Headers
#include <memory>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include "contracts/Contract.h"
#include "contracts/ValidationReport.h"
Namespaces Index
| namespace | simaai |
| namespace | neat |
Classes Index
| class | ContractRegistry |
|
Holds a set of Contracts and runs them to produce a ValidationReport. More... | |
Description
Contract registry for builder-level validation.
ContractRegistry aggregates a deterministic, ordered set of Contracts and runs them all against a NodeGroup to produce a single ValidationReport. It is the entry point used by the Builder/Session at validate()/run() time and by CI tools that want to check a pipeline without going to PLAYING.
- See Also
Validators::DefaultRegistry
File Listing
The file content with the documentation metadata removed is:
23#include "contracts/Contract.h"
24#include "contracts/ValidationReport.h"
26namespace simaai::neat {
40class ContractRegistry final {
43 using ContractPtr = std::shared_ptr<Contract>;
46 ContractRegistry() = default;
49 ContractRegistry& add(ContractPtr c) {
65 template <class T, class... Args> ContractRegistry& emplace(Args&&... args) {
66 return add(std::make_shared<T>(std::forward<Args>(args)...));
102 ContractPtr get(const std::string& id) const {
119 ValidationReport validate(const NodeGroup& nodes, const ValidationContext& ctx) const {
120 ValidationReport report;
128 report.note_contract_run(id);
133 report.add_issue({
134 .severity = ValidationSeverity::Error,
141 report.add_issue({
142 .severity = ValidationSeverity::Error,
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.