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 (GameWorld &gameWorld, UpdateContext &updateContext) noexcept

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

voidclear () noexcept

Discards all queued commands without executing them. 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.

## Type Erasure

``` CommandBuffer (value type, owns erased Concept via unique_ptr) └── Concept (internal virtual interface) └── Model<T> (typed wrapper, owns T by value) └── T (plain class, provides flush() / clear()) ```

The wrapped type must satisfy `IsCommandBufferLike<T>`, which requires `flush(GameWorld&, UpdateContext&) noexcept` and `clear() noexcept`.

CommandBuffer is move-only (non-copyable).

See Also

IsCommandBufferLike

See Also

TypedCommandBuffer

See Also

EngineCommandBuffer

See Also

ResourceRegistry

Definition at line 46 of file CommandBuffer.ixx.

Public Constructors

CommandBuffer()

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

Definition at line 104 of file CommandBuffer.ixx.

Referenced by CommandBuffer, CommandBuffer, operator= and operator=.

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 118 of file CommandBuffer.ixx.

118 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 120 of file CommandBuffer.ixx.

Reference CommandBuffer.

CommandBuffer()

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

Definition at line 124 of file CommandBuffer.ixx.

Reference CommandBuffer.

Public Operators

operator=()

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

Definition at line 121 of file CommandBuffer.ixx.

Reference CommandBuffer.

operator=()

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

Definition at line 123 of file CommandBuffer.ixx.

Reference CommandBuffer.

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 148 of file CommandBuffer.ixx.

148 void clear() noexcept {
149 assert(pimpl_ && "CommandBuffer not initialized");
150 pimpl_->clear();
151 }

flush()

void helios::engine::runtime::messaging::command::CommandBuffer::flush (GameWorld & gameWorld, 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 138 of file CommandBuffer.ixx.

138 void flush(GameWorld& gameWorld, UpdateContext& updateContext) noexcept {
139 assert(pimpl_ && "CommandBuffer not initialized");
140 pimpl_->flush(gameWorld, updateContext);
141 }

Reference flush.

Referenced by flush.

underlying()

void * helios::engine::runtime::messaging::command::CommandBuffer::underlying ()
inline nodiscard 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 160 of file CommandBuffer.ixx.

160 [[nodiscard]] void* underlying() noexcept {
161 assert(pimpl_ && "CommandBuffer not initialized");
162 return pimpl_->underlying();
163 }

underlying()

const void * helios::engine::runtime::messaging::command::CommandBuffer::underlying ()
inline nodiscard 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 168 of file CommandBuffer.ixx.

168 [[nodiscard]] const void* underlying() const noexcept {
169 assert(pimpl_ && "CommandBuffer not initialized");
170 return pimpl_->underlying();
171 }

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 100 of file CommandBuffer.ixx.

100 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.15.0.