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

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
MultiError.h
1 #pragma once
2
3 #include "Result.h"
4
5 namespace fsdk
6 {
14 template<
15 typename E0,
16 typename E1>
17 struct MultiError {
18 using E0Type = E0;
19 using E1Type = E1;
20 E0 m_first;
21 E1 m_second;
22 };
23
27 template<
28 typename E0,
29 typename E1>
30 struct ErrorTraits<MultiError<E0, E1>> {
31 using ErrorType = MultiError<E0, E1>;
32 using E0Traits = ErrorTraits<typename ErrorType::E0Type>;
33 using E1Traits = ErrorTraits<typename ErrorType::E1Type>;
34
35 static bool isOk(ErrorType e) {
36 return E0Traits::isOk(e.m_first) && E1Traits::isOk(e.m_second);
37 }
38 static const char* toString(ErrorType e) {
39 if(!E0Traits::isOk(e.m_first))
40 return E0Traits::toString(e.m_first);
41 return E1Traits::toString(e.m_second);
42 }
43 };
44
45 template<
46 typename E0,
47 typename E1>
48 inline Result<MultiError<E0, E1>> makeMultiResult(E0 error0, E1 error1) {
49 return Result<MultiError<E0, E1>>({error0, error1});
50 }
51 }
fsdk::Result
A structure that encapsulates an action result enumeration.
Definition: Result.h:29
fsdk::MultiError
An error structure designed for functions which can return errors from different enum classes...
Definition: MultiError.h:17
fsdk::ErrorTraits
Definition: Result.h:9