Skip to main content

EntityResolver.ixx File

Lightweight callable for resolving EntityHandles to Entity wrappers. More...

Included Headers

#include <optional> #include <helios.ecs.types.EntityHandle> #include <helios.ecs.Entity> #include <helios.ecs.EntityManager>

Namespaces Index

namespacehelios
namespaceecs

Classes Index

structEntityResolver<TEntityManager>

Callable that resolves an EntityHandle to an Entity facade. More...

Description

Lightweight callable for resolving EntityHandles to Entity wrappers.

File Listing

The file content with the documentation metadata removed is:

1
5module;
6
7#include <optional>
8
9export module helios.ecs.EntityResolver;
10
11import helios.ecs.EntityManager;
12import helios.ecs.Entity;
13
14import helios.ecs.types.EntityHandle;
15
16using namespace helios::ecs::types;
17export namespace helios::ecs {
18
36 template<typename TEntityManager>
38
39 using Handle_type = TEntityManager::Handle_type;
41
45 TEntityManager* const em;
46
54 [[nodiscard]] std::optional<Entity_type> operator()(const Handle_type handle) const noexcept {
55 if (!em->isValid(handle)) {
56 return std::nullopt;
57 }
58 return Entity_type(handle, em);
59 }
60
70 [[nodiscard]] std::optional<Entity_type> find(const Handle_type handle) const noexcept {
71 return (*this)(handle);
72 }
73
74
75
76 };
77}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.