25 #define THROW_IE_EXCEPTION throw InferenceEngine::details::InferenceEngineException(__FILE__, __LINE__) 32 #define IE_ASSERT(EXPRESSION) \ 34 throw InferenceEngine::details::InferenceEngineException(__FILE__, __LINE__) \ 35 << "AssertionFailed: " << #EXPRESSION // NOLINT 45 NullStream& operator<<(
const T&) noexcept {
49 NullStream& operator<<(std::ostream& (*)(std::ostream&)) noexcept {
54 #define IE_ASSERT(EXPRESSION) \ 55 assert((EXPRESSION)); \ 66 class INFERENCE_ENGINE_API_CLASS(InferenceEngineException):
public std::exception {
67 mutable std::string errorDesc;
71 std::shared_ptr<std::stringstream> exception_stream;
72 bool save_to_status_code =
false;
79 const char* what()
const noexcept
override {
80 if (errorDesc.empty() && exception_stream) {
81 errorDesc = exception_stream->str();
83 errorDesc +=
"\n" + _file +
":" + std::to_string(_line);
86 return errorDesc.c_str();
95 InferenceEngineException(
const std::string& filename,
const int line,
const std::string& message =
"") noexcept;
101 InferenceEngineException(
const InferenceEngineException& that) noexcept;
108 InferenceEngineException& operator<<(
const T& arg) {
109 if (save_to_status_code) {
110 auto can_convert = status_code_assign(arg);
111 save_to_status_code =
false;
112 if (can_convert.second) {
113 this->status_code = can_convert.first;
117 if (!exception_stream) {
118 exception_stream.reset(
new std::stringstream());
120 (*exception_stream) << arg;
128 friend InferenceEngineException& as_status(InferenceEngineException& iex) {
129 iex.save_to_status_code =
true;
137 InferenceEngineException& operator<<(InferenceEngineException& (*manip)(InferenceEngineException&)) {
142 bool hasStatus()
const {
143 return this->status_code == 0 ?
false :
true;
148 return this->status_code;
151 ~InferenceEngineException() noexcept
override;
154 std::pair<StatusCode, bool> status_code_assign(
const StatusCode& status) {
155 return {status,
true};
158 template <
typename T>
159 std::pair<StatusCode, bool> status_code_assign(
const T&) {
164 InferenceEngineException& as_status(InferenceEngineException& iex);
166 static_assert(std::is_nothrow_copy_constructible<InferenceEngineException>::value,
167 "InferenceEngineException must be nothrow copy constructible");
Inference Engine API.
Definition: ie_argmax_layer.hpp:15
StatusCode
This enum contains codes for all possible return values of the interface functions.
Definition: ie_common.h:224
The macro defines a symbol import/export mechanism essential for Microsoft Windows(R) OS...