Class IntraEmailReceiver

Inheritance Relationships

Base Type

Class Documentation

class IntraEmailReceiver : public email::EmailReceiver

Intraprocess email receiver.

Receives email objects from the intraprocess email sender. Uses a simple queue to act as a buffer in between.

Public Functions

IntraEmailReceiver()

Constructor.

virtual ~IntraEmailReceiver()
virtual std::optional<struct EmailData> get_email(std::optional<std::chrono::nanoseconds> polling_period = std::nullopt)

Get a new email.

This function fetches a new email through polling.

The caller can specify a polling period, which will be used as a target polling rate. This means that, if the internal polling call takes more time than the polling period, the next call will be executed right away.

If the polling period value is equal to 0, the sleep call will be skipped, and polling will be done as fast as possible. This is the default value.

Parameters:

polling_period – the polling period

Returns:

the new email, or std::nullopt if it failed

void receive(const struct EmailData &data)

Receive new email.

This function will take care of generating a unique message ID.

Parameters:

data – the new email data