gwnavruntime/base/types.h Source File
Go to the documentation of this file.
16 #if defined(KY_CONFIG_RELEASE)
17 # define KY_NO_LOG_OUTPUT
54 #define KyInt8MAXVAL 0x7F
55 #define KyInt8MINVAL 0x80
57 #define KyInt16MAXVAL 0x7FFF
58 #define KyInt16MINVAL 0x8000
60 #define KyInt32MAXVAL 0x7FFFFFFF
61 #define KyInt32MINVAL 0x80000000
63 #define KyInt64MAXVAL 0x7FFFFFFFFFFFFFFFLL
64 #define KyInt64MINVAL 0x8000000000000000LL
66 #define KyUInt8MAXVAL 0xFF
67 #define KyUInt16MAXVAL 0xFFFF
68 #define KyUInt32MAXVAL 0xFFFFFFFF
69 #define KyUInt64MAXVAL 0xFFFFFFFFFFFFFFFFULL
71 #define KyFloat32MAXVAL 3.402823466e+38f
75 #if defined(KY_CONFIG_DEV)
76 # define KY_PERF_MARKERS_ENABLED
88 # if defined (KY_CC_MSVC)
89 # define KY_DEPRECATED(expr) __declspec(deprecated) expr
90 # elif defined (KY_CC_GCC) || defined(KY_CC_CLANG)
91 # define KY_DEPRECATED(expr) expr __attribute__((deprecated))
93 # define KY_DEPRECATED(expr) expr
114 static bool Check(
Result result) {
return result == Success(); }
115 static bool Fail(
Result result) {
return result == Failure(); }
119 bool operator==(
Result r)
const {
return code == r.code; }
120 bool operator!=(
Result r)
const {
return code != r.code; }
121 operator bool()
const {
return code != 0; }
122 bool operator!()
const {
return code == 0; }
132 #define KY_ERROR KyResult::Error()
135 #define KY_SUCCESS KyResult::Success()
140 inline bool KY_FAILED(
KyResult result) {
return result == Kaim::Result::Error(); }
141 inline bool KY_SUCCEEDED(
KyResult result) {
return result == Kaim::Result::Success(); }
144 #define KY_TRY(expr) { KyResult result = (expr); if (result == Kaim::Result::Error()) { return result; }}
149 #if defined(KY_CC_MSVC)
150 # define KY_MACRO_START \
152 KY_PUSH_COMPILE_WARNING \
153 KY_PRAGMA_WARNING_DISABLE(4127)
154 # define KY_MACRO_END \
156 KY_POP_COMPILE_WARNING
158 # define KY_MACRO_START do {
159 # define KY_MACRO_END } while(0)
165 #if defined(KY_CC_MSVC)
166 # define KY_DISABLE_ALIGN_WARNING_START KY_PUSH_COMPILE_WARNING KY_PRAGMA_WARNING_DISABLE(4324) // structure was padded due to __declspec(align())
167 # define KY_DISABLE_ALIGN_WARNING_END KY_POP_COMPILE_WARNING
169 # define KY_DISABLE_ALIGN_WARNING_START
170 # define KY_DISABLE_ALIGN_WARNING_END
176 #if defined (KY_CC_MSVC)
177 # define KY_FORCE_ALIGNMENT(alignment, declaration) __declspec(align(alignment)) declaration
178 #elif defined (KY_CC_GCC) || defined (KY_CC_CLANG)
179 # define KY_FORCE_ALIGNMENT(alignment, declaration) declaration __attribute__((aligned(alignment)))
188 template<
typename T, KyUInt32 N>
196 #define KY_CLASS_WITHOUT_COPY(ClassName) \
198 ClassName(const ClassName& rhs); \
199 ClassName& operator=(const ClassName& rhs);
207 template <
typename F>
struct ScopeExit
209 explicit ScopeExit(
const F& func_) : func(func_), active(
true) {}
220 ScopeExit(ScopeExit<F>&);
221 ScopeExit& operator=(ScopeExit<F>&);
224 ScopeExit(ScopeExit<F>&& moved) : func(moved.func), active(moved.active) { moved.active =
false; }
226 ScopeExit& operator=(ScopeExit<F>&& moved)
229 active = moved.active;
230 moved.active =
false;
238 template <
typename F>
inline ScopeExit<F> MakeScopeExit(
const F& func) {
return ScopeExit<F>(func); }
242 #if defined(KY_CC_MSVC) && (KY_CC_MSVC <= 1800) // vc12 or previous
243 #define KY_RETURN_MOVE(x) std::move(x)
245 #define KY_RETURN_MOVE(x) x
std::uint64_t KyUInt64
uint64_t
Definition: types.h:30
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
std::uint16_t KyUInt16
uint16_t
Definition: types.h:28
std::int64_t KyInt64
int64_t
Definition: types.h:25
#define KY_DEPRECATED(expr)
The compiler issues a warning when a deprecated function or typedef is used.
Definition: types.h:93
Navigation return code class.
Definition: types.h:108
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
KyUInt32 ArraySize(T(&)[N])
Returns the size of a fixed-size array.
Definition: types.h:189
std::int32_t KyInt32
int32_t
Definition: types.h:24
std::int8_t KyInt8
int8_t
Definition: types.h:22
double KyFloat64
double
Definition: types.h:33
std::uint8_t KyUInt8
uint8_t
Definition: types.h:27
std::int16_t KyInt16
int16_t
Definition: types.h:23
float KyFloat32
float
Definition: types.h:32