ADTF  3.18.2
result_info_decl.h File Reference

Public API for ResultInfo type, functions and macros. More...

Go to the source code of this file.

Classes

struct  ResultInfo< T >
 Basic result information template, used by a_util::result::Result. More...
 
struct  ResultInfo< void >
 Implements basic success result information for usage with a_util::result::Result. More...
 

Namespaces

 a_util
 Serves as the root component, with common functionality documented in core functionality.
 
 a_util::result
 Serves as component for functionality handling error and return types.
 

Macros

#define _MAKE_RESULT(_no, _label)
 Create a result type and a constant instance of this type in an unnamed namespace. More...
 

Functions

template<typename ResultType >
bool isOk (const ResultType &result)
 Check whether a return value indicates a successful function execution. More...
 
template<typename ResultType >
bool isFailed (const ResultType &result)
 Check whether a return value indicates an unsuccessful function execution. More...
 
template<typename ResultTypeLHS , typename ResultTypeRHS >
bool operator== (const ResultInfo< ResultTypeLHS > &lhs, const ResultInfo< ResultTypeRHS > &rhs)
 Compare two specialized result information objects for equality. More...
 
template<typename ResultTypeLHS , typename ResultTypeRHS >
bool operator!= (const ResultInfo< ResultTypeLHS > &lhs, const ResultInfo< ResultTypeRHS > &rhs)
 Compare two specialized result information objects for inequality. More...
 
template<typename ResultTypeLHS , typename ResultTypeRHS >
bool operator< (const ResultInfo< ResultTypeLHS > &lhs, const ResultInfo< ResultTypeRHS > &rhs)
 Less-than operator for two specialized result information objects. More...
 
template<typename ResultTypeLHS , typename ResultTypeRHS >
bool operator> (const ResultInfo< ResultTypeLHS > &lhs, const ResultInfo< ResultTypeRHS > &rhs)
 Greater-than operator for two specialized result information objects. More...
 
template<typename ResultTypeLHS , typename ResultTypeRHS >
bool operator<= (const ResultInfo< ResultTypeLHS > &lhs, const ResultInfo< ResultTypeRHS > &rhs)
 Less-than-or-equal operator for two specialized result information objects. More...
 
template<typename ResultTypeLHS , typename ResultTypeRHS >
bool operator>= (const ResultInfo< ResultTypeLHS > &lhs, const ResultInfo< ResultTypeRHS > &rhs)
 Greater-than-or-equal operator for two specialized result information objects. More...
 

Detailed Description

Public API for ResultInfo type, functions and macros.

Definition in file result_info_decl.h.

Macro Definition Documentation

◆ _MAKE_RESULT

#define _MAKE_RESULT (   _no,
  _label 
)
Value:
namespace { \
struct ResultType_##_label : public ::a_util::result::ResultInfo<ResultType_##_label> { \
static std::int32_t getCode() \
{ \
static_assert(std::is_same<decltype((_no)), std::int32_t>::value, \
#_no " is not in range of std::int32_t."); \
return _no; \
} \
static const char* getLabel() \
{ \
return #_label; \
} \
}; \
const ::a_util::result::ResultInfo<ResultType_##_label> _label = ResultType_##_label(); \
} /* ns anonymous */ \
static_assert(DEV_ESSENTIAL_INTERNAL_MAKE_RESULT_CHECK_NOT_ZERO(_no), \
"'0' is not allowed, because it is reserved for results indicating no error. " \
"Please use a_util::result::SUCCESS instead. To disable this check, define " \
"'DEV_ESSENTIAL_DISABLE_MAKE_RESULT_CHECK_RESERVED_ZERO'")

Create a result type and a constant instance of this type in an unnamed namespace.

Parameters
[in]_noNumeric representation of the result type
[in]_labelStringified version for the result type

Definition at line 36 of file result_info_decl.h.