|
| | emg () |
| | Default constructor — creates an empty generator with no data.
|
| |
|
| emg (const emg &)=delete |
| | Not copyable.
|
| |
|
emg & | operator= (const emg &)=delete |
| | Not copyable.
|
| |
|
| emg (emg &&) noexcept=default |
| | Movable.
|
| |
|
emg & | operator= (emg &&) noexcept=default |
| | Movable.
|
| |
|
| ~emg ()=default |
| | Destructor.
|
| |
| email | get_email (const email_request &request) |
| | Generate a random email address. Use email_request{} for the defaults.
|
| |
| email | get_email (const email_request &request, std::uint64_t call_seed) const |
| | Generate a deterministic email address.
|
| |
| std::vector< email > | get_email_batch (const email_request &request, const core::batch_options &options) |
| | Generate a batch of email results from a seed drawn like get_email() draws its own.
|
| |
| std::vector< email > | get_email_batch (const email_request &request, const core::batch_options &options, std::uint64_t batch_seed) const |
| | Generate a batch of email results, deterministically.
|
| |
| template<typename Sink > |
| void | for_each_email (const email_request &request, const core::batch_options &options, std::uint64_t batch_seed, Sink &&sink) const |
| | Stream a batch of email results to a sink without holding the whole batch.
|
| |
| template<typename Sink > |
| void | for_each_email (const email_request &request, const core::batch_options &options, Sink &&sink) |
| | Stream a batch of email results with a batch seed drawn like get_email() draws its own.
|
| |
| bool | has_data () const |
| | Check whether any data has been loaded.
|
| |
| std::size_t | country_count () const |
| | Return the number of countries loaded.
|
| |
| const std::vector< std::string > & | countries () const |
| | The countries an address can be generated for.
|
| |
| bool | has_country (std::string_view country) const |
| | Whether a country is loaded.
|
| |
| void | load (const std::filesystem::path &dir) |
| | Load data from a resource directory, replacing all data and layers loaded before.
|
| |
| bool | load (dataset tier) |
| | Load a dataset tier, replacing all data and layers loaded before.
|
| |
| void | extend (const std::filesystem::path &path, core::layer_mode mode=core::layer_mode::override) |
| | Add data layers from a directory or a file.
|
| |
| const core::layer_info & | extend (email_table which, core::tsv_document doc, core::layer_mode mode=core::layer_mode::override) |
| | Add a data layer to one table.
|
| |
| const core::layer_info & | extend_from_string (email_table which, std::string_view text, std::string source, core::layer_mode mode=core::layer_mode::override) |
| | Add a data layer to one table from TSV text (for example from a WebAssembly host).
|
| |
| const std::vector< core::layer_info > & | layers (email_table which) const |
| | The layers in effect for one table, in order.
|
| |
| std::uint64_t | data_hash () const |
| | Hash of the loaded data (all tables), recorded in each result's signature().
|
| |
Email Generator: email addresses in each country's style.
A call draws a country (by population), a style of the country's profile ("style"), the handle words ("local"), the digits ("number") and the domain ("domain"), each from a stream split from the call seed. Output is identical on every compiler and platform (dasmig-core).
Can be used as a singleton via instance() or constructed independently.
- Thread safety
- Each instance is independent. Concurrent calls to get_phone(request, seed) on the same instance are safe; calls that use the instance engine, loading and extending require external synchronisation.
Definition at line 174 of file emailgen.hpp.
| std::vector< email > dasmig::emg::get_email_batch |
( |
const email_request & |
request, |
|
|
const core::batch_options & |
options, |
|
|
std::uint64_t |
batch_seed |
|
) |
| const |
|
inline |
Generate a batch of email results, deterministically.
Item i is exactly get_email(request, core::item_seed(batch_seed, options.first + i)); see get_phone_batch().
- Parameters
-
| request | What every item is generated from. |
| options | Count, first index, threads and uniqueness (the rule must be made for email). |
| batch_seed | Seed of the whole batch. |
- Returns
- The results, in index order.
- Exceptions
-
| std::invalid_argument | If the request or options are invalid. |
| std::runtime_error | If no data has been loaded, or a unique batch runs out of attempts. |
Definition at line 263 of file emailgen.hpp.
| bool dasmig::emg::load |
( |
dataset |
tier | ) |
|
|
inline |
Load a dataset tier, replacing all data and layers loaded before.
Uses the compiled-in copy when the library is built with DASMIG_EMAIL_EMBED, otherwise searches resources/, ../resources, email-generator/resources and ../email-generator/resources.
- Parameters
-
- Returns
- False when the tier was not found.
- Exceptions
-
| core::tsv_error | If a file is malformed. |
Definition at line 352 of file emailgen.hpp.