6#include "structure/container/spk_task_result.hpp"
10 template <
typename TType,
typename TReportStatusType =
size_t>
46 explicit Expected(
const TType &p_value,
const TReportStatusType &p_reportStatusID,
const std::wstring &p_reportStatusMessage) :
48 _reportStatus(p_reportStatusID, p_reportStatusMessage)
57 explicit Expected(TType &&p_value,
const TReportStatusType &p_reportStatusID,
const std::wstring &p_reportStatusMessage) :
58 _value(
std::move(p_value)),
59 _reportStatus(p_reportStatusID, p_reportStatusMessage)
71 return (
Expected({}, p_reportStatusID, p_reportStatusMessage));
98 return (_reportStatus);
107 return (_reportStatus);
Expected()=default
Builds a default-initialized expected value.
const ReportStatus & reportStatus() const
Returns a const reference to the report status.
Definition spk_expected.hpp:105
const TType & value() const
Returns a const reference to the stored value.
Definition spk_expected.hpp:87
TaskResult< TReportStatusType > ReportStatus
Report status container type.
Definition spk_expected.hpp:29
Expected(const TType &p_value, const TReportStatusType &p_reportStatusID, const std::wstring &p_reportStatusMessage)
Builds an expected value with a report status.
Definition spk_expected.hpp:46
Expected(TType &&p_value, const TReportStatusType &p_reportStatusID, const std::wstring &p_reportStatusMessage)
Builds an expected value by moving the payload and adding a report status.
Definition spk_expected.hpp:57
ReportStatus & reportStatus()
Returns a mutable reference to the report status.
Definition spk_expected.hpp:96
TType & value()
Returns a mutable reference to the stored value.
Definition spk_expected.hpp:78
static Expected generateReport(const TReportStatusType &p_reportStatusID, const std::wstring &p_reportStatusMessage)
Creates an expected value with a default-initialized payload and report status.
Definition spk_expected.hpp:69
Wraps a value with an optional status message for task reporting.
Definition spk_task_result.hpp:21