ADTF
result_description< DescriptionType >

64 Bit error type has max 63 Bit large pointer type member variable More...

Public Types

using self_type = result_description< DescriptionType >
 Self type.
 
using desc_type = DescriptionType
 Description type.
 
using traits_type = result_description_traits< DescriptionType >
 Traits type abbreviation.
 

Public Member Functions

 result_description (const result_description &oOther)
 
result_descriptionoperator= (const result_description &oOther)
 
desc_type const * get_detailed_description () const noexcept
 Get the detailed description if any was allocated. More...
 
tErrorCode get_error_code () const noexcept
 Get the error code if only the error code was set. More...
 

Static Public Member Functions

template<typename Implementation , typename... Args>
static self_type make_result_description (const tErrorCode &i_oErrorCode, Args &&... args) noexcept
 Allocate an object being able to store detailed error information. More...
 
static self_type make_result_description (const tErrorCode &i_oErrorCode) noexcept
 Make the result description object only with an error code. More...
 

Private Member Functions

 result_description (std::uint64_t nErrorCode)
 

Private Attributes

std::uint64_t m_pDetailedResult
 

Detailed Description

template<typename DescriptionType>
struct A_UTILS_NS::detail::result_description< DescriptionType >

64 Bit error type has max 63 Bit large pointer type member variable

[1|...|______________________up_to_63_____________________________] [a| b | c ] Regions:

  • a: Error code Bit - Indicates whether only the error code in region b was set (1 == yes, 0 == no)
  • b: padding data with unused pointer bits
  • c: up to 63 Bits - Either only the error code value or the pointer to the allocated error description (might be nil)
Template Parameters
DescriptionTypeThe detailed description type which might be used to allocate space for detailed error information.

Definition at line 79 of file result_description.h.

Member Function Documentation

◆ get_detailed_description()

desc_type const* get_detailed_description ( ) const
inlinenoexcept

Get the detailed description if any was allocated.

Returns
Pointer to the detailed error description - nullptr if none was allocated
Note
If get_error_code() and get_detailed_description() return with indication of no error code, no error code was set

Definition at line 163 of file result_description.h.

References result_description_traits< DescriptionType >::is_detailed_description_set().

◆ get_error_code()

tErrorCode get_error_code ( ) const
inlinenoexcept

Get the error code if only the error code was set.

Returns
The error code
Note
If get_error_code() and get_detailed_description() return with indication of no error code, no error code was set

Definition at line 179 of file result_description.h.

References result_description_traits< DescriptionType >::error_code_bitmask, and result_description_traits< DescriptionType >::is_error_code_set().

◆ make_result_description() [1/2]

static self_type make_result_description ( const tErrorCode i_oErrorCode)
inlinestaticnoexcept

Make the result description object only with an error code.

Parameters
[in]i_oErrorCodeThe error code to set
Returns
New object of type result_description

Definition at line 150 of file result_description.h.

◆ make_result_description() [2/2]

static self_type make_result_description ( const tErrorCode i_oErrorCode,
Args &&...  args 
)
staticnoexcept

Allocate an object being able to store detailed error information.

On common operating systems not the entire 64Bits of a pointer are used to address virtual memory - so there are some spare bits free to be used as user space. However, to safely mask out the appropriate bits, it is checked whether the pointer to the allocated detailed description object indeed does not use the user space bits. If so, the detailed description will not be available and only the error code is set.

Template Parameters
ImplementationThe concrete implementation type to contain the detailed error description. The first constructor argument must be of type tErrorCode.
ArgsConstructor arguments for the allocation of type Implementation
Parameters
[in]i_oErrorCodeThe concrete error code either being used as first constructor argument for type Implementation or if allocation fails as the error code.
[in]argsThe constructor arguments for the error description object. These usually include information like where did the error occur (line, file, ...) or the error string.
Returns
New object of type result_description