载入中...
搜索中...
未找到
eve::decision::DecisionContext类 参考

Data-oriented blackboard, FSM, utility and influence-map workspace. 更多...

#include <Decision.h>

Public 成员函数

eve::Result< void > set (const std::string &board, const std::string &key, const std::string &valueJson)
 Sets a scalar JSON value on a named blackboard.
 
std::string get (const std::string &board, const std::string &key, const std::string &fallbackJson) const
 Gets canonical scalar JSON or the supplied fallback.
 
eve::Result< void > addTransition (const std::string &machine, const std::string &from, const std::string &trigger, const std::string &to)
 Adds or replaces a finite-state transition.
 
eve::Result< void > setState (const std::string &machine, const std::string &state)
 Sets the current state explicitly.
 
eve::Result< bool > trigger (const std::string &machine, const std::string &trigger)
 Applies an explicit trigger.
 
std::string state (const std::string &machine) const
 Gets current machine state.
 
eve::Result< void > newGrid (const std::string &name, int width, int height, float cellSize, float originX, float originY)
 Creates or replaces a zero-filled 2D influence grid.
 
eve::Result< void > setCell (const std::string &name, int x, int y, float value)
 Sets one grid cell, or returns a structured not-found/validation failure.
 
eve::Result< void > addCell (const std::string &name, int x, int y, float delta)
 Adds to one grid cell, or returns a structured not-found/validation failure.
 
float sample (const std::string &name, float worldX, float worldY, float fallback) const
 Samples the containing cell, returning fallback outside the grid.
 
std::string snapshotJson () const
 Exports deterministic JSON.
 
eve::Result< void > restoreJson (const std::string &json)
 Restores a version-1 snapshot transactionally.
 

静态 Public 成员函数

static float utility (const std::string &considerationsCsv)
 Scores CSV considerations formatted value:weight using a weighted mean.
 
static std::string choose (const std::string &options)
 Selects an option from name=considerations entries; ties use lexical name.
 

详细描述

Data-oriented blackboard, FSM, utility and influence-map workspace.

在文件 Decision.h 第 23 行定义.

成员函数说明

◆ addCell()

eve::Result< void > eve::decision::DecisionContext::addCell ( const std::string &  name,
int  x,
int  y,
float  delta 
)

Adds to one grid cell, or returns a structured not-found/validation failure.

在文件 Decision.cpp 第 255 行定义.

引用了 cell, eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::InvalidArgument, name, eve::NotFound, x , 以及 y.

◆ addTransition()

eve::Result< void > eve::decision::DecisionContext::addTransition ( const std::string &  machine,
const std::string &  from,
const std::string &  trigger,
const std::string &  to 
)

Adds or replaces a finite-state transition.

返回
Success when the transition was stored; invalid names return a structured validation diagnostic.

在文件 Decision.cpp 第 135 行定义.

引用了 eve::Diagnostic::error(), f, eve::Result< T >::failure(), eve::InvalidArgument, m, t , 以及 to.

◆ choose()

std::string eve::decision::DecisionContext::choose ( const std::string &  options)
static

Selects an option from name=considerations entries; ties use lexical name.

在文件 Decision.cpp 第 196 行定义.

引用了 input, name, options, score , 以及 utility().

◆ get()

std::string eve::decision::DecisionContext::get ( const std::string &  board,
const std::string &  key,
const std::string &  fallbackJson 
) const

Gets canonical scalar JSON or the supplied fallback.

在文件 Decision.cpp 第 125 行定义.

引用了 board , 以及 key.

被这些函数引用 restoreJson().

◆ newGrid()

eve::Result< void > eve::decision::DecisionContext::newGrid ( const std::string &  name,
int  width,
int  height,
float  cellSize,
float  originX,
float  originY 
)

Creates or replaces a zero-filled 2D influence grid.

返回
Success when the grid dimensions and geometry are valid.

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

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), height, eve::InvalidArgument, name , 以及 width.

◆ restoreJson()

eve::Result< void > eve::decision::DecisionContext::restoreJson ( const std::string &  json)

Restores a version-1 snapshot transactionally.

返回
Success after the complete snapshot has been validated and published; malformed input leaves the current context unchanged.

在文件 Decision.cpp 第 337 行定义.

引用了 b, cell, d, eve::Diagnostic::error(), eve::Result< T >::failure(), get(), h, m, n, name, ox, oy, eve::json::Document::parse(), eve::ParseError, eve::SerializationError, state(), tr, eve::UnknownVersion, v, value, w , 以及 z.

◆ sample()

float eve::decision::DecisionContext::sample ( const std::string &  name,
float  worldX,
float  worldY,
float  fallback 
) const

Samples the containing cell, returning fallback outside the grid.

在文件 Decision.cpp 第 276 行定义.

引用了 name.

◆ set()

eve::Result< void > eve::decision::DecisionContext::set ( const std::string &  board,
const std::string &  key,
const std::string &  valueJson 
)

Sets a scalar JSON value on a named blackboard.

返回
Success when the value is valid and the board entry was written; otherwise a structured validation diagnostic.

在文件 Decision.cpp 第 100 行定义.

引用了 board, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, key, eve::json::Document::parse() , 以及 eve::ParseError.

◆ setCell()

eve::Result< void > eve::decision::DecisionContext::setCell ( const std::string &  name,
int  x,
int  y,
float  value 
)

Sets one grid cell, or returns a structured not-found/validation failure.

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

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, name, eve::NotFound, value, x , 以及 y.

◆ setState()

eve::Result< void > eve::decision::DecisionContext::setState ( const std::string &  machine,
const std::string &  state 
)

Sets the current state explicitly.

返回
Success when the state was stored, otherwise a validation diagnostic.

在文件 Decision.cpp 第 144 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, m , 以及 s.

◆ snapshotJson()

std::string eve::decision::DecisionContext::snapshotJson ( ) const

Exports deterministic JSON.

在文件 Decision.cpp 第 291 行定义.

引用了 a, b, f, g, key, m, n, quote, s, to , 以及 v.

◆ state()

std::string eve::decision::DecisionContext::state ( const std::string &  machine) const

Gets current machine state.

在文件 Decision.cpp 第 168 行定义.

引用了 m.

被这些函数引用 restoreJson().

◆ trigger()

eve::Result< bool > eve::decision::DecisionContext::trigger ( const std::string &  machine,
const std::string &  trigger 
)

Applies an explicit trigger.

返回
A successful result with true/Applied when a transition fired, or false/NoOp when no transition matches. Missing machines and invalid arguments are reported as structured failures.

在文件 Decision.cpp 第 152 行定义.

引用了 a, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, m, eve::NotFound, s , 以及 t.

◆ utility()

float eve::decision::DecisionContext::utility ( const std::string &  considerationsCsv)
static

Scores CSV considerations formatted value:weight using a weighted mean.

在文件 Decision.cpp 第 172 行定义.

引用了 input, value , 以及 weight.

被这些函数引用 choose().


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