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

template <typename T, typename TCommandBuffer>
System (T &&system, TCommandBuffer &&commandBuffer)

Wraps a concrete system in a type-erased System that also owns a CommandBuffer. 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...

voidflush (UpdateContext &updateContext) noexcept

Flushes any outstanding changes, e.g. commands of the associated buffer. More...

voidinit (GameWorld &gameWorld) noexcept

Inits this system with the owning GameWorld. 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 51 of file System.ixx.

Public Constructors

System()

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

Default constructor creating an empty System.

Definition at line 150 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 IsRuntimeSystemLike<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 163 of file System.ixx.

163 explicit System(T&& system, void* buffer = nullptr)
164 : pimpl_(std::make_unique<Model<std::remove_cvref_t<T>>>(std::forward<T>(system), buffer)){}

System()

template <typename T, typename TCommandBuffer>
helios::engine::runtime::world::System::System (T && system, TCommandBuffer && commandBuffer)
inline explicit

Wraps a concrete system in a type-erased System that also owns a CommandBuffer.

Template Parameters
T

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

TCommandBuffer

The concrete CommandBuffer-type, must satisfy IsCommandBufferLike<TCommandBuffer>.

Parameters
system

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

commandBuffer

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

Definition at line 179 of file System.ixx.

179 explicit System(T&& system, TCommandBuffer&& commandBuffer)
180 : pimpl_(
181 std::make_unique<
182 ModelWithOwnedCommandBuffer<
183 std::remove_cvref_t<T>,
184 std::remove_cvref_t<TCommandBuffer>
185 >
186 >(
187 std::forward<T>(system),
188 std::forward<TCommandBuffer>(commandBuffer)
189 ))
190 {}

System()

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

Definition at line 192 of file System.ixx.

System()

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

Definition at line 196 of file System.ixx.

Public Operators

operator=()

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

Definition at line 193 of file System.ixx.

operator=()

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

Definition at line 195 of file System.ixx.

Public Member Functions

flush()

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

Flushes any outstanding changes, e.g. commands of the associated buffer.

Parameters
updateContext

The current frame's update context.

Definition at line 215 of file System.ixx.

216 assert(pimpl_ && "System not initialized");
217 pimpl_->flush(updateContext);
218 }

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

init()

void helios::engine::runtime::world::System::init (GameWorld & gameWorld)
inline noexcept

Inits this system with the owning GameWorld.

Parameters
gameWorld

The owning GameWorld.

Definition at line 225 of file System.ixx.

225 void init(GameWorld& gameWorld) noexcept {
226 assert(pimpl_ && "System not initialized");
227 pimpl_->init(gameWorld);
228 }

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

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 237 of file System.ixx.

238 assert(pimpl_ && "System not initialized");
239 return pimpl_->underlying();
240 }

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 245 of file System.ixx.

245 [[nodiscard]] const void* underlying() const noexcept {
246 assert(pimpl_ && "System not initialized");
247 return pimpl_->underlying();
248 }

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 205 of file System.ixx.

206 assert(pimpl_ && "System not initialized");
207 pimpl_->update(updateContext);
208 }

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

Private Member Attributes

pimpl_

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

Definition at line 143 of file System.ixx.

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