8 #ifndef _A_UTILS_BASE_RESULT_H_
9 #define _A_UTILS_BASE_RESULT_H_
44 template<tErrorCode::error_code_type ErrorCode>
62 template<tErrorCode::error_code_type ErrorCode>
64 const tChar* i_strErrorDescription,
66 const tChar* i_strFile,
67 const tChar* i_strFunction);
84 const tChar* i_strErrorDescription,
86 const tChar* i_strFile,
87 const tChar* i_strFunction);
98 const tChar* i_strErrorDescription,
100 const tChar* i_strFile,
101 const tChar* i_strFunction);
183 template<tErrorCode::error_code_type ErrorCode>
192 template<
typename ... ErrorTypes>
233 const tChar* i_strErrorDescription,
235 const tChar* i_strFile,
236 const tChar* i_strFunction,
237 const tChar* i_strErrorCode);
249 const tChar* i_strErrorDescription,
251 const tChar* i_strFile,
252 const tChar* i_strFunction);
272 template<
typename ErrorType,
typename ... ErrorTypes>
275 template<
typename ErrorType>
295 template<tErrorCode::error_code_type ErrorCode>
306 template<tErrorCode::error_code_type ErrorCode>
308 const tChar* i_strErrorDescription,
310 const tChar* i_strFile,
311 const tChar* i_strFunction)
313 i_strErrorDescription,
317 tError<ErrorCode>::str_error_code)
327 const tChar* i_strErrorDescription,
329 const tChar* i_strFile,
330 const tChar* i_strFunction) :
331 cResult(CreateFrom(i_nErrorCode, i_strErrorDescription, i_nLine, i_strFile, i_strFunction))
336 const tChar* i_strErrorDescription,
338 const tChar* i_strFile,
339 const tChar* i_strFunction) :
340 cResult(i_oResult.GetErrorCode(),
341 i_strErrorDescription,
345 i_oResult.GetErrorString())
351 swap(*
this, i_oOther);
362 swap(*
this, i_oOther);
363 if (i_oOther.IsFailed())
376 return !(i_oLHS == i_oRHS);
389 template<tErrorCode::error_code_type ErrorCode>
395 template<
typename ... ErrorTypes>
408 template<tErrorCode::error_code_type ErrorCode>
421 template<tErrorCode::error_code_type ErrorCode>
424 return !oResult.
IsEqual(sCode);
434 template<tErrorCode::error_code_type ErrorCode>
447 template<tErrorCode::error_code_type ErrorCode>
450 return !oResult.
IsEqual(sCode);
459 template<
typename ErrorType,
typename ... ErrorTypes>
470 const ErrorType& i_oErrorVal,
471 const ErrorTypes&... i_oErrorVals)
473 if (
static_cast<tErrorCode>(i_oErrorVal) == i_oErrorCode)
488 template<
typename ErrorType>
499 return static_cast<tErrorCode>(i_oErrorVal) == i_oErrorCode;
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type).
int32_t tInt32
type definition for signed integer values (32bit) (platform and compiler independent type).
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
A common result class usable as return value throughout.
const tChar * GetDescription() const
Get user provided error description.
tBool IsOk() const
Check whether this result object contains ERR_NOERROR.
cResult(tErrorCode i_nErrorCode, const tChar *i_strErrorDescription, tInt32 i_nLine, const tChar *i_strFile, const tChar *i_strFunction, const tChar *i_strErrorCode)
Construct result object with complete set of error information.
cResult()
Construct empty which basically means no error occurred.
static tErrorString GetErrorString(const tErrorCode &i_oErrorCode)
Query the string representation of an error code.
const tChar * GetErrorString() const
Get error code as string representation.
friend tBool operator==(const cResult &i_oLHS, const cResult &i_oRHS)
Comparison operator (shallow comparison)
tInt32 GetLine() const
Get line in source file where the error was reported.
static cResult CreateFrom(tErrorCode::error_code_type i_nErrorCode, const tChar *i_strErrorDescription, tInt32 i_nLine, const tChar *i_strFile, const tChar *i_strFunction)
Create a detailed object of type cResult on the heap from an error code.
detail::result_description< detail::IErrorDescription > description_type
Abbreviation typedef.
tErrorCode GetErrorCode() const
Get error code.
const tChar * GetFunction() const
Get name of the function the error was reported in.
tBool IsFailed() const
Check whether this result object contains an error != ERR_NOERROR.
cResult & operator=(decltype(ERR_NOERROR))
Assign with ERR_NOERROR.
description_type m_oResultHandler
The result handler wrapper.
const tChar * GetFile() const
Get name of the file the error was reported in.
cResult(const cResult &i_oOther)
Copy constructor.
tBool IsEqual(const tError< ErrorCode > &i_oErrorVal) const
Check whether an error code is equal to the contained one.
friend void swap(cResult &i_oLHS, cResult &i_oRHS)
Specialized friend swap function to enable ADL in std::swap later.
#define tTrue
Value for tBool.
ADTF A_UTIL Namespace - Within adtf this is used as adtf::util or adtf_util.
tBool operator==(const cMultiArrayIndex &o_A, const cMultiArrayIndex &o_B)
Comparison operator.
tBool operator!=(const cMultiArrayIndex &o_A, const cMultiArrayIndex &o_B)
Comparison operator.
void swap(cResult &i_oLHS, cResult &i_oRHS)
static tBool dispatch(tErrorCode i_oErrorCode, const ErrorType &i_oErrorVal)
Exit point for compile time dispatching of error codes.
Used as entry point for comparison on the error codes used in IsEqual()
static tBool dispatch(tErrorCode i_oErrorCode, const ErrorType &i_oErrorVal, const ErrorTypes &... i_oErrorVals)
Compile time dispatching of error codes.
C++11 POD type to distribute error codes between binary boundaries.
tInt32 error_code_type
Type of the error code.
Basic error type template, specialized by _MAKE_ERROR() to create concrete error types.
Wrapper for stringification of error codes - for usage by struct tError.