ADTF
Loading...
Searching...
No Matches
result_description< DescriptionType >

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

#include <result_description.h>

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

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

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.
 
static constexpr self_type make_result_description (const tErrorCode &i_oErrorCode) noexcept
 Make the result description object only with an error code.
 

Private Member Functions

constexpr result_description (std::uint64_t nErrorCode) noexcept
 

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 80 of file result_description.h.

Member Typedef Documentation

◆ desc_type

template<typename DescriptionType>
using desc_type = DescriptionType

Description type.

Definition at line 83 of file result_description.h.

◆ self_type

template<typename DescriptionType>
using self_type = result_description<DescriptionType>

Self type.

Definition at line 82 of file result_description.h.

◆ traits_type

template<typename DescriptionType>
using traits_type = result_description_traits<DescriptionType>

Traits type abbreviation.

Definition at line 84 of file result_description.h.

Constructor & Destructor Documentation

◆ result_description() [1/4]

template<typename DescriptionType>
result_description ( )
inlineconstexprnoexcept

Definition at line 86 of file result_description.h.

◆ result_description() [2/4]

template<typename DescriptionType>
result_description ( result_description< DescriptionType > && oOther)
inlineconstexprnoexcept

Definition at line 89 of file result_description.h.

◆ result_description() [3/4]

template<typename DescriptionType>
result_description ( const result_description< DescriptionType > & oOther)
inlinenoexcept

Definition at line 94 of file result_description.h.

◆ ~result_description()

template<typename DescriptionType>
~result_description ( )
inlinenoexcept

Definition at line 119 of file result_description.h.

◆ result_description() [4/4]

template<typename DescriptionType>
result_description ( std::uint64_t nErrorCode)
inlineconstexprprivatenoexcept

Definition at line 205 of file result_description.h.

Member Function Documentation

◆ get_detailed_description()

template<typename DescriptionType>
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 169 of file result_description.h.

◆ get_error_code()

template<typename DescriptionType>
tErrorCode get_error_code ( ) const
inlineconstexprnoexcept

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 185 of file result_description.h.

◆ make_result_description() [1/2]

template<typename DescriptionType>
static constexpr self_type make_result_description ( const tErrorCode & i_oErrorCode)
inlinestaticconstexprnoexcept

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 156 of file result_description.h.

◆ make_result_description() [2/2]

template<typename DescriptionType>
template<typename Implementation, typename... Args>
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

◆ operator=()

template<typename DescriptionType>
result_description & operator= ( const result_description< DescriptionType > & oOther)
inlinenoexcept

Definition at line 99 of file result_description.h.

Member Data Documentation

◆ m_pDetailedResult

template<typename DescriptionType>
std::uint64_t m_pDetailedResult
private

Definition at line 203 of file result_description.h.