ADTF
builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/core/result.h File Reference

Copyright © Audi Electronics Venture GmbH. More...

Go to the source code of this file.

Classes

class  cResult
 A common result class usable as return value throughout. More...
 
struct  cResult::sErrorEval< ErrorType, ErrorTypes >
 Used as entry point for comparison on the error codes used in IsEqual() More...
 
struct  cResult::sErrorEval< ErrorType >
 Used as exit point for comparison on the error codes used in IsEqual() More...
 

Namespaces

 A_UTILS_NS
 ADTF A_UTIL Namespace - Within adtf this is used as adtf::util or adtf_util.
 

Macros

#define IS_OK(s)   ( ( s ).IsOk() )
 Check if result is OK.
 
#define IS_FAILED(s)   ( ( s ).IsFailed() )
 Check if result is failed.
 
#define RETURN_NOERROR   return ERR_NOERROR
 Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
 
#define RETURN_ERROR(code)   return (code)
 Return specific error code, which requires the calling function's return type to be tResult.
 
#define RETURN_ERROR_DESC(_code, ...)   return DETAILED_RESULT(_code, __VA_ARGS__)
 Same as RETURN_ERROR(_error) using a printf like parameter list for detailed error description.
 
#define RETURN_IF_FAILED(s)   { tResult _errcode(s); if ( _errcode.IsFailed() ) { return (_errcode); } }
 Return if expression is failed, which requires the calling function's return type to be tResult.
 
#define RETURN_IF_FAILED_DESC(s, ...)   { tResult _errcode(s); if ( _errcode.IsFailed() ) { return DETAILED_RESULT(_errcode.GetErrorCode().value, __VA_ARGS__); } }
 
#define RETURN_IF_POINTER_NULL(_ptr)   if ( nullptr == _ptr ) { RETURN_ERROR(ERR_POINTER); }
 Return ERR_POINTER if _ptr is nullptr, which requires the calling function's return type to be tResult.
 
#define RETURN_IF_POINTER_NULL_DESC(_ptr, ...)   if ( nullptr == _ptr ) { return DETAILED_RESULT(ERR_POINTER, __VA_ARGS__); }
 Return ERR_POINTER with description if _ptr is nullptr, which requires the calling function's return type to be tResult.
 

Typedefs

using tResult = A_UTILS_NS::cResult
 For backwards compatibility and to bring latest version into scope.
 

Functions

static std::string filename (std::string_view strPath)
 
static std::string filename_with_thread_id (std::string_view strPath)
 
static std::string format (const char *strFormat,...)
 
tBool operator!= (const cResult &i_oLHS, const cResult &i_oRHS)
 Negated comparison operator (shallow comparison) More...
 
tBool operator== (const cResult &i_oLHS, const cResult &i_oRHS)
 
template<tErrorCode::error_code_type ErrorCode>
tBool operator== (const cResult &oResult, const tError< ErrorCode > &sCode)
 Comparison operator (equality) for objects of type cResult and tError. More...
 
template<tErrorCode::error_code_type ErrorCode>
tBool operator!= (const cResult &oResult, const tError< ErrorCode > &sCode)
 Comparison operator (inequality) for objects of type cResult and tError. More...
 
template<tErrorCode::error_code_type ErrorCode>
tBool operator== (const tError< ErrorCode > &sCode, const cResult &oResult)
 Comparison operator (equality) for objects of type cResult and tError. More...
 
template<tErrorCode::error_code_type ErrorCode>
tBool operator!= (const tError< ErrorCode > &sCode, const cResult &oResult)
 Comparison operator (inequality) for objects of type cResult and tError. More...
 
void swap (cResult &i_oLHS, cResult &i_oRHS)
 
std::string to_string (const cResult &i_oResult)
 
template<>
void swap< A_UTILS_NS::cResult > (A_UTILS_NS::cResult &i_oLHS, A_UTILS_NS::cResult &i_oRHS)
 swap specialization for ADL More...
 

Detailed Description

Copyright © Audi Electronics Venture GmbH.

All rights reserved

Definition in file builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/core/result.h.

Function Documentation

◆ swap< A_UTILS_NS::cResult >()

void std::swap< A_UTILS_NS::cResult > ( A_UTILS_NS::cResult i_oLHS,
A_UTILS_NS::cResult i_oRHS 
)
inline

swap specialization for ADL

Parameters
[in,out]i_oLHSLeft hand side result to be swapped
[in,out]i_oRHSRight hand side result to be swapped

Definition at line 632 of file builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/core/result.h.

References A_UTILS_NS::swap().