Skip to main content

EntityPoolRegistry.ixx File

Central registry for managing multiple EntityPool instances. More...

Included Headers

#include <memory> #include <unordered_map> #include <ranges> #include <helios.engine.runtime.pooling.types.EntityPoolId> #include <helios.engine.runtime.pooling.EntityPool>

Namespaces Index

namespacehelios
namespaceengine
namespaceruntime
namespacepooling

Classes Index

classEntityPoolRegistry<THandle>

Central registry for managing multiple named EntityPools. More...

Description

Central registry for managing multiple EntityPool instances.

File Listing

The file content with the documentation metadata removed is:

1
5module;
6
7#include <memory>
8#include <unordered_map>
9#include <ranges>
10
11export module helios.engine.runtime.pooling.EntityPoolRegistry;
12
13
14import helios.engine.runtime.pooling.EntityPool;
15import helios.engine.runtime.pooling.types.EntityPoolId;
16
17
19
45 template<typename THandle>
47
48 private:
49
53 std::unordered_map<helios::engine::runtime::pooling::types::EntityPoolId, std::unique_ptr<EntityPool<THandle>>> pools_;
54
55 public:
56
60 EntityPoolRegistry() = default;
61
75 std::unique_ptr<EntityPool<THandle>> entityPool
76 ) noexcept {
77 pools_[id] = std::move(entityPool);
78 return pools_[id].get();
79 }
80
89 [[nodiscard]]std::unordered_map<helios::engine::runtime::pooling::types::EntityPoolId, std::unique_ptr<EntityPool<THandle>>>& pools() {
90 return pools_;
91 }
92
93
102
103 const auto& it = pools_.find(id);
104
105 if (it == pools_.end()) {
106 return nullptr;
107 }
108
109 return it->second.get();
110 }
111
120 return pools_.contains(id);
121 }
122
123
124 };
125
126}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.