载入中...
搜索中...
未找到
CrowdRegistry.cpp
浏览该文件的文档.
65 if (count >= std::size_t(AgentHandle::invalidIndex)) throw eve::Exception("Crowd registry identity exhausted");
115 return Result<AgentRef>::failure(Diagnostic::error(DiagnosticCode::NotFound, "Crowd agent not found", "slot"));
117 return Result<AgentRef>::success({AgentHandle(index, impl_->registry[index].generation), impl_->owner});
124bool Crowd::isAgentAlive(AgentRef reference) const noexcept { return impl_->resolveAgent(reference) >= 0; }
130 DiagnosticCode::NotFound, "Crowd agent reference is stale or belongs to another owner", "reference"));
const eve::script::BindingContractRegistry & registry
Definition ProjectIndexAutomatic.cpp:24
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
constexpr std::optional< RuntimeHandle > nextGeneration() const noexcept
Returns this slot at its next generation.
Definition RuntimeHandle.h:170
static constexpr index_type invalidIndex
Reserved index value shared by all invalid handles.
Definition RuntimeHandle.h:124
int getNamedAgentIndex(const std::string &stableId) const
Resolve a stable logical identifier to the current compact slot.
Definition Crowd.cpp:177
Result< AgentState > readAgent(AgentRef reference) const
Read an owning state snapshot by owner-qualified identity.
Definition CrowdRegistry.cpp:126
Result< AgentRef > agentRef(int slot) const
Resolve a compatibility dense slot to an owning identity value.
Definition CrowdRegistry.cpp:113
Result< AgentRef > resolveNamedAgent(const std::string &stableId) const
Resolve a logical name once at binding boundaries, without rebuilding any state.
Definition CrowdRegistry.cpp:120
bool isAgentAlive(AgentRef reference) const noexcept
Whether the owner and generation still identify a live agent. @thread Simulation thread only; the cal...
Definition CrowdRegistry.cpp:124
Definition Crowd.cpp:14
RuntimeHandle< CrowdAgentTag > AgentHandle
Generation-qualified runtime agent identity; never persist its packed representation.
Definition CrowdTypes.h:82
std::uint64_t namedTieValue(std::string_view identity)
Hash UTF-8 identity bytes once at admission; collisions are rejected by the registry.
Definition CrowdRegistry.cpp:23
constexpr HexDirection next(HexDirection d) noexcept
The next direction clockwise (NW wraps to NE).
Definition HexMetrics.h:76
@ NotFound
Agent identity qualified by the Crowd instance that owns its registry. @ownership Value only; it neit...
Definition CrowdTypes.h:90
void clearAgentIdentities()
Definition CrowdRegistry.cpp:102
void eraseAgentIdentity(int denseIndex)
Definition CrowdRegistry.cpp:85
void appendAgentIdentity(int denseIndex)
Definition CrowdRegistry.cpp:72
int resolveAgent(AgentRef reference) const noexcept
Definition CrowdRegistry.cpp:106