Skip to main content

System Class

Type-erased wrapper for game logic processors. More...

Declaration

class helios::engine::runtime::world::System { ... }

Public Constructors Index

System ()=default

Default constructor creating an empty System. More...

template <typename T>
System (T system, void *buffer=nullptr)

Wraps a concrete system in a type-erased System. More...

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

Public Operators Index

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

Public Member Functions Index

voidupdate (UpdateContext &updateContext) noexcept

Delegates to the wrapped system's update() method. More...

void *underlying () noexcept

Returns a type-erased pointer to the wrapped system instance. More...

const void *underlying () const noexcept

Returns a type-erased pointer to the wrapped system instance. More...

Private Member Attributes Index

std::unique_ptr< Concept >pimpl_

Description

Type-erased wrapper for game logic processors.

System uses the Concept/Model pattern to erase the concrete system type. Concrete systems are plain classes that satisfy IsSystemLike<T> and do not inherit from System.

The internal Concept base defines the virtual update interface, and Model<T> adapts the concrete type T, owning it by value.

If a system exposes CommandBuffer_type, System calls update(UpdateContext&, CommandBuffer_type&) and uses the injected buffer pointer supplied by the creator (typically via Pass registration).

System is move-only (non-copyable).

See Also

IsSystemLike

See Also

SystemRegistry

See Also

https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Type_Erasure

Definition at line 44 of file System.ixx.

Public Constructors

System()

helios::engine::runtime::world::System::System ()
default

Default constructor creating an empty System.

Definition at line 98 of file System.ixx.

System()

template <typename T>
helios::engine::runtime::world::System::System (T system, void * buffer=nullptr)
inline explicit

Wraps a concrete system in a type-erased System.

Template Parameters
T

The concrete system type, must satisfy IsSystemLike<T>.

Parameters
system

The concrete system instance to wrap (moved into internal storage).

buffer

Optional pointer to the concrete T::CommandBuffer_type instance used for systems with two-parameter update signatures.

Definition at line 111 of file System.ixx.

111 explicit System(T system, void* buffer = nullptr)
112 : pimpl_(std::make_unique<Model<T>>(std::move(system), buffer))
113 {}

System()

helios::engine::runtime::world::System::System (const System &)
delete

Definition at line 115 of file System.ixx.

System()

helios::engine::runtime::world::System::System (System &&)
noexcept default

Definition at line 119 of file System.ixx.

Public Operators

operator=()

System & helios::engine::runtime::world::System::operator= (const System &)
delete

Definition at line 116 of file System.ixx.

operator=()

System & helios::engine::runtime::world::System::operator= (System &&)
default

Definition at line 118 of file System.ixx.

Public Member Functions

underlying()

void * helios::engine::runtime::world::System::underlying ()
inline noexcept

Returns a type-erased pointer to the wrapped system instance.

Returns

Pointer to the underlying concrete system.

Precondition

System must be initialized (pimpl_ != nullptr).

Definition at line 143 of file System.ixx.

144 assert(pimpl_ && "System not initialized");
145 return pimpl_->underlying();
146 }

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

underlying()

const void * helios::engine::runtime::world::System::underlying ()
inline noexcept

Returns a type-erased pointer to the wrapped system instance.

Returns

Pointer to the underlying concrete system.

Precondition

System must be initialized (pimpl_ != nullptr).

Definition at line 151 of file System.ixx.

151 [[nodiscard]] const void* underlying() const noexcept {
152 assert(pimpl_ && "System not initialized");
153 return pimpl_->underlying();
154 }

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

update()

void helios::engine::runtime::world::System::update (UpdateContext & updateContext)
inline noexcept

Delegates to the wrapped system's update() method.

Parameters
updateContext

The current frame's update context.

Precondition

System must be initialized (pimpl_ != nullptr).

Definition at line 130 of file System.ixx.

131 assert(pimpl_ && "System not initialized");
132 pimpl_->update(updateContext);
133 }

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

Private Member Attributes

pimpl_

std::unique_ptr<Concept> helios::engine::runtime::world::System::pimpl_

Definition at line 91 of file System.ixx.

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