Entity Generator 1.1.0
Composable, deterministic entity generation for C++23
Loading...
Searching...
No Matches
dasmig::generation_context Class Reference

Context passed to components during generation. More...

#include <entitygen.hpp>

Public Member Functions

bool has (const std::wstring &component_key) const
 Check if a component value has already been generated.
 
template<typename T >
get (const std::wstring &component_key) const
 Typed retrieval of an already-generated component value.
 
effolkronium::random_local & random () const
 Access the random engine for this generation.
 

Friends

class eg
 

Detailed Description

Context passed to components during generation.

Provides access to previously generated component values and a seeded random engine. Created and populated by the entity generator; not user-constructible.

See also
component::generate()

Definition at line 38 of file entitygen.hpp.

Member Function Documentation

◆ get()

template<typename T >
T dasmig::generation_context::get ( const std::wstring &  component_key) const
inline

Typed retrieval of an already-generated component value.

Template Parameters
TThe expected type of the stored value.
Parameters
component_keyThe component key to retrieve.
Returns
The value cast to T.
Exceptions
std::bad_any_castIf T does not match the stored type.

Definition at line 55 of file entitygen.hpp.

◆ has()

bool dasmig::generation_context::has ( const std::wstring &  component_key) const
inline

Check if a component value has already been generated.

Parameters
component_keyThe component key to look up.
Returns
true if a value for the key exists in the context.

Definition at line 44 of file entitygen.hpp.

◆ random()

effolkronium::random_local & dasmig::generation_context::random ( ) const
inline

Access the random engine for this generation.

Returns
A reference to the per-component seeded random engine.

Definition at line 62 of file entitygen.hpp.

Friends And Related Symbol Documentation

◆ eg

friend class eg
friend

Definition at line 78 of file entitygen.hpp.


The documentation for this class was generated from the following file: