| Face Engine SDK 5.32.0 A face detection, recognition and tracking engine.

MultiError.h
1 #pragma once
2
3 #include <fsdk/Types/Result.h>
4
5 namespace fsdk {
13 template <typename E0, typename E1>
14 struct MultiError {
15 using E0Type = E0;
16 using E1Type = E1;
17 E0 m_first;
18 E1 m_second;
19 };
20
24 template <typename E0, typename E1>
25 struct ErrorTraits<MultiError<E0, E1>> {
26 using ErrorType = MultiError<E0, E1>;
27 using E0Traits = ErrorTraits<typename ErrorType::E0Type>;
28 using E1Traits = ErrorTraits<typename ErrorType::E1Type>;
29
30 static bool isOk(ErrorType e) {
31 return E0Traits::isOk(e.m_first) && E1Traits::isOk(e.m_second);
32 }
33
34 static const char* toString(ErrorType e) {
35 if(!E0Traits::isOk(e.m_first))
36 return E0Traits::toString(e.m_first);
37 return E1Traits::toString(e.m_second);
38 }
39 };
40
41 template <typename E0, typename E1>
42 inline Result<MultiError<E0, E1>> makeMultiResult(E0 error0, E1 error1) {
43 return Result<MultiError<E0, E1>>({error0, error1});
44 }
45 } // namespace fsdk
fsdk
SDK namespace.
Definition: IAGSEstimator.h:8
fsdk::Result
A structure that encapsulates an action result enumeration.
Definition: Result.h:27
fsdk::MultiError
An error structure designed for functions which can return errors from different enum classes...
Definition: MultiError.h:14
fsdk::ErrorTraits
Definition: Result.h:8