Sparkle 0.0.1
Loading...
Searching...
No Matches
spk::TaskResult< TValueType > Class Template Reference

Wraps a value with an optional status message for task reporting. More...

#include <spk_task_result.hpp>

Collaboration diagram for spk::TaskResult< TValueType >:
Collaboration graph

Public Member Functions

 TaskResult ()=default
 Builds a default-initialized task result.
 TaskResult (const TValueType &p_value, const std::wstring &p_status=L"")
 Builds a task result with a value and status message.
TValueType value () const
 Returns the stored value.
const std::wstring & status () const
 Returns the status message.

Detailed Description

template<typename TValueType = size_t>
class spk::TaskResult< TValueType >

Wraps a value with an optional status message for task reporting.

Template Parameters
TValueTypeValue type to store in the result.
See also
Expected
spk::TaskResult<size_t> result(42, L"Completed");
auto value = result.value();
Wraps a value with an optional status message for task reporting.
Definition spk_task_result.hpp:21
TValueType value() const
Returns the stored value.
Definition spk_task_result.hpp:47

Constructor & Destructor Documentation

◆ TaskResult()

template<typename TValueType = size_t>
spk::TaskResult< TValueType >::TaskResult ( const TValueType & p_value,
const std::wstring & p_status = L"" )
inline

Builds a task result with a value and status message.

Parameters
p_valueValue to store.
p_statusStatus message describing the result.

Member Function Documentation

◆ status()

template<typename TValueType = size_t>
const std::wstring & spk::TaskResult< TValueType >::status ( ) const
inline

Returns the status message.

Returns
Status message.

◆ value()

template<typename TValueType = size_t>
TValueType spk::TaskResult< TValueType >::value ( ) const
inline

Returns the stored value.

Returns
Stored value.

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