Interest Generator 3.0.1
Religion, hobbies and favourite media by country, age and sex for C++23
Loading...
Searching...
No Matches
dasmig::interest Class Reference

Return type for interest generation. More...

#include <interestgen.hpp>

Public Member Functions

std::uint64_t seed () const
 Retrieve the random seed used to generate this interest.
 
const core::seed_signature & signature () const
 The seed and the data this interest was generated from.
 
std::string to_string () const
 Human-readable summary string.
 
void to_json (core::json_writer &w) const
 Write this interest as a JSON object.
 
std::string to_json () const
 This interest 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 of the country drawn from.
 
std::string religion
 Religion label (the religion column).
 
std::string religion_group
 Major group of the religion (the group column).
 
std::vector< interest_item > hobbies
 Hobbies, in the order they were drawn.
 
std::vector< interest_item > films
 Favourite film genres.
 
std::vector< interest_item > games
 Favourite game genres.
 
std::vector< interest_item > books
 Favourite book genres.
 
std::vector< interest_item > music
 Favourite music genres.
 

Friends

class intg
 
std::ostream & operator<< (std::ostream &os, const interest &v)
 Stream the summary to an output stream.
 

Detailed Description

Return type for interest generation.

Supports implicit conversion to std::string (the religion), streaming via operator<< and JSON output via to_json().

Definition at line 66 of file interestgen.hpp.

Member Function Documentation

◆ operator std::string()

dasmig::interest::operator std::string ( ) const
inline

Implicit conversion to std::string.

Returns
Summary string.

Definition at line 125 of file interestgen.hpp.

◆ seed()

std::uint64_t dasmig::interest::seed ( ) const
inline

Retrieve the random seed used to generate this interest.

Returns
The call seed; pass it, with the same request, to the seeded get_interest() overload to generate the same interest again.

Definition at line 81 of file interestgen.hpp.

◆ signature()

const core::seed_signature & dasmig::interest::signature ( ) const
inline

The seed and the data this interest was generated from.

Returns
The replay signature; data is intg::data_hash() at the time of generation.

Definition at line 86 of file interestgen.hpp.

◆ to_json() [1/2]

std::string dasmig::interest::to_json ( ) const
inline

This interest as a JSON document.

Returns
Compact JSON, for example {"country_code":"BR","religion":"...","religion_group":"...","hobbies":[{"key":"...","label":"..."}],...,"signature":{...}}.

Definition at line 116 of file interestgen.hpp.

◆ to_json() [2/2]

void dasmig::interest::to_json ( core::json_writer &  w) const
inline

Write this interest as a JSON object.

Parameters
wWriter positioned where a value is allowed.

Definition at line 97 of file interestgen.hpp.

◆ to_string()

std::string dasmig::interest::to_string ( ) const
inline

Human-readable summary string.

Returns
The religion.

Definition at line 93 of file interestgen.hpp.

Friends And Related Symbol Documentation

◆ intg

friend class intg
friend

Definition at line 153 of file interestgen.hpp.

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const interest &  v 
)
friend

Stream the summary to an output stream.

Parameters
osOutput stream.
vThe interest to stream.
Returns
The stream.

Definition at line 134 of file interestgen.hpp.

Member Data Documentation

◆ books

std::vector<interest_item> dasmig::interest::books

Favourite book genres.

Definition at line 75 of file interestgen.hpp.

◆ country_code

std::string dasmig::interest::country_code

ISO 3166-1 alpha-2 code of the country drawn from.

Definition at line 69 of file interestgen.hpp.

◆ films

std::vector<interest_item> dasmig::interest::films

Favourite film genres.

Definition at line 73 of file interestgen.hpp.

◆ games

std::vector<interest_item> dasmig::interest::games

Favourite game genres.

Definition at line 74 of file interestgen.hpp.

◆ hobbies

std::vector<interest_item> dasmig::interest::hobbies

Hobbies, in the order they were drawn.

Definition at line 72 of file interestgen.hpp.

◆ music

std::vector<interest_item> dasmig::interest::music

Favourite music genres.

Definition at line 76 of file interestgen.hpp.

◆ religion

std::string dasmig::interest::religion

Religion label (the religion column).

Definition at line 70 of file interestgen.hpp.

◆ religion_group

std::string dasmig::interest::religion_group

Major group of the religion (the group column).

Definition at line 71 of file interestgen.hpp.


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