ContractRegistry Class
Holds a set of Contracts and runs them to produce a ValidationReport. More...
Declaration
Included Headers
Public Member Typedefs Index
| using | ContractPtr = std::shared_ptr< Contract > |
Public Constructors Index
| ContractRegistry ()=default | |
Public Member Functions Index
| ContractRegistry & | add (ContractPtr c) |
|
Add/replace a contract by id(). More... | |
template <class T, class... Args> | |
| ContractRegistry & | emplace (Args &&... args) |
|
Convenience: construct + add. More... | |
| bool | remove (const std::string &id) |
|
Remove a contract by id. Returns true if removed. More... | |
| void | clear () |
| std::size_t | size () const noexcept |
| bool | empty () const noexcept |
| ContractPtr | get (const std::string &id) const |
|
Get a contract by id (nullptr if missing). More... | |
| std::vector< std::string > | ids () const |
|
Deterministic list of ids in insertion order. More... | |
| ValidationReport | validate (const NodeGroup &nodes, const ValidationContext &ctx) const |
|
Run all contracts and return a ValidationReport. More... | |
Private Member Attributes Index
| std::unordered_map< std::string, ContractPtr > | by_id_ |
| std::vector< std::string > | order_ |
Description
Holds a set of Contracts and runs them to produce a ValidationReport.
This is intentionally small and STL-only.
Definition at line 25 of file ContractRegistry.h.
Public Member Typedefs
ContractPtr
|
Definition at line 27 of file ContractRegistry.h.
Public Constructors
ContractRegistry()
| default |
Definition at line 29 of file ContractRegistry.h.
Public Member Functions
add()
| inline |
Add/replace a contract by id().
Definition at line 32 of file ContractRegistry.h.
clear()
| inline |
Definition at line 69 of file ContractRegistry.h.
emplace()
| inline |
Convenience: construct + add.
Definition at line 48 of file ContractRegistry.h.
empty()
| inline noexcept |
Definition at line 77 of file ContractRegistry.h.
get()
| inline |
Get a contract by id (nullptr if missing).
Definition at line 82 of file ContractRegistry.h.
ids()
| inline |
Deterministic list of ids in insertion order.
Definition at line 88 of file ContractRegistry.h.
remove()
| inline |
Remove a contract by id. Returns true if removed.
Definition at line 53 of file ContractRegistry.h.
size()
| inline noexcept |
Definition at line 74 of file ContractRegistry.h.
validate()
| inline |
Run all contracts and return a ValidationReport.
Defensive behavior:
- contract violations should be reported (not thrown)
- if a Contract throws, registry converts that into an internal ERROR issue
Definition at line 99 of file ContractRegistry.h.
Private Member Attributes
by_id_
|
Definition at line 135 of file ContractRegistry.h.
order_
|
Definition at line 136 of file ContractRegistry.h.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.1.