2 #ifndef _NNDEPLOY_BASE_STATUS_H_
3 #define _NNDEPLOY_BASE_STATUS_H_
110 operator int()
const;
111 operator bool()
const;
128 template <
typename T>
132 : has_value_(true), value_(value), status_(status) {}
133 Maybe(
const Status &status) : has_value_(false), status_(status) {}
145 bool has_value_ =
false;
150 #define NNDEPLOY_ASSERT(x) \
154 NNDEPLOY_LOGE("Error: assert failed\n"); \
159 #undef NNDEPLOY_LOGDT
161 #define NNDEPLOY_LOGDT(fmt, tag, ...)
162 #define NNDEPLOY_LOGD(fmt, ...)
167 #define NNDEPLOY_RETURN_VALUE_ON_NEQ(status, expected, value, str) \
169 if (status != (expected)) { \
170 NNDEPLOY_LOGE("%s\n", str); \
175 #define NNDEPLOY_RETURN_VALUE_ON_EQ(status, expected, value, str) \
177 if (status == (expected)) { \
178 NNDEPLOY_LOGE("%s\n", str); \
183 #define NNDEPLOY_RETURN_ON_NEQ(status, expected, str) \
185 if (status != (expected)) { \
186 NNDEPLOY_LOGE("%s\n", str); \
191 #define NNDEPLOY_RETURN_ON_EQ(status, expected, str) \
193 if (status == (expected)) { \
194 NNDEPLOY_LOGE("%s\n", str); \
199 #define NNDEPLOY_CHECK_PARAM_NULL_RET_STATUS(param, str) \
202 NNDEPLOY_LOGE("%s\n", str); \
203 return nndeploy::base::kStatusCodeErrorNullParam; \
207 #define NNDEPLOY_CHECK_PARAM_NULL_RET_NULL(param, str) \
210 NNDEPLOY_LOGE("%s\n", str); \
Maybe(const Maybe &other)=default
Maybe(const Status &status)
Maybe & operator=(const Maybe &other)=default
Maybe(const T &value, const Status &status)
Status & operator=(Status &&other)
Status & operator=(const Status &other)
Status & operator=(const StatusCode &other)
bool operator!=(const StatusCode &other) const
Status(const Status &other)
bool operator==(const Status &other) const
StatusCode getStatusCode() const
bool operator!=(const Status &other) const
Status & operator=(int other)
bool operator==(int other) const
Status operator+(const Status &other)
bool operator!=(int other) const
bool operator==(const StatusCode &other) const
#define NNDEPLOY_CC_API
api
@ kStatusCodeErrorInferenceSnpe
@ kStatusCodeErrorInferenceTensorRt
@ kStatusCodeErrorInferenceLlamaCpp
@ kStatusCodeErrorInferencePaddleLite
@ kStatusCodeErrorDeviceCpu
@ kStatusCodeErrorOpAscendCL
@ kStatusCodeErrorDeviceMetal
@ kStatusCodeErrorInferenceOneDiff
@ kStatusCodeErrorInferenceLLM
@ kStatusCodeErrorUnknown
@ kStatusCodeErrorDeviceMtkNpu
@ kStatusCodeErrorInferenceTfLite
@ kStatusCodeErrorNullParam
@ kStatusCodeErrorInferenceNcnn
@ kStatusCodeErrorDeviceCuda
@ kStatusCodeErrorDeviceVulkan
@ kStatusCodeErrorInferenceMnn
@ kStatusCodeErrorInferenceRknn
@ kStatusCodeErrorInferenceTensorFlow
@ kStatusCodeErrorDeviceSyCL
@ kStatusCodeErrorInvalidParam
@ kStatusCodeErrorInferenceVllm
@ kStatusCodeErrorInferenceDiffusers
@ kStatusCodeErrorInferenceAscendCL
@ kStatusCodeErrorInferenceLmdeploy
@ kStatusCodeErrorInferenceTorch
@ kStatusCodeErrorInferenceTvm
@ kStatusCodeNodeInterrupt
@ kStatusCodeErrorDeviceHexagon
@ kStatusCodeErrorInferenceSophon
@ kStatusCodeErrorDeviceX86
@ kStatusCodeErrorDeviceRkNpu
@ kStatusCodeErrorInferenceDiff
@ kStatusCodeErrorInferenceTnn
@ kStatusCodeErrorInferenceOther
@ kStatusCodeErrorInferenceOnnxRuntime
@ kStatusCodeErrorDeviceRocm
@ kStatusCodeErrorDeviceOpenGL
@ kStatusCodeErrorNotSupport
@ kStatusCodeErrorDeviceArm
@ kStatusCodeErrorInferenceXDit
@ kStatusCodeErrorInferenceQnn
@ kStatusCodeErrorDeviceRiscV
@ kStatusCodeErrorInferenceDefault
@ kStatusCodeErrorInferenceAITemplate
@ kStatusCodeErrorDeviceAscendCL
@ kStatusCodeErrorDeviceSophonNpu
@ kStatusCodeErrorDeviceQualcommNpu
@ kStatusCodeErrorDeviceMtkVpu
@ kStatusCodeErrorInferenceSGLang
@ kStatusCodeErrorDeviceOpenCL
@ kStatusCodeErrorInferenceNeuroPilot
@ kStatusCodeErrorInvalidValue
@ kStatusCodeErrorNotImplement
@ kStatusCodeErrorOutOfMemory
@ kStatusCodeErrorDeviceAppleNpu
@ kStatusCodeErrorInferenceCoreML
@ kStatusCodeErrorInferenceOpenVino
@ kStatusCodeErrorThreadPool
std::string statusCodeToString(StatusCode code)