8#ifndef _A_UTILS_CORE_RESULT_DESCRIPTION_H_
9#define _A_UTILS_CORE_RESULT_DESCRIPTION_H_
25template<
typename DescriptionType>
79template<
typename DescriptionType>
80struct result_description
82 using self_type = result_description<DescriptionType>;
86 constexpr result_description() noexcept : m_pDetailedResult(0)
91 oOther.m_pDetailedResult = 0;
94 result_description(
const result_description& oOther)
noexcept: result_description()
99 result_description& operator=(
const result_description& oOther)
noexcept
101 using reference_counted_impl_type =
102 typename traits_type::reference_counted_object_type;
108 reinterpret_cast<reference_counted_impl_type*
>(m_pDetailedResult)->RemoveReference();
110 m_pDetailedResult = oOther.m_pDetailedResult;
113 reinterpret_cast<reference_counted_impl_type*
>(m_pDetailedResult)->AddReference();
119 ~result_description() noexcept
123 using reference_counted_impl_type=
typename traits_type::reference_counted_object_type;
124 reinterpret_cast<reference_counted_impl_type*
>(m_pDetailedResult)->RemoveReference();
148 template<
typename Implementation,
typename... Args>
174 return &
reinterpret_cast<typename traits_type::reference_counted_object_type*
>(m_pDetailedResult)->GetObject();
192 (m_pDetailedResult | 0xFFFFFFFF00000000)
203 std::uint64_t m_pDetailedResult;
80struct result_description {
…};
225 static_assert(
sizeof(std::uintptr_t) <= 8,
226 "result_description pointers must always have a size of 8 Byte or less!");
228 "Description type unsupported size!");
229 static_assert(std::is_standard_layout<result_description<T>>::value,
230 "Description type is not of standard layout!");
232 return i_oLHS.get_error_code() == i_oRHS.get_error_code()
233 && i_oLHS.get_detailed_description() == i_oRHS.get_detailed_description();
247 return !(i_oLHS == i_oRHS);
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
An internal stable interface for binary compatibility of reference counting.
ADTF A_UTIL Namespace - Within adtf this is used as util or adtf_util.
tBool operator!=(const result_description< T > &i_oLHS, const result_description< T > &i_oRHS) noexcept
Compare two result description objects for inequality.
tBool operator==(const result_description< T > &i_oLHS, const result_description< T > &i_oRHS) noexcept
Compare two result description objects for equality.
Traits type for the result description.
static constexpr std::uint64_t error_code_bit
The error code bit indicating whether only the error code (1) was set or not (0)
DescriptionType description_type
The description type.
static constexpr tBool is_detailed_description_set(const std::uint64_t i_pDescription) noexcept
Check whether the detailed description was allocated.
static constexpr std::uint64_t error_code_bitmask
The error code bitmask to mask out the error code bit.
static constexpr tBool is_error_code_set(const std::uint64_t i_pDescription) noexcept
Check whether only the error code was set.
64 Bit error type has max 63 Bit large pointer type member variable
detail::IErrorDescription desc_type
static self_type make_result_description(const tErrorCode &i_oErrorCode, Args &&... args) noexcept
Allocate an object being able to store detailed error information.
constexpr tErrorCode get_error_code() const noexcept
Get the error code if only the error code was set.
result_description< detail::IErrorDescription > self_type
static constexpr self_type make_result_description(const tErrorCode &i_oErrorCode) noexcept
Make the result description object only with an error code.
desc_type const * get_detailed_description() const noexcept
Get the detailed description if any was allocated.
result_description_traits< detail::IErrorDescription > traits_type
C++11 POD type to distribute error codes between binary boundaries.
tInt32 error_code_type
Type of the error code.