Registry of turn policies keyed by stable id. 更多...
#include <TurnPolicy.h>
Public 成员函数 | |
| Result< void > | add (std::shared_ptr< const ITurnPolicy > policy) |
| Register one policy under its own id. | |
| Result< const ITurnPolicy * > | find (std::string_view id) const |
| Resolve a registered policy by id, or NotFound. | |
| std::vector< std::string > | ids () const |
| Return registered ids in lexical order. | |
| bool | contains (std::string_view id) const |
| Return whether an id is registered. | |
静态 Public 成员函数 | |
| static TurnPolicyRegistry & | builtins () |
| Return the process-wide registry carrying the built-in policies. | |
详细描述
Registry of turn policies keyed by stable id.
The registry never owns battle state and is safe to share: policies are immutable and lookups are read-only. Callers must not register while another thread resolves.
在文件 TurnPolicy.h 第 145 行定义.
成员函数说明
◆ add()
| Result< void > eve::tactics::TurnPolicyRegistry::add | ( | std::shared_ptr< const ITurnPolicy > | policy | ) |
Register one policy under its own id.
- 返回
- Applied, InvalidArgument for a null or empty-id policy, or Conflict when the id is already taken.
在文件 TurnPolicy.cpp 第 82 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, key, eve::Status::success() , 以及 eve::Result< T >::success().
◆ builtins()
|
static |
Return the process-wide registry carrying the built-in policies.
- 备注
- Built-ins are registered on first use and never replaced, so the returned registry is effectively immutable to callers.
在文件 TurnPolicy.cpp 第 111 行定义.
引用了 value.
被这些函数引用 eve::tactics::BattleSystem::start().
◆ contains()
| bool eve::tactics::TurnPolicyRegistry::contains | ( | std::string_view | id | ) | const |
Return whether an id is registered.
在文件 TurnPolicy.cpp 第 109 行定义.
◆ find()
| Result< const ITurnPolicy * > eve::tactics::TurnPolicyRegistry::find | ( | std::string_view | id | ) | const |
Resolve a registered policy by id, or NotFound.
在文件 TurnPolicy.cpp 第 94 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), found, eve::NotFound , 以及 eve::Result< T >::success().
被这些函数引用 eve::tactics::BattleSystem::start().
◆ ids()
| std::vector< std::string > eve::tactics::TurnPolicyRegistry::ids | ( | ) | const |
Return registered ids in lexical order.
在文件 TurnPolicy.cpp 第 102 行定义.
该类的文档由以下文件生成:
- src/modules/tactics/TurnPolicy.h
- src/modules/tactics/TurnPolicy.cpp