Canonical step vocabulary owner and runtime handler router. 更多...
#include <StepKindRegistry.h>
Public 成员函数 | |
| eve::Result< void > | registerStep (StepKindDescriptor descriptor) |
| Declare one step type. | |
| eve::Result< void > | registerHandler (std::string_view type, StepHandler handler) |
| Bind an owning handler to an already declared step type. | |
| void | unregisterStep (std::string_view type) |
| Remove a step type and its handler; absent types are a no-op. | |
| bool | contains (std::string_view type) const |
Return whether type is declared. | |
| const StepKindDescriptor * | descriptor (std::string_view type) const |
Return the declared contract for type. | |
| std::vector< StepKindDescriptor > | descriptors () const |
| Return every declared contract in lexical type order. | |
| bool | hasHandler (std::string_view type) const |
Return whether a handler is bound for type. | |
| eve::Result< void > | validate (const SequenceNode &node) const |
| Validate one node against its declared payload schema. | |
| StepOutcome | dispatch (const SequenceNode &node, const StepContext &context) const |
| Route one already validated node to its handler. | |
详细描述
Canonical step vocabulary owner and runtime handler router.
Descriptors are the single source of truth for a step type's payload fields: the compiler validates authored steps against them and authoring tools derive their field lists from them, so no second field table exists.
All methods are owner-thread-only. Handlers are invoked synchronously without locks and must not retain their arguments.
在文件 StepKindRegistry.h 第 108 行定义.
成员函数说明
◆ contains()
| bool eve::dnut::StepKindRegistry::contains | ( | std::string_view | type | ) | const |
Return whether type is declared.
在文件 StepKindRegistry.cpp 第 87 行定义.
引用了 type.
被这些函数引用 eve::dnut::compileDnutConversations() , 以及 eve::dialogue::validateDialogueSequenceAsset().
◆ descriptor()
| const StepKindDescriptor * eve::dnut::StepKindRegistry::descriptor | ( | std::string_view | type | ) | const |
Return the declared contract for type.
- 返回
- Borrowed pointer owned by this registry; nullptr when absent. @ownership Borrowed. @nullable Yes. @lifetime Invalidated by registerStep or unregisterStep of the same type.
在文件 StepKindRegistry.cpp 第 89 行定义.
◆ descriptors()
| std::vector< StepKindDescriptor > eve::dnut::StepKindRegistry::descriptors | ( | ) | const |
Return every declared contract in lexical type order.
在文件 StepKindRegistry.cpp 第 94 行定义.
◆ dispatch()
| StepOutcome eve::dnut::StepKindRegistry::dispatch | ( | const SequenceNode & | node, |
| const StepContext & | context | ||
| ) | const |
Route one already validated node to its handler.
- 参数
-
node Node to execute; its payload is NOT re-validated here. context Borrowed execution context valid only for this call.
- 返回
- The handler outcome. A host-presented
Awaittype (declared without a handler) returnsBlocked; an unknown or unhandledInstanttype returnsFailedrather than a silent success. @thread Owner thread only; the handler runs synchronously. @reentrancy Handlers must not re-enter the dispatching runtime.
在文件 StepKindRegistry.cpp 第 150 行定义.
引用了 eve::dnut::Await, eve::dnut::Blocked, context, descriptor, eve::dnut::StepOutcome::error, eve::dnut::Failed, handler, node , 以及 eve::dnut::StepOutcome::status.
◆ hasHandler()
| bool eve::dnut::StepKindRegistry::hasHandler | ( | std::string_view | type | ) | const |
Return whether a handler is bound for type.
在文件 StepKindRegistry.cpp 第 101 行定义.
引用了 type.
被这些函数引用 validate().
◆ registerHandler()
| eve::Result< void > eve::dnut::StepKindRegistry::registerHandler | ( | std::string_view | type, |
| StepHandler | handler | ||
| ) |
Bind an owning handler to an already declared step type.
- 返回
- Success, or a structured failure when the type is not declared.
- 备注
- An
Instanttype must have a handler before it can be validated; anAwaittype may remain host-presented and unhandled.
在文件 StepKindRegistry.cpp 第 69 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), handler, eve::InvalidArgument, key, eve::NotFound, eve::Result< T >::success() , 以及 type.
◆ registerStep()
| eve::Result< void > eve::dnut::StepKindRegistry::registerStep | ( | StepKindDescriptor | descriptor | ) |
Declare one step type.
- 参数
-
descriptor Owning contract; typemust be a non-empty bare word.
- 返回
- Success, or a structured failure for an empty/duplicate type. @thread Owner thread only; no synchronization is performed. @reentrancy Invokes no callbacks.
在文件 StepKindRegistry.cpp 第 52 行定义.
引用了 eve::AlreadyExists, descriptor, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument , 以及 eve::Result< T >::success().
◆ unregisterStep()
| void eve::dnut::StepKindRegistry::unregisterStep | ( | std::string_view | type | ) |
Remove a step type and its handler; absent types are a no-op.
在文件 StepKindRegistry.cpp 第 81 行定义.
◆ validate()
| eve::Result< void > eve::dnut::StepKindRegistry::validate | ( | const SequenceNode & | node | ) | const |
Validate one node against its declared payload schema.
Rejects an unknown step type, a non-object payload, a missing or ill-typed required field, and any undeclared field. An Instant type without a bound handler is rejected because it could never run.
- 返回
- Success, or a structured diagnostic naming the violating field. @thread Owner thread only.
在文件 StepKindRegistry.cpp 第 103 行定义.
引用了 descriptor, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Value::find(), hasHandler(), eve::dnut::Instant, eve::InvalidArgument, key, node, eve::NotFound, eve::PreconditionViolation, eve::Result< T >::success(), eve::editing::Value::type() , 以及 value.
被这些函数引用 eve::dnut::compileDnutConversations() , 以及 eve::dialogue::validateDialogueSequenceAsset().
该类的文档由以下文件生成:
- src/modules/dnut_interpreter/StepKindRegistry.h
- src/modules/dnut_interpreter/StepKindRegistry.cpp