Skip to main content

CommandBuffer Class

Type-erased wrapper for command buffers using the Concept/Model pattern. More...

Declaration

class helios::engine::runtime::messaging::command::CommandBuffer { ... }

Public Constructors Index

CommandBuffer ()=default
template <typename T>
CommandBuffer (T cmdBuffer)

Constructs a CommandBuffer wrapping the given concrete buffer. More...

CommandBuffer (const CommandBuffer &)=delete
CommandBuffer (CommandBuffer &&) noexcept=default

Public Operators Index

CommandBuffer &operator= (const CommandBuffer &)=delete
CommandBuffer &operator= (CommandBuffer &&)=default

Public Member Functions Index

voidflush (UpdateContext &updateContext) noexcept

Executes all queued commands and clears the buffer. More...

voidclear () noexcept

Discards all queued commands without executing them. More...

voidinit (CommandHandlerRegistry &commandHandlerRegistry, ManagerRegistry &managerRegistry) noexcept

Initializes the command buffer with the given registries. More...

void *underlying () noexcept

Returns a type-erased pointer to the owned buffer instance. More...

const void *underlying () const noexcept

Returns a type-erased pointer to the owned buffer instance. More...

Private Member Attributes Index

std::unique_ptr< Concept >pimpl_

Owning pointer to the type-erased command buffer. More...

Description

Type-erased wrapper for command buffers using the Concept/Model pattern.

CommandBuffer erases the concrete buffer type at construction time, allowing heterogeneous storage and polymorphic dispatch without requiring concrete buffers to inherit from a common base class.

Definition at line 51 of file CommandBuffer.ixx.

Public Constructors

CommandBuffer()

helios::engine::runtime::messaging::command::CommandBuffer::CommandBuffer ()
default

Definition at line 114 of file CommandBuffer.ixx.

CommandBuffer()

template <typename T>
helios::engine::runtime::messaging::command::CommandBuffer::CommandBuffer (T cmdBuffer)
inline explicit

Constructs a CommandBuffer wrapping the given concrete buffer.

Ownership of the buffer is transferred into a heap-allocated Model<T>. The concrete type is erased after construction.

Template Parameters
T

The concrete buffer type. Must satisfy IsCommandBufferLike.

Parameters
cmdBuffer

The buffer instance to wrap. Moved into the wrapper.

Definition at line 128 of file CommandBuffer.ixx.

128 explicit CommandBuffer(T cmdBuffer) : pimpl_(std::make_unique<Model<T>>(std::move(cmdBuffer))) {}

CommandBuffer()

helios::engine::runtime::messaging::command::CommandBuffer::CommandBuffer (const CommandBuffer &)
delete

Definition at line 130 of file CommandBuffer.ixx.

CommandBuffer()

helios::engine::runtime::messaging::command::CommandBuffer::CommandBuffer (CommandBuffer &&)
noexcept default

Definition at line 134 of file CommandBuffer.ixx.

Public Operators

operator=()

CommandBuffer & helios::engine::runtime::messaging::command::CommandBuffer::operator= (const CommandBuffer &)
delete

Definition at line 131 of file CommandBuffer.ixx.

operator=()

CommandBuffer & helios::engine::runtime::messaging::command::CommandBuffer::operator= (CommandBuffer &&)
default

Definition at line 133 of file CommandBuffer.ixx.

Public Member Functions

clear()

void helios::engine::runtime::messaging::command::CommandBuffer::clear ()
inline noexcept

Discards all queued commands without executing them.

Precondition

The CommandBuffer must be initialized.

Definition at line 158 of file CommandBuffer.ixx.

158 void clear() noexcept {
159 assert(pimpl_ && "CommandBuffer not initialized");
160 pimpl_->clear();
161 }

Reference helios::engine::runtime::registerComponents.

flush()

void helios::engine::runtime::messaging::command::CommandBuffer::flush (UpdateContext & updateContext)
inline noexcept

Executes all queued commands and clears the buffer.

Delegates to the wrapped buffer's flush(). Commands are routed to their registered handler if available, otherwise executed directly.

Parameters
gameWorld

The game world providing the CommandHandlerRegistry.

updateContext

The current frame's update context.

Precondition

The CommandBuffer must be initialized (not default-constructed).

Definition at line 148 of file CommandBuffer.ixx.

149 assert(pimpl_ && "CommandBuffer not initialized");
150 pimpl_->flush(updateContext);
151 }

Reference helios::engine::runtime::registerComponents.

init()

void helios::engine::runtime::messaging::command::CommandBuffer::init (CommandHandlerRegistry & commandHandlerRegistry, ManagerRegistry & managerRegistry)
inline noexcept

Initializes the command buffer with the given registries.

Parameters
commandHandlerRegistry

Registry used for command-handler registration.

managerRegistry

Registry used for manager access.

Definition at line 169 of file CommandBuffer.ixx.

169 void init(CommandHandlerRegistry& commandHandlerRegistry, ManagerRegistry& managerRegistry) noexcept {
170 assert(pimpl_ && "CommandBuffer not initialized");
171 pimpl_->init(commandHandlerRegistry, managerRegistry);
172 }

Reference helios::engine::runtime::registerComponents.

underlying()

void * helios::engine::runtime::messaging::command::CommandBuffer::underlying ()
inline noexcept

Returns a type-erased pointer to the owned buffer instance.

Returns

Non-null void pointer to the underlying concrete buffer.

Precondition

The CommandBuffer must be initialized.

Definition at line 181 of file CommandBuffer.ixx.

182 assert(pimpl_ && "CommandBuffer not initialized");
183 return pimpl_->underlying();
184 }

Reference helios::engine::runtime::registerComponents.

underlying()

const void * helios::engine::runtime::messaging::command::CommandBuffer::underlying ()
inline noexcept

Returns a type-erased pointer to the owned buffer instance.

Returns

Non-null void pointer to the underlying concrete buffer.

Precondition

The CommandBuffer must be initialized.

Definition at line 189 of file CommandBuffer.ixx.

189 [[nodiscard]] const void* underlying() const noexcept {
190 assert(pimpl_ && "CommandBuffer not initialized");
191 return pimpl_->underlying();
192 }

Reference helios::engine::runtime::registerComponents.

Private Member Attributes

pimpl_

std::unique_ptr<Concept> helios::engine::runtime::messaging::command::CommandBuffer::pimpl_

Owning pointer to the type-erased command buffer.

Definition at line 110 of file CommandBuffer.ixx.

110 std::unique_ptr<Concept> pimpl_;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.