|
Entity Generator 1.1.0
Composable, deterministic entity generation for C++23
|
Component that generates a uniform random value in [lo, hi]. More...
#include <entitygen.hpp>
Public Member Functions | |
| range_component (std::wstring key, T lo, T hi, Formatter fmt={}) | |
| Construct a range component. | |
| std::wstring | key () const override |
Unique key identifying this component (e.g. "name", "age"). | |
| std::any | generate (const generation_context &ctx) const override |
| Generate a random value for this component. | |
| std::wstring | to_string (const std::any &value) const override |
| Convert a generated value to a displayable string. | |
Public Member Functions inherited from dasmig::component | |
| virtual | ~component ()=default |
| Virtual destructor for proper cleanup of derived classes. | |
| virtual double | weight () const |
| Inclusion weight for this component (0.0 to 1.0). | |
| virtual bool | validate (const std::any &value) const |
| Validate a generated value. | |
| virtual bool | should_generate (const generation_context &ctx) const |
| Decide whether this component should be generated. | |
Additional Inherited Members | |
Static Protected Member Functions inherited from dasmig::component | |
| static std::wstring | default_to_string (const std::any &value) |
| Default conversion covering common standard types. | |
Component that generates a uniform random value in [lo, hi].
| T | An arithmetic type (int, double, float, etc.). |
| Formatter | Optional callable for custom string conversion. |
Definition at line 272 of file entitygen.hpp.
|
inlineexplicit |
Construct a range component.
| key | Unique component key. |
| lo | Lower bound (inclusive). |
| hi | Upper bound (inclusive). |
| fmt | Optional custom formatter. |
Definition at line 280 of file entitygen.hpp.
|
inlineoverridevirtual |
Generate a random value for this component.
| ctx | Context providing access to previously generated values and a seeded random engine. |
std::any. Implements dasmig::component.
Definition at line 286 of file entitygen.hpp.
|
inlineoverridevirtual |
Unique key identifying this component (e.g. "name", "age").
Implements dasmig::component.
Definition at line 284 of file entitygen.hpp.
|
inlineoverridevirtual |
Convert a generated value to a displayable string.
| value | The value previously returned by generate(). |
Implements dasmig::component.
Definition at line 292 of file entitygen.hpp.