Helper to fluently build multiple Actors for a CoreInitializer.
More...
#include <Main.h>
|
using | ActorIdList = std::vector<ActorId> |
|
| ActorBuilder (ActorBuilder const &rhs)=default |
template<typename _Actor, typename... _Args> |
ActorBuilder & | addActor (_Args &&...args) noexcept |
| Create and add a new _Actor to the VirtualCore associated with this builder.
|
bool | valid () const noexcept |
| Checks if all actor additions via this builder were successful up to this point.
|
| operator bool () const noexcept |
| Explicit boolean conversion, equivalent to calling valid().
|
ActorIdList | idList () const noexcept |
| Get the list of ActorIds created by this ActorBuilder instance.
|
Helper to fluently build multiple Actors for a CoreInitializer.
Provides a chained interface to add multiple actors to a specific VirtualCore during the setup phase via its CoreInitializer.
◆ addActor()
template<typename _Actor, typename... _Args>
ActorBuilder & qb::CoreInitializer::ActorBuilder::addActor |
( |
_Args &&... | args | ) |
|
|
noexcept |
Create and add a new _Actor to the VirtualCore associated with this builder.
- Template Parameters
-
_Actor | DerivedActor type to create. |
_Args | Arguments to forward to the constructor of the _Actor. |
- Parameters
-
args | Arguments to forward to the _Actor's constructor. |
- Returns
- Reference to this ActorBuilder for method chaining.
Creates a new _Actor on the attached VirtualCore. This function can be chained to add multiple actors in a single statement. Example:
- Attention
- This function is only available before the engine is running. If actor creation fails (e.g. duplicate ServiceActor, max actors reached), the valid() state of the builder will become false.
◆ valid()
bool qb::CoreInitializer::ActorBuilder::valid |
( |
| ) |
const |
|
nodiscardnoexcept |
Checks if all actor additions via this builder were successful up to this point.
- Returns
- true if all preceding addActor() calls on this builder instance succeeded, false if any actor creation failed (e.g., duplicate ServiceActor, max actors, or internal error).
If this returns false, subsequent calls to addActor() on this builder may also effectively fail or might not add to the idList().
◆ operator bool()
qb::CoreInitializer::ActorBuilder::operator bool |
( |
| ) |
const |
|
explicitnoexcept |
Explicit boolean conversion, equivalent to calling valid().
- Returns
- true if the builder is in a valid state (all actor additions succeeded so far), false otherwise.
- See also
- valid()
◆ idList()
ActorIdList qb::CoreInitializer::ActorBuilder::idList |
( |
| ) |
const |
|
nodiscardnoexcept |
Get the list of ActorIds created by this ActorBuilder instance.
- Returns
- An ActorIdList (std::vector<ActorId>) containing the IDs of all actors successfully created by this builder instance up to the point of calling, in the order of creation. If valid() is false, this list may not contain all attempted actors or may be incomplete.