载入中...
搜索中...
未找到
eve::emergence::FactStore类 参考final

Mutable fact bag that doubles as a read-only Condition evaluation context. 更多...

#include <FactStore.h>

类 eve::emergence::FactStore 继承关系图:
eve::condition::EvaluationContext

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, condition::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< condition::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::condition::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 行定义.

成员函数说明

◆ clear()

void eve::emergence::FactStore::clear ( )

Clear every fact without invoking callbacks.

在文件 FactStore.cpp 第 157 行定义.

◆ clearTag()

FactChange eve::emergence::FactStore::clearTag ( std::string_view  tag)

Erase a tag fact.

在文件 FactStore.cpp 第 215 行定义.

引用了 eve::emergence::Changed, tag , 以及 eve::emergence::Unchanged.

◆ clearValue()

FactChange eve::emergence::FactStore::clearValue ( std::string_view  key)

Erase a value fact.

在文件 FactStore.cpp 第 211 行定义.

引用了 eve::emergence::Changed, key , 以及 eve::emergence::Unchanged.

◆ policy()

std::optional< condition::ConditionResult > eve::emergence::FactStore::policy ( std::string_view  name,
const eve::Value &  arguments 
) const
overridevirtual

Evaluate a named read-only policy with owned arguments.

实现了 eve::condition::EvaluationContext.

在文件 FactStore.cpp 第 240 行定义.

引用了 name, eve::condition::resolveAuthorityAllow() , 以及 scope.

◆ 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 第 280 行定义.

引用了 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 , 以及 version.

被这些函数引用 eve::emergence::RuleEngine::restoreJson().

◆ setAttribute()

FactChange eve::emergence::FactStore::setAttribute ( std::string  key,
eve::Value  value 
)

Set an attribute value.

在文件 FactStore.cpp 第 177 行定义.

引用了 key, eve::emergence::Unchanged , 以及 value.

被这些函数引用 restoreJson().

◆ setAuthority()

FactChange eve::emergence::FactStore::setAuthority ( std::string  scope,
bool  granted 
)

Set authority for a scope.

在文件 FactStore.cpp 第 192 行定义.

引用了 scope , 以及 eve::emergence::Unchanged.

被这些函数引用 restoreJson().

◆ setPolicy()

FactChange eve::emergence::FactStore::setPolicy ( std::string  name,
condition::ConditionResult  result 
)

Register or replace a read-only policy result.

返回
FactChange::Changed when the stored result differed.

在文件 FactStore.cpp 第 197 行定义.

引用了 eve::emergence::Changed, name, result , 以及 eve::emergence::Unchanged.

被这些函数引用 restoreJson().

◆ setResource()

FactChange eve::emergence::FactStore::setResource ( std::string  key,
eve::Value  value 
)

Set a resource value.

在文件 FactStore.cpp 第 182 行定义.

引用了 key, eve::emergence::Unchanged , 以及 value.

被这些函数引用 restoreJson().

◆ setState()

FactChange eve::emergence::FactStore::setState ( std::string  key,
eve::Value  value 
)

Set a state value.

在文件 FactStore.cpp 第 187 行定义.

引用了 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 第 172 行定义.

引用了 present, 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 第 167 行定义.

引用了 key, eve::emergence::Unchanged , 以及 value.

被这些函数引用 restoreJson().

◆ snapshotJson()

std::string eve::emergence::FactStore::snapshotJson ( ) const

Export deterministic compact JSON for runtime snapshots.

在文件 FactStore.cpp 第 251 行定义.

引用了 attributes, key, resources, root, tags, eve::Value::toJson(), value , 以及 values.

◆ value()

std::optional< eve::Value > eve::emergence::FactStore::value ( std::string_view  key) const
overridevirtual

Query a named scalar or structured value for Compare nodes.

Canonical keys may use domain prefixes from ConditionKeys.h (tag:, attr:, resource:, state:). Bare keys are domain-defined.

实现了 eve::condition::EvaluationContext.

在文件 FactStore.cpp 第 219 行定义.

引用了 eve::condition::kAttrPrefix, key, eve::condition::kResourcePrefix, eve::condition::kStatePrefix, eve::condition::kTagPrefix, resource, state, eve::condition::stripPrefix() , 以及 tag.

◆ valueCount()

int eve::emergence::FactStore::valueCount ( ) const
inlinenoexcept

Number of stored value facts.

在文件 FactStore.h 第 104 行定义.


该类的文档由以下文件生成: