Entity Generator 1.1.0
Composable, deterministic entity generation for C++23
Loading...
Searching...
No Matches
entitygen.hpp File Reference

Entity generator library — composable, deterministic entity generation for C++23. More...

#include "random.hpp"
#include <algorithm>
#include <any>
#include <cstdint>
#include <functional>
#include <future>
#include <iterator>
#include <map>
#include <memory>
#include <optional>
#include <ostream>
#include <ranges>
#include <span>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <vector>

Go to the source code of this file.

Classes

class  dasmig::generation_context
 Context passed to components during generation. More...
 
class  dasmig::component
 Abstract base for entity components. More...
 
struct  dasmig::use_default_formatter
 Tag type indicating that generic components should use default_to_string(). More...
 
class  dasmig::constant_component< T, Formatter >
 Component that always returns a fixed value. More...
 
class  dasmig::choice_component< T, Formatter >
 Component that picks uniformly at random from a list of values. More...
 
class  dasmig::range_component< T, Formatter >
 Component that generates a uniform random value in [lo, hi]. More...
 
class  dasmig::callback_component< T, GenFn, Formatter >
 Component that wraps a callable for one-off or computed values. More...
 
class  dasmig::weighted_choice_component< T, Formatter >
 Component that picks from a list of values using per-option weights. More...
 
struct  dasmig::weighted_choice_component< T, Formatter >::option
 A value–weight pair for weighted selection. More...
 
class  dasmig::entity
 A generated entity holding component values in registration order. More...
 
class  dasmig::generation_observer
 Observer interface for hooking into generation lifecycle events. More...
 
class  dasmig::eg
 The entity generator — produces entities with configurable components. More...
 

Functions

Generic Components

Reusable component templates for common patterns.

template<typename GenFn , typename Formatter = use_default_formatter>
 dasmig::callback_component (std::wstring, GenFn, Formatter={}) -> callback_component< std::invoke_result_t< GenFn, const generation_context & >, GenFn, Formatter >
 Deduction guide for callback_component.
 

Detailed Description

Entity generator library — composable, deterministic entity generation for C++23.

Author
Diego Dasso Migotto (diegomigotto at hotmail dot com)
See also
See doc/usage.md for the narrative tutorial.

Definition in file entitygen.hpp.

Function Documentation

◆ callback_component()

template<typename GenFn , typename Formatter = use_default_formatter>
dasmig::callback_component ( std::wstring  ,
GenFn  ,
Formatter  = {} 
) -> callback_component< std::invoke_result_t< GenFn, const generation_context & >, GenFn, Formatter >

Deduction guide for callback_component.

Deduces T from the return type of GenFn so users don't need to spell out the lambda type explicitly.