Skip to main content

InternalBuffer Class Template

Per-command-type buffer that applies mutations on flush. More...

Declaration

template <typename TCommandType> class helios::engine::runtime::world::EntityMutationManager::InternalBuffer<TCommandType> { ... }

Public Member Typedefs Index

template <typename TCommandType>
usingEngineRoleTag = CommandBufferRole

Role tag identifying this as a command buffer in the engine registry. More...

template <typename TCommandType>
usingCommand_type = TCommandType

The command type stored in this buffer. More...

template <typename TCommandType>
usingComponent_type = typename TCommandType::Component_type

Component type targeted by the buffered commands. More...

Public Constructors Index

template <typename TCommandType>
InternalBuffer (TEntityManager &entityManager)

Reserves default capacity for the command vector. More...

Public Member Functions Index

template <typename TCommandType>
voidflush (UpdateContext &updateContext)

Applies all buffered add/remove-component commands directly via the entity manager. More...

template <typename TCommandType>
voidclear ()

Discards all buffered commands without applying them. More...

template <typename TCommandType>
voidinit (CommandHandlerRegistry &commandHandlerRegistry, ManagerRegistry &managerRegistry)

No-op; satisfies the buffer initialisation interface. More...

template <typename TCommandType>
voidadd (TCommandType commandType)

Stores a command for deferred execution. More...

Private Member Attributes Index

template <typename TCommandType>
CommandHandlerRegistry *commandHandlerRegistry_ {nullptr}
template <typename TCommandType>
std::vector< TCommandType >commands_
template <typename TCommandType>
TEntityManager &entityManager_

Description

Per-command-type buffer that applies mutations on flush.

Two flush() overloads exist, selected by concept constraints: one for component add/remove, one for entity activation/deactivation.

Template Parameters
TCommandType

ECS command type stored in this buffer.

Definition at line 108 of file EntityMutationManager.ixx.

Public Member Typedefs

Command_type

template <typename TCommandType>
using helios::engine::runtime::world::EntityMutationManager< TEntityManager >::InternalBuffer< TCommandType >::Command_type = TCommandType

The command type stored in this buffer.

Definition at line 121 of file EntityMutationManager.ixx.

121 using Command_type = TCommandType;

Component_type

template <typename TCommandType>
using helios::engine::runtime::world::EntityMutationManager< TEntityManager >::InternalBuffer< TCommandType >::Component_type = typename TCommandType::Component_type

Component type targeted by the buffered commands.

Definition at line 124 of file EntityMutationManager.ixx.

124 using Component_type = typename TCommandType::Component_type;

EngineRoleTag

template <typename TCommandType>
using helios::engine::runtime::world::EntityMutationManager< TEntityManager >::InternalBuffer< TCommandType >::EngineRoleTag = CommandBufferRole

Role tag identifying this as a command buffer in the engine registry.

Definition at line 118 of file EntityMutationManager.ixx.

Public Constructors

InternalBuffer()

template <typename TCommandType>
helios::engine::runtime::world::EntityMutationManager< TEntityManager >::InternalBuffer< TCommandType >::InternalBuffer (TEntityManager & entityManager)
inline

Reserves default capacity for the command vector.

Definition at line 127 of file EntityMutationManager.ixx.

127 InternalBuffer(TEntityManager& entityManager) : entityManager_(entityManager) {
129 }

Public Member Functions

add()

template <typename TCommandType>
void helios::engine::runtime::world::EntityMutationManager< TEntityManager >::InternalBuffer< TCommandType >::add (TCommandType commandType)
inline

Stores a command for deferred execution.

Parameters
commandType

Command instance to buffer.

Definition at line 173 of file EntityMutationManager.ixx.

173 void add(TCommandType commandType) {
174 commands_.emplace_back(std::forward<TCommandType>(commandType));
175 }

clear()

template <typename TCommandType>
void helios::engine::runtime::world::EntityMutationManager< TEntityManager >::InternalBuffer< TCommandType >::clear ()
inline

Discards all buffered commands without applying them.

Definition at line 161 of file EntityMutationManager.ixx.

161 void clear() {
162 commands_.clear();
163 }

flush()

template <typename TCommandType>
void helios::engine::runtime::world::EntityMutationManager< TEntityManager >::InternalBuffer< TCommandType >::flush (UpdateContext & updateContext)
inline

Applies all buffered add/remove-component commands directly via the entity manager.

Invalid entity handles are silently skipped.

Parameters
updateContext

Frame-local ECS context (currently unused; kept for interface uniformity).

Definition at line 138 of file EntityMutationManager.ixx.

138 void flush(UpdateContext& updateContext)
140
141 using Component_type = typename TCommandType::Component_type;
142
143 logger_.info("Processing {0} commands", commands_.size());
144
145 for (auto& command : commands_) {
146 if (!entityManager_.isValid(command.handle)) {
147 continue;
148 }
150 entityManager_.template emplace<Component_type>(command.handle, std::move(command.component));
151 } else {
152 entityManager_.template remove<Component_type>(command.handle);
153 }
154 }
155
156 clear();
157 }

init()

template <typename TCommandType>
void helios::engine::runtime::world::EntityMutationManager< TEntityManager >::InternalBuffer< TCommandType >::init (CommandHandlerRegistry & commandHandlerRegistry, ManagerRegistry & managerRegistry)
inline

No-op; satisfies the buffer initialisation interface.

Definition at line 166 of file EntityMutationManager.ixx.

166 void init(CommandHandlerRegistry& commandHandlerRegistry, ManagerRegistry& managerRegistry) {/* noop*/ }

Private Member Attributes

commandHandlerRegistry_

template <typename TCommandType>
CommandHandlerRegistry* helios::engine::runtime::world::EntityMutationManager< TEntityManager >::InternalBuffer< TCommandType >::commandHandlerRegistry_ {nullptr}

Definition at line 110 of file EntityMutationManager.ixx.

110 CommandHandlerRegistry* commandHandlerRegistry_{nullptr};

commands_

template <typename TCommandType>
std::vector<TCommandType> helios::engine::runtime::world::EntityMutationManager< TEntityManager >::InternalBuffer< TCommandType >::commands_

Definition at line 112 of file EntityMutationManager.ixx.

112 std::vector<TCommandType> commands_;

entityManager_

template <typename TCommandType>
TEntityManager& helios::engine::runtime::world::EntityMutationManager< TEntityManager >::InternalBuffer< TCommandType >::entityManager_

Definition at line 114 of file EntityMutationManager.ixx.

114 TEntityManager& entityManager_;

The documentation for this class was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.