Mech-DLK SDK (C++) 3.0.0
Mech-DLK SDK (C++) Reference Documentation
 
Loading...
Searching...
No Matches
status.h
Go to the documentation of this file.
1
2#pragma once
3
4#include "macro.h"
5#include <string>
6
7namespace mmind {
8namespace base {
9
65
72
74{
75public:
77 Status(uint32_t code);
80
81 Status(const Status& other);
82 Status& operator=(const Status& other);
83 Status& operator=(const StatusCode& other);
84 Status& operator=(uint32_t other);
85
86 Status(Status&& other);
88
89 bool operator==(const Status& other) const;
90 bool operator==(const StatusCode& other) const;
91 bool operator==(uint32_t other) const;
92
93 bool operator!=(const Status& other) const;
94 bool operator!=(const StatusCode& other) const;
95 bool operator!=(uint32_t other) const;
96
97 operator uint32_t() const;
98 operator bool() const;
99
100 std::string desc() const;
101
103
104 Status operator+(const Status& other);
105
106 bool isError() const;
107 bool isWarning() const;
108 bool isOk() const;
109
110private:
111 uint32_t code_ = kStatusCodeOk;
112};
113
114#define NNDEPLOY_RETURN_ON_NEQ(status, expected, str) \
115 do { \
116 if (status != (expected)) { \
117 DL_LOG_ERROR("{}\n", str); \
118 return status; \
119 } \
120 } while (0)
121
122#define NNDEPLOY_RETURN_ON_EQ(status, expected, str) \
123 do { \
124 if (status == (expected)) { \
125 DL_LOG_ERROR("{}\n", str); \
126 return status; \
127 } \
128 } while (0)
129
130#define NNDEPLOY_CHECK_PARAM_NULL_RET_NULL(param, str) \
131 do { \
132 if (!param) { \
133 DL_LOG_ERROR("{}\n", str); \
134 return nullptr; \
135 } \
136 } while (0)
137} // namespace base
138} // namespace mmind
139
std::string desc() const
bool isError() const
bool isOk() const
Status operator+(const Status &other)
bool operator!=(uint32_t other) const
Status(StatusCode code)
bool operator==(const Status &other) const
Status(Status &&other)
Status & operator=(Status &&other)
Status & operator=(uint32_t other)
bool operator==(uint32_t other) const
Status(uint32_t code)
bool isWarning() const
Status & operator=(const StatusCode &other)
StatusCode getStatusCode() const
bool operator==(const StatusCode &other) const
Status(const Status &other)
Status & operator=(const Status &other)
bool operator!=(const StatusCode &other) const
bool operator!=(const Status &other) const
#define MMIND_DL_SDK_CC_API
Definition macro.h:21
std::string statusCodeToString(const StatusCode statusCode)
Converts the status code to the corresponding string.
@ kStatusCodeAuthorityTypeError
Definition status.h:55
@ kStatusCodeOk
Definition status.h:11
@ kStatusCodeUnsupportedModelPackVersion
Definition status.h:52
@ kStatusCodeWarning
Definition status.h:14
@ kStatusCodeModelLoading
Definition status.h:25
@ kStatusCodeModelPackUnzipFailed
Definition status.h:50
@ kStatusCodeUnsupportedModelType
Definition status.h:51
@ kStatusCodeThreadPoolError
Definition status.h:20
@ kStatusCodeModelNotLoaded
Definition status.h:30
@ kStatusCodeDeserializeError
Definition status.h:23
@ kStatusCodeNodeInvalidInput
Definition status.h:37
@ kStatusCodeEngineInvalidInput
Definition status.h:36
@ kStatusCodeParseResultError
Definition status.h:60
@ kStatusCodeModelFileNotExist
Definition status.h:28
@ kStatusCodeAlgorithmAuthorityError
Definition status.h:56
@ kStatusCodeModelNotConverted
Definition status.h:24
@ kStatusCodeModelReload
Definition status.h:27
@ kStatusCodeUnsupportedValueType
Definition status.h:38
@ kStatusCodeModelConvertFailed
Definition status.h:29
@ kStatusCodeEngineEmptyInput
Definition status.h:34
@ kStatusCodeInvalidValue
Definition status.h:17
@ kStatusCodeModelPackAccessError
Definition status.h:49
@ kStatusCodeExceedsModuleLimit
Definition status.h:57
@ kStatusCodeNodeEmptyInput
Definition status.h:63
@ kStatusCodeModelLoadFailed
Definition status.h:26
@ kStatusCodeInvalidFilePath
Definition status.h:47
@ kStatusCodeIOError
Definition status.h:19
@ kStatusCodeError
Definition status.h:13
@ kStatusCodeEngineNotInited
Definition status.h:33
@ kStatusCodeLoadPluginFailed
Definition status.h:41
@ kStatusCodeModuleEmptyInput
Definition status.h:62
@ kStatusCodeInvalidParam
Definition status.h:18
@ kStatusCodeModelPackMd5Error
Definition status.h:48
@ kStatusCodeNullParam
Definition status.h:16
@ kStatusCodeModuleGraphNotInited
Definition status.h:42
@ kStatusCodeModuleInvalidInput
Definition status.h:35
@ kStatusCodeUnsupportedBackendType
Definition status.h:43
@ kStatuscodeExecutionError
Definition status.h:44
Definition MBbox.h:7
mmind::base::StatusCode StatusCode
Definition status.h:140