Skip to main content

WorldLifecycleManager.ixx File

Manager for deferred world-level lifecycle operations. More...

Included Headers

Namespaces Index

namespacehelios
namespaceengine
namespaceruntime
namespacelifecycle

Classes Index

classWorldLifecycleManager

Manager that processes deferred world lifecycle commands. More...

Description

Manager for deferred world-level lifecycle operations.

File Listing

The file content with the documentation metadata removed is:

1
5module;
6
7#include <vector>
8#include <cassert>
9
10export module helios.engine.runtime.lifecycle.WorldLifecycleManager;
11
12import helios.engine.runtime.messaging.command.CommandHandlerRegistry;
13import helios.engine.runtime.world.UpdateContext;
14
15import helios.engine.runtime.lifecycle.types;
16import helios.engine.runtime.lifecycle.commands.WorldLifecycleCommand;
17import helios.engine.runtime.world.tags.ManagerRole;
18
24
42
46 std::vector<WorldLifecycleCommand> pending_;
47
48
49 public:
50
52
61 pending_.push_back(cmd);
62 return true;
63 }
64
70 void init(CommandHandlerRegistry& commandHandlerRegistry) {
71 commandHandlerRegistry.registerHandler<WorldLifecycleCommand>(*this);
72 }
73
85 if (pending_.empty()) {
86 return;
87 }
88
89 std::vector<WorldLifecycleCommand> queue = std::move(pending_);
90 pending_.clear();
91
92 for (const auto& cmd : queue) {
93 switch (cmd.action()) {
94 case WorldLifecycleAction::Reset:
99 assert(false && "Needs to call GameWorld reset()");
100 // reset complete, do not process further commands.
101 return;
102 }
103 }
104
105 }
106
110 void reset() {
111 pending_.clear();
112 }
113 };
114
115}
116

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.