1#ifndef GIMBAL_RESULT_HPP
2#define GIMBAL_RESULT_HPP
5#include "../core/gimbal_api_generators.hpp"
11 enum class Type: uint8_t {
19 constexpr Result(
bool success)
noexcept: Result(success? GBL_RESULT_SUCCESS : GBL_RESULT_ERROR) {}
21 constexpr Type getType(
void)
const noexcept {
22 if(isSuccess())
return Type::Success;
23 else if(isPartial())
return Type::Partial;
24 else if(isError())
return Type::Error;
25 else if(isUnknown())
return Type::Unknown;
30 constexpr bool isUnknown(
void)
const noexcept {
return GBL_RESULT_UNKNOWN(getCode()); }
31 constexpr bool isSuccess(
void)
const noexcept {
return GBL_RESULT_SUCCESS(getCode()); }
32 constexpr bool isPartial(
void)
const noexcept {
return GBL_RESULT_PARTIAL(getCode()); }
33 constexpr bool isError(
void)
const noexcept {
return GBL_RESULT_ERROR(getCode()); }
35 constexpr bool isType(Type type)
const noexcept {
return type == getType(); }
37 constexpr operator
bool()
const noexcept {
return isSuccess(); }
#define GBL_RESULT_UNAVAILABLE(value)
#define GBL_RESULT_PARTIAL(value)
#define GBL_RESULT_ERROR(value)
#define GBL_META_RESULT_TABLE
#define GBL_RESULT_SUCCESS(value)
#define GBL_RESULT_UNKNOWN(value)