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, TimerManager &timerManager) noexcept
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 50 of file CommandBuffer.ixx.

Public Constructors

CommandBuffer()

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

Definition at line 113 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 127 of file CommandBuffer.ixx.

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

CommandBuffer()

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

Definition at line 133 of file CommandBuffer.ixx.

Public Operators

operator=()

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

Definition at line 130 of file CommandBuffer.ixx.

operator=()

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

Definition at line 132 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 157 of file CommandBuffer.ixx.

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

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

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

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

init()

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

Definition at line 162 of file CommandBuffer.ixx.

162 void init(CommandHandlerRegistry& commandHandlerRegistry, TimerManager& timerManager) noexcept {
163 assert(pimpl_ && "CommandBuffer not initialized");
164 pimpl_->init(commandHandlerRegistry, timerManager);
165 }

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

175 assert(pimpl_ && "CommandBuffer not initialized");
176 return pimpl_->underlying();
177 }

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

182 [[nodiscard]] const void* underlying() const noexcept {
183 assert(pimpl_ && "CommandBuffer not initialized");
184 return pimpl_->underlying();
185 }

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

109 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.