![]() |
Birth Generator 3.2.2
Procedural birth date generation for C++23
|
Return type for birth generation. More...
#include <birthgen.hpp>
Public Member Functions | |
| std::uint64_t | seed () const |
| Retrieve the random seed used to generate this birth. | |
| const core::seed_signature & | signature () const |
| The seed and the data this birth was generated from. | |
| std::string | date_string () const |
| ISO 8601 date string (YYYY-MM-DD). | |
| void | to_json (core::json_writer &w) const |
| Write this birth as a JSON object. | |
| std::string | to_json () const |
| This birth as a JSON document. | |
| operator std::string () const | |
| Implicit conversion to std::string. | |
Public Attributes | |
| std::string | country_code |
| ISO 3166-1 alpha-2 code. | |
| std::uint16_t | year {0} |
| Birth year. | |
| std::uint8_t | month {0} |
| Birth month (1–12). | |
| std::uint8_t | day {0} |
| Birth day (1–31). | |
| std::uint8_t | age {0} |
| Age in completed years at the reference date. | |
| sex | bio_sex {sex::male} |
| Biological sex. | |
| std::uint8_t | weekday {0} |
| Day of week (0=Sun, 1=Mon, …, 6=Sat). | |
| double | le_remaining {0.0} |
| Estimated years of life remaining. | |
| std::string | cohort |
| Generational cohort label. | |
Friends | |
| class | bthg |
| std::ostream & | operator<< (std::ostream &os, const birth &b) |
| Stream the ISO date to an output stream. | |
Return type for birth generation.
Supports implicit conversion to std::string (ISO 8601 date), streaming via operator<< and JSON output via to_json().
Definition at line 84 of file birthgen.hpp.
|
inline |
|
inline |
Implicit conversion to std::string.
Definition at line 146 of file birthgen.hpp.
|
inline |
Retrieve the random seed used to generate this birth.
Definition at line 100 of file birthgen.hpp.
|
inline |
The seed and the data this birth was generated from.
data is bthg::data_hash() at the time of generation. Definition at line 105 of file birthgen.hpp.
|
inline |
|
inline |
Write this birth as a JSON object.
| w | Writer positioned where a value is allowed. |
Definition at line 117 of file birthgen.hpp.
|
friend |
Definition at line 163 of file birthgen.hpp.
|
friend |
Stream the ISO date to an output stream.
| os | Output stream. |
| b | Birth to stream. |
Definition at line 155 of file birthgen.hpp.
| std::uint8_t dasmig::birth::age {0} |
Age in completed years at the reference date.
Definition at line 91 of file birthgen.hpp.
| sex dasmig::birth::bio_sex {sex::male} |
Biological sex.
Definition at line 92 of file birthgen.hpp.
| std::string dasmig::birth::cohort |
Generational cohort label.
Definition at line 95 of file birthgen.hpp.
| std::string dasmig::birth::country_code |
ISO 3166-1 alpha-2 code.
Definition at line 87 of file birthgen.hpp.
| std::uint8_t dasmig::birth::day {0} |
Birth day (1–31).
Definition at line 90 of file birthgen.hpp.
| double dasmig::birth::le_remaining {0.0} |
Estimated years of life remaining.
Definition at line 94 of file birthgen.hpp.
| std::uint8_t dasmig::birth::month {0} |
Birth month (1–12).
Definition at line 89 of file birthgen.hpp.
| std::uint8_t dasmig::birth::weekday {0} |
Day of week (0=Sun, 1=Mon, …, 6=Sat).
Definition at line 93 of file birthgen.hpp.
| std::uint16_t dasmig::birth::year {0} |
Birth year.
Definition at line 88 of file birthgen.hpp.