ADTF
Loading...
Searching...
No Matches
adtf_a_util_result.h
Go to the documentation of this file.
1
7
#pragma once
8
9
#include <
a_util/result.h
>
10
#include <
adtf_utils.h
>
11
#include <functional>
12
13
namespace
adtf_util
14
{
15
16
inline
tResult
getConvertedResult(std::function<a_util::result::Result()> callExpression)
17
{
18
auto
res = callExpression();
19
if
(
static_cast<
bool
>
(res))
20
{
21
return
tResult
(ERR_NOERROR);
22
}
23
else
24
{
25
return
tResult
(res.getErrorCode(), res.getDescription(), res.getLine(), res.getFile(), res.getFunction());
26
}
27
}
28
}
// namespace adtf_util
29
30
#define TO_ADTF_RESULT(_expr_) adtf_util::getConvertedResult([&]() -> a_util::result::Result { return _expr_; })
31
32
namespace
adtf_util
33
{
34
35
inline
bool
operator==(
const
tResult
& oLeft,
const
a_util::result::Result& oRight)
36
{
37
return
oLeft.
GetErrorCode
().value == oRight.
getErrorCode
();
38
}
39
40
inline
bool
operator!=(
const
tResult
& oLeft,
const
a_util::result::Result& oRight)
41
{
42
return
oLeft.
GetErrorCode
().value != oRight.
getErrorCode
();
43
}
44
45
inline
bool
operator==(
const
a_util::result::Result& oLeft,
const
tResult
& oRight)
46
{
47
return
operator==(oRight, oLeft);
48
}
49
50
inline
bool
operator!=(
const
a_util::result::Result& oLeft,
const
tResult
& oRight)
51
{
52
return
operator!=(oRight, oLeft);
53
}
54
55
56
57
}
adtf_utils.h
tResult
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition
result.h:736
A_UTILS_NS::cResult::GetErrorCode
tErrorCode GetErrorCode() const noexcept
Get error code.
a_util::result::Result::getErrorCode
std::int32_t getErrorCode() const
Definition
result_type_impl.h:136
result.h
src
libraries
base
include
adtf_a_util_result.h
Copyright © CARIAD SE. All rights reserved | Generated on Thu Aug 6 2026 by doxygen 1.13.2 | GIT Commit Hash: 07d2f84367192978b2a55ca6aee7f968758b7220