4#include <unordered_map>
9#include <condition_variable>
11#include <libecs-cpp/json.hpp>
109 std::unordered_map<std::string, std::unique_ptr<ecs::Container>> containers;
110 std::mutex mutexContainers;
111 std::size_t sendsInFlight = 0;
112 bool closing =
false;
113 std::condition_variable sendsIdle;
114 std::atomic<bool> running =
true;
A container: the entities, components, systems and resources that are updated together.
Definition Container.hpp:70
Creates and owns containers, routes messages between them and shuts them down.
Definition Manager.hpp:32
ecs::Container * Container()
Creates a container with a generated handle.
void Shutdown()
Sets IsRunning() to false and stops every container that has its own thread.
void MessageSubmit(const nlohmann::json &message)
Sends a message to the system named in message["destination"], in the container named there.
Manager()
Creates a running manager with no containers.
~Manager()
Shuts the manager down, then destroys its containers.
std::vector< std::string > ContainersGet()
Returns the handles of all containers, as a snapshot by value.
bool IsRunning()
Says whether the manager is running: true until Shutdown() has been called.
ecs::Container * Container(const std::string &handle)
Returns the container with this handle, creating it if needed.