Enrollment
28.2.0
Theme:
Default
Robot
Toggle main menu visibility
Loading...
Searching...
No Matches
ImageException.h
Go to the documentation of this file.
1
9
10
#pragma once
11
12
#include "
enrollment/Exception/EnrollmentException.h
"
13
#include "
enrollment/Exception/SourceLocation.h
"
14
#include <cstdint>
15
#include <sstream>
16
#include <string>
17
18
namespace
inno
19
{
23
*/
24
class
ImageException
:
public
EnrollmentRuntimeException
25
{
26
public
:
29
*/
30
enum
Reason
: uint8_t
31
{
36
UNKNOWN_IMAGE
,
40
DECODE_IMAGE
,
44
ENCODE_IMAGE
,
48
PROCESS_IMAGE
49
};
50
54
*/
55
[[nodiscard]]
Reason
GetReason
()
const
56
{
57
return
reason;
58
}
59
67
*/
68
explicit
ImageException
(
Reason
r,
SourceLocation
loc =
SourceLocation
())
69
:
EnrollmentRuntimeException
(Message(r), std::move(loc))
70
, reason(r)
71
{
72
}
73
79
*/
80
ImageException
(
Reason
r, std::string d,
SourceLocation
loc =
SourceLocation
())
81
:
EnrollmentRuntimeException
(std::move(d), std::move(loc))
82
, reason(r)
83
{
84
}
85
86
private
:
87
Reason reason;
88
89
[[nodiscard]]
static
std::string Message(Reason r)
90
{
91
switch
(r)
92
{
93
case
Reason::UNKNOWN_IMAGE:
94
return
"Not supported image type"
;
95
96
case
Reason::DECODE_IMAGE:
97
return
"Not possible to decode image"
;
98
99
case
Reason::ENCODE_IMAGE:
100
return
"Not possible to encode image"
;
101
102
case
Reason::PROCESS_IMAGE:
103
return
"Not possible to process image"
;
104
}
105
106
return
"Unknown reason"
;
107
}
108
};
109
110
}
// namespace inno
EnrollmentException.h
SourceLocation.h
EnrollmentRuntimeException
Base exception for all enrollment-sdk runtime exceptions.
Definition
EnrollmentException.h:84
ImageException::GetReason
Reason GetReason() const
ImageException reason.
Definition
ImageException.h:54
ImageException::ImageException
ImageException(Reason r, SourceLocation loc=SourceLocation())
Constructor creates exception with given reason and information about source location.
Definition
ImageException.h:67
ImageException::ImageException
ImageException(Reason r, std::string d, SourceLocation loc=SourceLocation())
Constructor creates exception with given reason and more specific message.
Definition
ImageException.h:79
ImageException::Reason
Reason
Contains all possible reasons of image exception.
Definition
ImageException.h:30
ImageException::ENCODE_IMAGE
@ ENCODE_IMAGE
Problem encode image to given format.
Definition
ImageException.h:43
ImageException::PROCESS_IMAGE
@ PROCESS_IMAGE
Problem to process an image.
Definition
ImageException.h:47
ImageException::DECODE_IMAGE
@ DECODE_IMAGE
Image type is supported but image format is corrupted.
Definition
ImageException.h:39
ImageException::UNKNOWN_IMAGE
@ UNKNOWN_IMAGE
Image type is not supported.
Definition
ImageException.h:35
SourceLocation
Class to capture the source location of an error or exception.
Definition
SourceLocation.h:25
Image
ImageException.h
Generated by
1.17.0