ADTF
3.18.2
|
Wrapper for either a pointer to a detailed description object or simply a numeric error code. More...
Public Types | |
typedef ResultDescription< DescriptionIntf > | SelfType |
Self type. | |
Public Member Functions | |
ResultDescription () | |
CTOR. | |
ResultDescription (const ResultDescription &other) | |
Copy constructor. More... | |
ResultDescription & | operator= (const ResultDescription &other) |
Copy assignment operator. More... | |
ResultDescription (ResultDescription &&other) | |
Move CTOR. More... | |
ResultDescription & | operator= (ResultDescription &&other) |
Move assignment operator. More... | |
~ResultDescription () | |
DTOR. | |
DescriptionIntf const * | getDetailedDescription () const |
Get the detailed description if any was allocated. More... | |
std::int32_t | getErrorCode () const |
Get the error code if only the error code was set. More... | |
Static Public Member Functions | |
template<typename DescriptionImpl , typename... Args> | |
static SelfType | makeResultDescription (std::int32_t error_code, Args &&... args) |
Allocate an object being able to store detailed error information. More... | |
template<typename T > | |
static SelfType | makeResultDescription (const ::a_util::result::ResultInfo< T > &result_info) noexcept |
Creates a static error object referencing error code and error label information of type T . More... | |
static SelfType | makeResultDescription (std::int32_t error_code) |
Make the result description object only with an error code. More... | |
Private Types | |
typedef ResultDescriptionTraits< DescriptionIntf > | TraitsType |
Traits type abbreviation. | |
Private Member Functions | |
constexpr | ResultDescription (std::int32_t error_code) noexcept |
Construct with simple error code, no memory is allocated. More... | |
constexpr | ResultDescription (const ReferenceCountedObjectInterface< DescriptionIntf > &error_object) noexcept |
Construct with detailed error description. More... | |
Private Attributes | |
std::uint64_t | _pointer_to_result_or_error_code |
Wrapper for either a pointer to a detailed description object or simply a numeric error code.
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)DescriptionIntf | The interface used to retrieve the error information |
Definition at line 111 of file result_description_decl.h.
|
inline |
Copy constructor.
[in] | other | Other object to copy from |
Definition at line 124 of file result_description_impl.h.
|
inline |
Move CTOR.
[in,out] | other | Move-from object *this is created from |
other
is left in default-initialized state Definition at line 148 of file result_description_impl.h.
References std::swap().
|
inlineconstexprprivatenoexcept |
Construct with simple error code, no memory is allocated.
[in] | error_code | The error code |
Definition at line 257 of file result_description_impl.h.
|
inlineconstexprprivatenoexcept |
Construct with detailed error description.
[in] | error_object | Reference to error object getting cast to internal error variable |
error_object
reference counter is incremented Definition at line 264 of file result_description_impl.h.
|
inline |
Get the detailed description if any was allocated.
nullptr
if none was allocated Definition at line 237 of file result_description_impl.h.
Referenced by Result::getDescription(), Result::getErrorCode(), Result::getErrorLabel(), Result::getFile(), Result::getFunction(), Result::getLine(), and a_util::result::detail::operator==().
|
inline |
Get the error code if only the error code was set.
Definition at line 247 of file result_description_impl.h.
Referenced by Result::getDescription(), Result::getErrorCode(), and a_util::result::detail::operator==().
|
staticnoexcept |
Creates a static error object referencing error code and error label information of type T
.
T | Type for template parameter of a_util::result::ResultInfo<T> |
[in] | result_info | Unused, provided only for type deduction. |
ResultDescription
containing static error code and error label information. Definition at line 213 of file result_description_impl.h.
|
inlinestatic |
Make the result description object only with an error code.
[in] | error_code | The error code to set |
ResultDescription
Definition at line 228 of file result_description_impl.h.
|
static |
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.
DescriptionImpl | The concrete implementation type to contain the detailed error description. The first constructor argument must be of type std::int32_t . |
Args | Constructor arguments for the allocation of type Implementation |
[in] | error_code | The concrete error code either being used as first constructor argument for type Implementation or if allocation fails as the error code. |
[in] | args | The constructor arguments for the error description object. These usually include information like where did the error occur (line, file, ...) or the error string. |
ResultDescription
containing heap allocated error information. Definition at line 183 of file result_description_impl.h.
|
inline |
Copy assignment operator.
[in] | other | Other object to copy from |
*this
Definition at line 131 of file result_description_impl.h.
|
inline |
Move assignment operator.
[in,out] | other | Move-from object *this is assigned from |
other
is left in default-initialized state Definition at line 155 of file result_description_impl.h.
References std::swap().