4#ifndef AUBO_SDK_ERROR_STACK_H
5#define AUBO_SDK_ERROR_STACK_H
14#include <aubo/global_config.h>
25namespace error_stack {
27constexpr int ARCS_ABI_EXPORT
codeCompose(
int aa,
int bb,
int cccc)
29 return (
int)((aa * 1000000) + (bb * 10000) + cccc);
32constexpr int ARCS_ABI_EXPORT
mod(
int x)
41#define ARCS_ERROR_CODES \
44 SAFETY_INTERFACE_BOARD_ERRORS \
48 HARDWARE_INTERFACE_ERRORS \
49 _D(ARCS_MAX_ERROR_CODE, -1, "Max error code", "suggest...")
54#define _D(n, v, s, r) n = (int)v,
61#define _D(n, v, s, r) \
62 if (strcmp(#n, err_code_name) == 0) \
66 return ARCS_MAX_ERROR_CODE;
71 static const char *errcode_str[] = {
72#define _D(n, v, s, r) s,
79#define _D(n, v, s, r) n##_INDEX,
86#define _D(n, v, s, r) \
93 index = ARCS_MAX_ERROR_CODE_INDEX;
96 return errcode_str[(unsigned)index];
99inline std::ostream &
dump(std::ostream &os)
101#define _D(n, v, s, r) \
102 os << std::setw(20) << #n << "\t" << v << "\t" << s << "\t" << r \
int str2ErrorCode(const char *err_code_name)
std::ostream & dump(std::ostream &os)
constexpr int ARCS_ABI_EXPORT codeCompose(int aa, int bb, int cccc)
constexpr int ARCS_ABI_EXPORT mod(int x)
const char * errorCode2Str(int err_code)