Mutable fact bag that doubles as a read-only Condition evaluation context. 更多...
#include <FactStore.h>
Public 成员函数 | |
| void | clear () |
| Clear every fact without invoking callbacks. | |
| FactChange | setValue (std::string key, eve::Value value) |
| Set a compare/value fact. | |
| FactChange | setTag (std::string tag, bool present) |
| Set tag membership; present=true means the tag exists. | |
| FactChange | setAttribute (std::string key, eve::Value value) |
| Set an attribute value. | |
| FactChange | setResource (std::string key, eve::Value value) |
| Set a resource value. | |
| FactChange | setState (std::string key, eve::Value value) |
| Set a state value. | |
| FactChange | setAuthority (std::string scope, bool granted) |
| Set authority for a scope. | |
| FactChange | setPolicy (std::string name, decision::ConditionResult result) |
| Register or replace a read-only policy result. | |
| FactChange | clearValue (std::string_view key) |
| Erase a value fact. | |
| FactChange | clearTag (std::string_view tag) |
| Erase a tag fact. | |
| std::optional< eve::Value > | value (std::string_view key) const override |
| Query a named scalar or structured value for Compare nodes. | |
| std::optional< bool > | hasTag (std::string_view tag) const override |
| Query tag membership; nullopt means the tag source is unavailable. | |
| std::optional< eve::Value > | attribute (std::string_view key) const override |
| Query an attribute value; nullopt means the attribute is absent. | |
| std::optional< eve::Value > | resource (std::string_view key) const override |
| Query a resource amount or resource marker. | |
| std::optional< eve::Value > | state (std::string_view key) const override |
| Query a state value for StateEquals nodes. | |
| std::optional< bool > | authority (std::string_view scope) const override |
| Query authority without changing grants, leases, or state. | |
| std::optional< decision::ConditionResult > | policy (std::string_view name, const eve::Value &arguments) const override |
| Evaluate a named read-only policy with owned arguments. | |
| std::string | snapshotJson () const |
| Export deterministic compact JSON for runtime snapshots. | |
| eve::Result< void > | restoreJson (std::string_view json) |
| Transactionally restore facts from a snapshot produced by snapshotJson(). | |
| int | valueCount () const noexcept |
| Number of stored value facts. | |
Public 成员函数 继承自 eve::decision::EvaluationContext | |
| virtual | ~EvaluationContext ()=default |
| Releases EvaluationContext resources. | |
详细描述
Mutable fact bag that doubles as a read-only Condition evaluation context.
FactStore is the sole owner of rule-visible values. Mutations report whether the stored value changed so the RuleEngine can wake only interested watchers.
@thread Owning simulation thread only; no synchronization is performed. @reentrancy Does not invoke callbacks.
在文件 FactStore.h 第 60 行定义.
成员函数说明
◆ attribute()
|
overridevirtual |
Query an attribute value; nullopt means the attribute is absent.
实现了 eve::decision::EvaluationContext.
在文件 FactStore.cpp 第 228 行定义.
引用了 key.
◆ authority()
|
overridevirtual |
Query authority without changing grants, leases, or state.
实现了 eve::decision::EvaluationContext.
在文件 FactStore.cpp 第 243 行定义.
引用了 scope.
◆ clear()
| void eve::emergence::FactStore::clear | ( | ) |
Clear every fact without invoking callbacks.
在文件 FactStore.cpp 第 156 行定义.
◆ clearTag()
| FactChange eve::emergence::FactStore::clearTag | ( | std::string_view | tag | ) |
Erase a tag fact.
在文件 FactStore.cpp 第 214 行定义.
引用了 eve::emergence::Changed, tag , 以及 eve::emergence::Unchanged.
◆ clearValue()
| FactChange eve::emergence::FactStore::clearValue | ( | std::string_view | key | ) |
Erase a value fact.
在文件 FactStore.cpp 第 210 行定义.
引用了 eve::emergence::Changed, key , 以及 eve::emergence::Unchanged.
◆ hasTag()
|
overridevirtual |
Query tag membership; nullopt means the tag source is unavailable.
实现了 eve::decision::EvaluationContext.
在文件 FactStore.cpp 第 223 行定义.
引用了 tag.
◆ policy()
|
overridevirtual |
Evaluate a named read-only policy with owned arguments.
实现了 eve::decision::EvaluationContext.
在文件 FactStore.cpp 第 248 行定义.
引用了 name.
◆ resource()
|
overridevirtual |
Query a resource amount or resource marker.
实现了 eve::decision::EvaluationContext.
在文件 FactStore.cpp 第 233 行定义.
引用了 key.
◆ restoreJson()
| eve::Result< void > eve::emergence::FactStore::restoreJson | ( | std::string_view | json | ) |
Transactionally restore facts from a snapshot produced by snapshotJson().
- 返回
- Success, or structured failure leaving the prior store unchanged.
在文件 FactStore.cpp 第 282 行定义.
引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Value::fromJson(), eve::InvalidArgument, key, object, r, setAttribute(), setAuthority(), setPolicy(), setResource(), setState(), setTag(), setValue(), eve::Status::success(), eve::Result< T >::success(), eve::UnknownVersion , 以及 value.
◆ setAttribute()
| FactChange eve::emergence::FactStore::setAttribute | ( | std::string | key, |
| eve::Value | value | ||
| ) |
Set an attribute value.
在文件 FactStore.cpp 第 176 行定义.
引用了 key, eve::emergence::Unchanged , 以及 value.
被这些函数引用 restoreJson().
◆ setAuthority()
| FactChange eve::emergence::FactStore::setAuthority | ( | std::string | scope, |
| bool | granted | ||
| ) |
Set authority for a scope.
在文件 FactStore.cpp 第 191 行定义.
引用了 scope , 以及 eve::emergence::Unchanged.
被这些函数引用 restoreJson().
◆ setPolicy()
| FactChange eve::emergence::FactStore::setPolicy | ( | std::string | name, |
| decision::ConditionResult | result | ||
| ) |
Register or replace a read-only policy result.
- 返回
- FactChange::Changed when the stored result differed.
在文件 FactStore.cpp 第 196 行定义.
引用了 eve::emergence::Changed, eve::decision::ConditionResult::evidence(), name, eve::decision::ConditionResult::passed(), eve::decision::ConditionResult::reasonCode() , 以及 eve::emergence::Unchanged.
被这些函数引用 restoreJson().
◆ setResource()
| FactChange eve::emergence::FactStore::setResource | ( | std::string | key, |
| eve::Value | value | ||
| ) |
Set a resource value.
在文件 FactStore.cpp 第 181 行定义.
引用了 key, eve::emergence::Unchanged , 以及 value.
被这些函数引用 restoreJson().
◆ setState()
| FactChange eve::emergence::FactStore::setState | ( | std::string | key, |
| eve::Value | value | ||
| ) |
Set a state value.
在文件 FactStore.cpp 第 186 行定义.
引用了 key, eve::emergence::Unchanged , 以及 value.
被这些函数引用 restoreJson().
◆ setTag()
| FactChange eve::emergence::FactStore::setTag | ( | std::string | tag, |
| bool | present | ||
| ) |
Set tag membership; present=true means the tag exists.
在文件 FactStore.cpp 第 171 行定义.
引用了 tag , 以及 eve::emergence::Unchanged.
被这些函数引用 restoreJson().
◆ setValue()
| FactChange eve::emergence::FactStore::setValue | ( | std::string | key, |
| eve::Value | value | ||
| ) |
Set a compare/value fact.
- 返回
- FactChange::Changed when the stored value differed.
在文件 FactStore.cpp 第 166 行定义.
引用了 key, eve::emergence::Unchanged , 以及 value.
被这些函数引用 restoreJson().
◆ snapshotJson()
| std::string eve::emergence::FactStore::snapshotJson | ( | ) | const |
Export deterministic compact JSON for runtime snapshots.
在文件 FactStore.cpp 第 253 行定义.
引用了 key, resources, root, eve::Value::toJson(), value , 以及 values.
◆ state()
|
overridevirtual |
Query a state value for StateEquals nodes.
实现了 eve::decision::EvaluationContext.
在文件 FactStore.cpp 第 238 行定义.
引用了 key.
◆ value()
|
overridevirtual |
Query a named scalar or structured value for Compare nodes.
实现了 eve::decision::EvaluationContext.
在文件 FactStore.cpp 第 218 行定义.
引用了 key.
◆ valueCount()
|
inlinenoexcept |
Number of stored value facts.
在文件 FactStore.h 第 109 行定义.
该类的文档由以下文件生成:
- src/modules/emergence/FactStore.h
- src/modules/emergence/FactStore.cpp
Public 成员函数 继承自