CommandBuffer Class
Type-erased wrapper for command buffers using the Concept/Model pattern. More...
Declaration
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
| void | flush (GameWorld &gameWorld, UpdateContext &updateContext) noexcept |
|
Executes all queued commands and clears the buffer. More... | |
| void | clear () 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
- See Also
- See Also
Definition at line 46 of file CommandBuffer.ixx.
Public Constructors
CommandBuffer()
| default |
Definition at line 104 of file CommandBuffer.ixx.
Referenced by CommandBuffer, CommandBuffer, operator= and operator=.
CommandBuffer()
| 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.
CommandBuffer()
| delete |
Definition at line 120 of file CommandBuffer.ixx.
Reference CommandBuffer.
CommandBuffer()
| noexcept default |
Definition at line 124 of file CommandBuffer.ixx.
Reference CommandBuffer.
Public Operators
operator=()
| delete |
Definition at line 121 of file CommandBuffer.ixx.
Reference CommandBuffer.
operator=()
| default |
Definition at line 123 of file CommandBuffer.ixx.
Reference CommandBuffer.
Public Member Functions
clear()
| inline noexcept |
Discards all queued commands without executing them.
- Precondition
The CommandBuffer must be initialized.
Definition at line 148 of file CommandBuffer.ixx.
flush()
| 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.
Reference flush.
Referenced by flush.
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.
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.
Private Member Attributes
pimpl_
|
Owning pointer to the type-erased command buffer.
Definition at line 100 of file CommandBuffer.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.