PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
kcenon::pacs::ai::Result< T > Class Template Reference

Simple result type for error handling. More...

#include <ai_service_connector.h>

Collaboration diagram for kcenon::pacs::ai::Result< T >:
Collaboration graph

Public Member Functions

 Result (T value)
 
 Result (const error_info &err)
 
bool is_ok () const noexcept
 
bool is_err () const noexcept
 
T & value () &
 
const T & value () const &
 
T && value () &&
 
const error_info & error () const
 

Private Attributes

T data_ {}
 
error_info error_
 
bool has_value_
 

Detailed Description

template<typename T>
class kcenon::pacs::ai::Result< T >

Simple result type for error handling.

Definition at line 70 of file ai_service_connector.h.

Constructor & Destructor Documentation

◆ Result() [1/2]

template<typename T >
kcenon::pacs::ai::Result< T >::Result ( T value)
inline

◆ Result() [2/2]

template<typename T >
kcenon::pacs::ai::Result< T >::Result ( const error_info & err)
inline

Definition at line 73 of file ai_service_connector.h.

73: error_(err), has_value_(false) {}

Member Function Documentation

◆ error()

template<typename T >
const error_info & kcenon::pacs::ai::Result< T >::error ( ) const
inlinenodiscard

Definition at line 80 of file ai_service_connector.h.

80{ return error_; }

References kcenon::pacs::ai::Result< T >::error_.

◆ is_err()

template<typename T >
bool kcenon::pacs::ai::Result< T >::is_err ( ) const
inlinenodiscardnoexcept

Definition at line 76 of file ai_service_connector.h.

76{ return !has_value_; }

References kcenon::pacs::ai::Result< T >::has_value_.

◆ is_ok()

template<typename T >
bool kcenon::pacs::ai::Result< T >::is_ok ( ) const
inlinenodiscardnoexcept

Definition at line 75 of file ai_service_connector.h.

75{ return has_value_; }

References kcenon::pacs::ai::Result< T >::has_value_.

◆ value() [1/3]

template<typename T >
T & kcenon::pacs::ai::Result< T >::value ( ) &
inlinenodiscard

Definition at line 77 of file ai_service_connector.h.

77{ return data_; }

References kcenon::pacs::ai::Result< T >::data_.

◆ value() [2/3]

template<typename T >
T && kcenon::pacs::ai::Result< T >::value ( ) &&
inlinenodiscard

Definition at line 79 of file ai_service_connector.h.

79{ return std::move(data_); }

References kcenon::pacs::ai::Result< T >::data_.

◆ value() [3/3]

template<typename T >
const T & kcenon::pacs::ai::Result< T >::value ( ) const &
inlinenodiscard

Definition at line 78 of file ai_service_connector.h.

78{ return data_; }

References kcenon::pacs::ai::Result< T >::data_.

Member Data Documentation

◆ data_

template<typename T >
T kcenon::pacs::ai::Result< T >::data_ {}
private

◆ error_

template<typename T >
error_info kcenon::pacs::ai::Result< T >::error_
private

Definition at line 84 of file ai_service_connector.h.

Referenced by kcenon::pacs::ai::Result< T >::error().

◆ has_value_

template<typename T >
bool kcenon::pacs::ai::Result< T >::has_value_
private

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