10 #ifndef K_API_API_DEF_H
11 #define K_API_API_DEF_H
16 #define kDlCall xkDlCall
19 # define kFx(TYPE) kExportFx(TYPE)
20 # define kDx(TYPE) kExportDx(TYPE)
21 #elif defined (K_STATIC)
22 # define kFx(TYPE) kInFx(TYPE)
23 # define kDx(TYPE) kInDx(TYPE)
25 # define kFx(TYPE) kImportFx(TYPE)
26 # define kDx(TYPE) kImportDx(TYPE)
29 #define kInlineFx(TYPE) xkInlineFx(TYPE)
45 #define k8U_MAX (255U)
46 #define k8U_NULL (k8U_MAX)
61 #define k16U_MAX (65535U)
62 #define k16U_NULL (k16U_MAX)
77 #define k32U_MAX (4294967295U)
78 #define k32U_NULL (k32U_MAX)
92 #define k64U(CONST) xk64U(CONST)
93 #define k64U_MIN k64U(0)
94 #define k64U_MAX k64U(18446744073709551615)
95 #define k64U_NULL (k64U_MAX)
98 #define kINFINITE k64U_MAX
111 #define k8S_MAX (127)
112 #define k8S_MIN (-k8S_MAX -1)
113 #define k8S_NULL (k8S_MIN)
127 #define k16S_MAX (32767)
128 #define k16S_MIN (-k16S_MAX -1)
129 #define k16S_NULL (k16S_MIN)
143 #define k32S_MAX (2147483647)
144 #define k32S_MIN (-k32S_MAX -1)
145 #define k32S_NULL (k32S_MIN)
159 #define k64S(CONST) xk64S(CONST)
160 #define k64S_MAX k64S(9223372036854775807)
161 #define k64S_MIN (-k64S_MAX -1)
162 #define k64S_NULL (k64S_MIN)
191 #define k32F_MIN (1.175494351e-38F)
192 #define k32F_MAX (3.402823466e+38F)
193 #define k32F_NULL (-k32F_MAX)
194 #define k32F_DIGITS (9)
204 kInlineFx(kBool) k32f_IsNull(k32f value)
220 #define k64F_MIN (2.2250738585072014e-308)
221 #define k64F_MAX (1.7976931348623157e+308)
222 #define k64F_NULL (-k64F_MAX)
223 #define k64F_DIGITS (17)
234 kFx(k32s) k64f_IsNanOrInf(k64f value);
256 typedef xkByte
kByte;
266 typedef xkSize
kSize;
269 #define kSIZE_MAX xkSIZE_MAX
270 #define kSIZE_NULL kSIZE_MAX
283 kInlineFx(kSize) kSize_Align(kSize value, kSize to)
285 return ((value >> to) + !!(value & ((1 << to) - 1))) << to;
297 #define kSSIZE_MIN xkSSIZE_MIN
298 #define kSSIZE_MAX xkSSIZE_MAX
299 #define kSSIZE_NULL kSSIZE_MIN
309 typedef void* kPointer;
324 return (
kByte*)pointer + offset;
362 #define kPointer_ReadAs(POINTER, TYPE) \
373 #define kPointer_WriteAs(POINTER, VALUE, TYPE) \
374 (*(TYPE*)(POINTER) = (TYPE)(VALUE))
383 #define kIsNull(POINTER) \
394 typedef xkChar
kChar;
405 return (ch >=
'A' && ch <=
'Z') ? (ch -
'A' +
'a') : ch;
417 return (ch >=
'a' && ch <=
'z') ? (ch -
'a' +
'A') : ch;
441 return ((ch >=
'a') && (ch <=
'z') ) || ((ch >=
'A') && (ch <=
'Z'));
453 return ch >=
'0' && ch <=
'9';
517 #define kERROR_STATE (-1000)
518 #define kERROR_NOT_FOUND (-999)
519 #define kERROR_COMMAND (-998)
520 #define kERROR_PARAMETER (-997)
521 #define kERROR_UNIMPLEMENTED (-996)
522 #define kERROR_MEMORY (-994)
523 #define kERROR_TIMEOUT (-993)
524 #define kERROR_INCOMPLETE (-992)
525 #define kERROR_STREAM (-991)
526 #define kERROR_CLOSED (-990)
527 #define kERROR_VERSION (-989)
528 #define kERROR_ABORT (-988)
529 #define kERROR_ALREADY_EXISTS (-987)
530 #define kERROR_NETWORK (-986)
531 #define kERROR_HEAP (-985)
532 #define kERROR_FORMAT (-984)
533 #define kERROR_READ_ONLY (-983)
534 #define kERROR_WRITE_ONLY (-982)
535 #define kERROR_BUSY (-981)
536 #define kERROR_CONFLICT (-980)
537 #define kERROR_OS (-979)
538 #define kERROR_DEVICE (-978)
539 #define kERROR_FULL (-977)
540 #define kERROR_IN_PROGRESS (-976)
541 #define kERROR_OVERHEAT (-975)
555 kFx(const kChar*) kStatus_Name(kStatus status);
566 return status !=
kOK;
578 return status ==
kOK;
589 #define kCheck(EXPRESSION) \
601 #define kCheckTrue(EXPRESSION, STATUS) \
602 xkCheckTrue(EXPRESSION, STATUS)
612 #define kCheckArgs(EXPRESSION) \
613 xkCheckArgs(EXPRESSION)
623 #define kCheckState(EXPRESSION) \
624 xkCheckState(EXPRESSION)
640 #define kThrow(EXPRESSION) \
652 #define kTest(EXPRESSION) \
665 #define kTestTrue(EXPRESSION, STATUS) \
666 xkTestTrue(EXPRESSION, STATUS)
677 #define kTestArgs(EXPRESSION) \
678 xkTestArgs(EXPRESSION)
689 #define kTestState(EXPRESSION) \
690 xkTestState(EXPRESSION)
698 #define kCatch(STATUS_POINTER) \
699 xkCatch(STATUS_POINTER)
709 #define kEndCatch(STATUS) \
728 #define kEndFinally() \
737 #define kCatchEx(STATUS_POINTER) \
738 xkCatchEx(STATUS_POINTER)
750 #define kEndCatchEx(STATUS) \
769 #define kEndFinallyEx() \
779 #define kAssert(EXPRESSION) \
792 #define kAssertType(OBJECT, SYMBOL) \
793 xkAssertType(OBJECT, SYMBOL)
805 #define kVERSION_NULL (k32U_NULL) // kVersion invalid value.
819 return (major & 0xFF) << 24 |
820 (minor & 0xFF) << 16 |
821 (release & 0xFF) << 8 |
835 #define kVersion_Stringify_(MAJOR, MINOR, RELEASE, BUILD) \
836 xkStringize(MAJOR) "." xkStringize(MINOR) "." xkStringize(RELEASE) "." xkStringize(BUILD)
872 return (
k32s)version1 - (
k32s)version2;
884 return (version >> 24) & 0xFF;
896 return (version >> 16) & 0xFF;
908 return (version >> 8) & 0xFF;
920 return (version) & 0xFF;
932 #define kENDIANNESS_LITTLE (1)
933 #define kENDIANNESS_BIG (2)
941 kInlineFx(kEndianness) kEndianness_Host()
1360 #define kPoint_Init_(POINT, X, Y) xkPoint_Init_(POINT, X, Y)
1432 #define kPoint3d_Init_(POINT, X, Y, Z) xkPoint3d_Init_(POINT, X, Y, Z)
1461 #define kPoint4d_Init_(POINT, X, Y, Z, W) xkPoint4d_Init_(POINT, X, Y, Z, W)
1554 #define kRect_Init_(RECT, X, Y, W, H) \
1555 xkRect_Init_(RECT, X, Y, W, H)
1586 #define kRect3d_Init_(RECT, X, Y, Z, W, H, D) \
1587 xkRect3d_Init_(RECT, X, Y, Z, W, H, D)
1635 #define kRotatedRect_Init_(RECT, XC, YC, W, H, A) \
1636 xkRotatedRect_Init_(RECT, XC, YC, W, H, A)
1649 #define kCFA_NONE (0)
1650 #define kCFA_BAYER_BGGR (1)
1651 #define kCFA_BAYER_GBRG (2)
1652 #define kCFA_BAYER_RGGB (3)
1653 #define kCFA_BAYER_GRBG (4)
1681 #define kRgb_Init_(RGB, R, G, B) \
1682 xkRgb_Init_(RGB, R, G, B)
1710 #define kArgb_Init_(ARGB, A, R, G, B) \
1711 xkArgb_Init_(ARGB, A, R, G, B)
1737 #define kRgb24_Init_(RGB24, R, G, B) \
1738 xkRgb24_Init_(RGB24, R, G, B)
1760 #define kMEMORY_ALIGNMENT_8 (3)
1761 #define kMEMORY_ALIGNMENT_16 (4)
1762 #define kMEMORY_ALIGNMENT_32 (5)
1763 #define kMEMORY_ALIGNMENT_64 (6)
1764 #define kMEMORY_ALIGNMENT_128 (7)
1765 #define kMEMORY_ALIGNMENT_256 (8)
1766 #define kMEMORY_ALIGNMENT_512 (9)
1767 #define kMEMORY_ALIGNMENT_1024 (10)
1768 #define kMEMORY_ALIGNMENT_2048 (11)
1769 #define kMEMORY_ALIGNMENT_4096 (12)
1778 kInlineFx(kSize) kMemoryAlignment_Size(kMemoryAlignment alignment)
1816 #define kCOMPARISON_EQ (0)
1817 #define kCOMPARISON_NEQ (1)
1818 #define kCOMPARISON_LT (2)
1819 #define kCOMPARISON_LTE (3)
1820 #define kCOMPARISON_GT (4)
1821 #define kCOMPARISON_GTE (5)
1871 #define kFILE_MODE_READ (0x1)
1872 #define kFILE_MODE_WRITE (0x2)
1873 #define kFILE_MODE_UPDATE (0x4)
1882 typedef k32s kSeekOrigin;
1885 #define kSEEK_ORIGIN_BEGIN (0)
1886 #define kSEEK_ORIGIN_CURRENT (1)
1887 #define kSEEK_ORIGIN_END (2)
1896 typedef k32s kCompressionType;
1899 #define kCOMPRESSION_TYPE_NULL (0)
1900 #define kCOMPRESSION_TYPE_ZSTD (1)
1913 #define kCOMPRESSION_PRESET_MIN (-1)
1914 #define kCOMPRESSION_PRESET_FAST (-2)
1915 #define kCOMPRESSION_PRESET_DEFAULT (-3)
1916 #define kCOMPRESSION_PRESET_DENSE (-4)
1917 #define kCOMPRESSION_PRESET_MAX (-5)
1929 typedef k64u kLogOption;
1932 #define kLOG_OPTION_WARNING (0x1)
1933 #define kLOG_OPTION_ERROR (0x2)
1934 #define kLOG_OPTION_TRACE (0x4)
1935 #define kLOG_OPTION_DEBUG (0x8)
1936 #define kLOG_OPTION_PLATFORM (0x10)
1947 #define kCountOf(CARRAY) \
1948 (sizeof(CARRAY)/sizeof(CARRAY[0]))
1959 #define kCast(TYPE, ITEM) \
1962 #if (K_CPP_VERSION >= K_CPP_VERSION_2011)
1973 template <
typename T>
1974 static kInline
typename std::enable_if<std::is_unsigned<T>::value, T>::type
kAbs(
const T& v)
1988 template <
typename T>
1989 static kInline
typename std::enable_if<!std::is_unsigned<T>::value, T>::type
kAbs(
const T& v)
1991 return (v >= T()) ? v : -v;
2003 template <
typename T>
2004 static kInline
typename std::enable_if<std::is_unsigned<T>::value, T>::type
kSign(
const T& v)
2018 template <
typename T>
2019 static kInline
typename std::enable_if<!std::is_unsigned<T>::value, T>::type
kSign(
const T& v)
2021 return (v > T()) - (v < T());
2034 template <
typename T>
2037 return (a < b) ? a : b;
2050 template <
typename T>
2053 return (a > b) ? a : b;
2067 template <
typename T>
2083 template <
typename T>
2084 static kInline
typename std::enable_if<std::is_unsigned<T>::value, T>::type
kDivideFloor(
const T& a,
const T& b)
2099 template <
typename T>
2100 static kInline
typename std::enable_if<!std::is_unsigned<T>::value, T>::type
kDivideFloor(
const T& a,
const T& b)
2102 return ((
kSign(a) *
kSign(b)) >= T()) ? a / b : ((a / b) - ((a % b) != T()));
2115 template <
typename T>
2116 static kInline
typename std::enable_if<std::is_unsigned<T>::value, T>::type
kDivideCeil(
const T& a,
const T& b)
2118 return (a / b) + ((a % b) != T());
2131 template <
typename T>
2132 static kInline
typename std::enable_if<!std::is_unsigned<T>::value, T>::type
kDivideCeil(
const T& a,
const T& b)
2134 return ((
kSign(a) *
kSign(b)) <= T()) ? a / b : ((a / b) + ((a % b) != T()));
2147 template <
typename T>
2163 template <
typename T>
2166 return kDivideCeil(value, granularity) * granularity;
2185 template <
typename T>
2188 typedef typename std::make_unsigned<T>::type U;
2189 U relativeValue = (value >= min) ? (U) (value - min) : U();
2190 U relativeMax = (max >= min) ? (U) (max - min) : U();
2191 U quantizedRelativeMax = kQuantizeFloor<U>(relativeMax, granularity);
2192 U limitedRelativeValue = kMin<U>(relativeValue, quantizedRelativeMax);
2194 return (T) kQuantizeFloor<U>(limitedRelativeValue, granularity) + min;
2213 template <
typename T>
2216 typedef typename std::make_unsigned<T>::type U;
2217 U relativeValue = (value >= min) ? (U) (value - min) : U();
2218 U relativeMax = (max >= min) ? (U) (max - min) : U();
2219 U quantizedRelativeMax = kQuantizeFloor<U>(relativeMax, granularity);
2220 U limitedRelativeValue = kMin<U>(relativeValue, quantizedRelativeMax);
2222 return (T) kQuantizeCeil<U>(limitedRelativeValue, granularity) + min;
2232 #define kZero(VALUE) \
2233 memset(&VALUE, 0, sizeof(VALUE))
2251 memcpy(dest, src, size);
2269 memset(dest, 0, size);
2280 #define kALLOC_TRAIT_FOREIGN (0x00000001)
2281 #define kALLOC_TRAIT_SERIAL (0x00000002)
2282 #define kALLOC_TRAIT_NON_ATOMIC (0x00000004)
2283 #define kALLOC_TRAIT_CONTEXT (0x00000008)
2284 #define kALLOC_TRAIT_CUDA_PINNED (0x00010000)
2285 #define kALLOC_TRAIT_CUDA_MANAGED (0x00020000)
2286 #define kALLOC_TRAIT_CUDA_DEVICE (0x01000000)
2296 kInlineFx(kBool) kAllocTrait_IsForeign(kAllocTrait traits)
2414 #define kTHREAD_PRIORITY_CLASS_LOW (-1)
2415 #define kTHREAD_PRIORITY_CLASS_NORMAL (0)
2416 #define kTHREAD_PRIORITY_CLASS_HIGH (1)
2424 typedef kObject
kType;
2428 #define kTypeName kText64
2437 typedef k32u kTypeFlags;
2440 #define kTYPE_FLAGS_CLASS (0x01)
2441 #define kTYPE_FLAGS_INTERFACE (0x02)
2442 #define kTYPE_FLAGS_VALUE (0x04)
2443 #define kTYPE_FLAGS_ENUM (0x08)
2444 #define kTYPE_FLAGS_ABSTRACT (0x20)
2445 #define kTYPE_FLAGS_ARRAY_VALUE (0x40)
2446 #define kTYPE_FLAGS_PRIMITIVE (0x80)
2455 typedef kPointer kTypeVersion;
2522 #define kTypeOf(SYMBOL) \
2550 #define kAssemblyOf(SYMBOL) \
2551 xkAssemblyOf(SYMBOL)
2561 #define kStaticOf(SYMBOL) \
2571 #define kDeprecate(SYMBOL) \
2572 xkDeprecate(#SYMBOL)
2582 #define kWarn(MESSAGE) \
2601 #define kDeclareAssembly(PREFIX, SYMBOL) \
2602 xkDeclareAssembly(PREFIX, SYMBOL)
2613 #define kBeginAssembly(PREFIX, SYMBOL, VERSION, PLATFORM_VERSION) \
2614 xkBeginAssembly(PREFIX, SYMBOL, VERSION, PLATFORM_VERSION)
2621 #define kEndAssembly() \
2632 #define kDeclareValue(PREFIX, SYMBOL, BASE) \
2633 xkDeclareValue(PREFIX, SYMBOL, BASE)
2643 #define kBeginValue(PREFIX, SYMBOL, BASE) \
2644 xkBeginValue(PREFIX, SYMBOL, BASE)
2651 #define kEndValue() \
2662 #define kDeclareEnum(PREFIX, SYMBOL, BASE) \
2663 xkDeclareEnum(PREFIX, SYMBOL, BASE)
2673 #define kBeginEnum(PREFIX, SYMBOL, BASE) \
2674 xkBeginEnum(PREFIX, SYMBOL, BASE)
2681 #define kEndEnum() \
2692 #define kDeclareArrayValue(PREFIX, SYMBOL, BASE) \
2693 xkDeclareArrayValue(PREFIX, SYMBOL, BASE)
2704 #define kBeginArrayValue(PREFIX, SYMBOL, TYPE, BASE) \
2705 xkBeginArrayValue(PREFIX, SYMBOL, TYPE, BASE)
2712 #define kEndArrayValue() \
2723 #define kDeclareInterface(PREFIX, SYMBOL, BASE) \
2724 xkDeclareInterface(PREFIX, SYMBOL, BASE)
2734 #define kBeginInterface(PREFIX, SYMBOL, BASE) \
2735 xkBeginInterface(PREFIX, SYMBOL, BASE)
2742 #define kEndInterface() \
2753 #define kDeclareFullClass(PREFIX, SYMBOL, BASE) \
2754 xkDeclareFullClass(PREFIX, SYMBOL, BASE)
2764 #define kBeginFullClass(PREFIX, SYMBOL, BASE) \
2765 xkBeginFullClass(PREFIX, SYMBOL, BASE)
2772 #define kEndFullClass() \
2783 #define kDeclareVirtualClass(PREFIX, SYMBOL, BASE) \
2784 xkDeclareVirtualClass(PREFIX, SYMBOL, BASE)
2794 #define kBeginVirtualClass(PREFIX, SYMBOL, BASE) \
2795 xkBeginVirtualClass(PREFIX, SYMBOL, BASE)
2802 #define kEndVirtualClass() \
2812 #define kDeclareStaticClass(PREFIX, SYMBOL) \
2813 xkDeclareStaticClass(PREFIX, SYMBOL)
2822 #define kBeginStaticClass(PREFIX, SYMBOL) \
2823 xkBeginStaticClass(PREFIX, SYMBOL)
2830 #define kEndStaticClass() \
2841 #define kDeclareClass(PREFIX, SYMBOL, BASE) \
2842 xkDeclareClass(PREFIX, SYMBOL, BASE)
2852 #define kBeginClass(PREFIX, SYMBOL, BASE) \
2853 xkBeginClass(PREFIX, SYMBOL, BASE)
2860 #define kEndClass() \
2880 #define kDeclareAssemblyEx(PREFIX, SYMBOL) \
2881 xkDeclareAssemblyEx(PREFIX, SYMBOL)
2892 #define kBeginAssemblyEx(PREFIX, SYMBOL, VERSION, PLATFORM_VERSION) \
2893 xkBeginAssemblyEx(PREFIX, SYMBOL, VERSION, PLATFORM_VERSION)
2900 #define kEndAssemblyEx() \
2911 #define kDeclareValueEx(PREFIX, SYMBOL, BASE) \
2912 xkDeclareValueEx(PREFIX, SYMBOL, BASE)
2921 #define kBeginValueEx(PREFIX, SYMBOL) \
2922 xkBeginValueEx(PREFIX, SYMBOL)
2929 #define kEndValueEx() \
2940 #define kDeclareEnumEx(PREFIX, SYMBOL, BASE) \
2941 xkDeclareEnumEx(PREFIX, SYMBOL, BASE)
2950 #define kBeginEnumEx(PREFIX, SYMBOL) \
2951 xkBeginEnumEx(PREFIX, SYMBOL)
2958 #define kEndEnumEx() \
2969 #define kDeclareArrayValueEx(PREFIX, SYMBOL, BASE) \
2970 xkDeclareArrayValueEx(PREFIX, SYMBOL, BASE)
2980 #define kBeginArrayValueEx(PREFIX, SYMBOL, TYPE) \
2981 xkBeginArrayValueEx(PREFIX, SYMBOL, TYPE)
2988 #define kEndArrayValueEx() \
2999 #define kDeclareInterfaceEx(PREFIX, SYMBOL, BASE) \
3000 xkDeclareInterfaceEx(PREFIX, SYMBOL, BASE)
3009 #define kBeginInterfaceEx(PREFIX, SYMBOL) \
3010 xkBeginInterfaceEx(PREFIX, SYMBOL)
3017 #define kEndInterfaceEx() \
3028 #define kDeclareFullClassEx(PREFIX, SYMBOL, BASE) \
3029 xkDeclareFullClassEx(PREFIX, SYMBOL, BASE)
3038 #define kBeginFullClassEx(PREFIX, SYMBOL) \
3039 xkBeginFullClassEx(PREFIX, SYMBOL)
3046 #define kEndFullClassEx() \
3057 #define kDeclareVirtualClassEx(PREFIX, SYMBOL, BASE) \
3058 xkDeclareVirtualClassEx(PREFIX, SYMBOL, BASE)
3067 #define kBeginVirtualClassEx(PREFIX, SYMBOL) \
3068 xkBeginVirtualClassEx(PREFIX, SYMBOL)
3075 #define kEndVirtualClassEx() \
3076 xkEndVirtualClassEx()
3085 #define kDeclareStaticClassEx(PREFIX, SYMBOL) \
3086 xkDeclareStaticClassEx(PREFIX, SYMBOL)
3095 #define kBeginStaticClassEx(PREFIX, SYMBOL) \
3096 xkBeginStaticClassEx(PREFIX, SYMBOL)
3103 #define kEndStaticClassEx() \
3104 xkEndStaticClassEx()
3114 #define kDeclareClassEx(PREFIX, SYMBOL, BASE) \
3115 xkDeclareClassEx(PREFIX, SYMBOL, BASE)
3124 #define kBeginClassEx(PREFIX, SYMBOL) \
3125 xkBeginClassEx(PREFIX, SYMBOL)
3132 #define kEndClassEx() \
3150 #define kAddDependency(SYMBOL) \
3151 xkAddDependency(SYMBOL)
3159 #define kAddType(SYMBOL) \
3172 #define kAddPriority(SYMBOL) \
3173 xkAddPriority(SYMBOL)
3183 #define kAddStatic(SYMBOL) \
3193 #define kAddInterface(SYMBOL, IFACE) \
3194 xkAddInterface(SYMBOL, IFACE)
3214 #define kAddFrameworkConstructor(SYMBOL, CTOR) \
3215 xkAddFrameworkConstructor(SYMBOL, CTOR)
3235 #define kAddPrivateFrameworkConstructor(SYMBOL, CTOR) \
3236 xkAddPrivateFrameworkConstructor(SYMBOL, CTOR)
3245 #define kAddMethod(SYMBOL, METHOD) \
3246 xkAddMethod(SYMBOL, METHOD)
3256 #define kAddVMethod(IN_TYPE, FROM_TYPE, METHOD) \
3257 xkAddVMethod(IN_TYPE, FROM_TYPE, METHOD)
3269 #define kAddPrivateVMethod(IN_TYPE, FROM_TYPE, METHOD) \
3270 xkAddPrivateVMethod(IN_TYPE, FROM_TYPE, METHOD)
3281 #define kAddIVMethod(IN_TYPE, FROM_IFACE, IMETHOD, CMETHOD) \
3282 xkAddIVMethod(IN_TYPE, FROM_IFACE, IMETHOD, CMETHOD)
3295 #define kAddPrivateIVMethod(IN_TYPE, FROM_IFACE, IMETHOD, CMETHOD) \
3296 xkAddPrivateIVMethod(IN_TYPE, FROM_IFACE, IMETHOD, CMETHOD)
3306 #define kAddField(VALUE, FIELD_TYPE, FIELD) \
3307 xkAddField(VALUE, FIELD_TYPE, FIELD)
3316 #define kAddEnumerator \
3337 #define kAddVersionEx(TYPE, FORMAT, FORMAT_VER, GUID, WRITE_METHOD, READ_METHOD) \
3338 xkAddVersionEx(TYPE, FORMAT, FORMAT_VER, GUID, WRITE_METHOD, READ_METHOD)
3360 #define kAddPrivateVersionEx(TYPE, FORMAT, FORMAT_VER, GUID, WRITE_METHOD, READ_METHOD) \
3361 xkAddPrivateVersionEx(TYPE, FORMAT, FORMAT_VER, GUID, WRITE_METHOD, READ_METHOD)
3376 #define kAddAbstractVersionEx(TYPE, FORMAT, FORMAT_VER, GUID) \
3377 xkAddAbstractVersion(TYPE, FORMAT, FORMAT_VER, GUID)
3386 #define kAddFlags(TYPE, FLAGS) \
3387 xkAddFlags(TYPE, FLAGS)
3410 #define kDefineDebugHints() \
3411 xkDefineDebugHints()
3427 #define kObj(TypeName_T, T_object) \
3428 TypeName_T##Class* obj K_ATTRIBUTE_UNUSED = xx##TypeName_T##_Cast(T_object, __FILE__, __LINE__)
3439 #define kObjR(TypeName_T, T_object) \
3440 TypeName_T##Class* obj K_ATTRIBUTE_UNUSED = x##TypeName_T##_CastRaw(T_object)
3453 #define kObjN(TypeName_T, VarName_obj, T_object) \
3454 TypeName_T##Class* VarName_obj = xx##TypeName_T##_Cast(T_object, __FILE__, __LINE__)
3466 #define kObjNR(TypeName_T, VarName_obj, T_object) \
3467 TypeName_T##Class* VarName_obj = x##TypeName_T##_CastRaw(T_object)
3474 #define kStaticObj(TypeName_T) \
3475 TypeName_T##Static* sobj = kStaticOf(TypeName_T)
3487 #define kCastClass_(TYPE, OBJECT) \
3488 xkCastClass_(TYPE, OBJECT)
3500 #define kCastVTable_(TYPE, OBJECT) \
3501 xkCastVTable_(TYPE, OBJECT)
3513 #define kCastIVTable_(IFACE, OBJECT) \
3514 xkCastIVTable_(IFACE, OBJECT)
3521 #define kDebugBreak() \
3524 #include <kApi/kApiDef.x.h>
k32f y
Y-coordinate value.
Definition: kApiDef.h:1334
kStatus k32s_Parse(k32s *value, const kChar *str)
Converts string to k32s value.
k64f height
Height of the rectangular cuboid.
Definition: kApiDef.h:1571
Represents a 64-unit, null-terminated, kChar sequence.
#define kALLOC_TRAIT_NON_ATOMIC
Allocates memory that cannot support atomic operations.
Definition: kApiDef.h:2282
Represents a 32-bit unsigned integer.
k32s y
Y-coordinate of the origin.
Definition: kApiDef.h:1506
kBool kChar_IsSpace(kChar ch)
Checks whether ASCII character is a some kind of white space character type.
Definition: kApiDef.h:427
kStatus kBool_Parse(kBool *value, const kChar *str)
Converts string to kBool value.
k32u left
Horizontal origin.
Definition: kApiDef.h:1489
k64f height
Height of the rectangle.
Definition: kApiDef.h:1540
k32f x
X-coordinate of the origin.
Definition: kApiDef.h:1521
Rectangle structure with 32-bit signed integer fields.
Definition: kApiDef.h:1503
3D point structure with 32-bit floating-point fields.
Definition: kApiDef.h:1400
k64f x
X-coordinate of the origin.
Definition: kApiDef.h:1537
k32s width
Width of the rectangle.
Definition: kApiDef.h:1601
k8u b
Blue component value.
Definition: kApiDef.h:1666
k32s y
Y-coordinate value.
Definition: kApiDef.h:1388
#define kALLOC_TRAIT_SERIAL
Allocates memory suitable for single-threaded use only.
Definition: kApiDef.h:2281
k16s width
Width of the rectangle.
Definition: kApiDef.h:1475
32-bit color pixel structure (B/G/R/A).
Definition: kApiDef.h:1692
k16s y
Y-coordinate of the origin.
Definition: kApiDef.h:1474
k8u b
Blue component value.
Definition: kApiDef.h:1723
Represents a unique thread identifier.
2D point structure with 16-bit signed integer fields.
Definition: kApiDef.h:1303
kStatus(kCall * kFrameworkConstructorFx)(kObject *object, kAlloc allocator)
Required signature for kObject framework constructors.
Definition: kApiDef.h:2458
kChar kChar_ToLower(kChar ch)
Convert ASCII character to lower case.
Definition: kApiDef.h:403
kBool kAllocTrait_IsCudaManaged(kAllocTrait traits)
Reports whether the kALLOC_TRAIT_CUDA_MANAGED trait is present in an allocator trait bitset...
Definition: kApiDef.h:2356
Represents a 64-bit unsigned integer.
Architecture/compiler-specific definitions.
kBool kSuccess(kStatus status)
Returns kTRUE if the given expression value is kOK.
Definition: kApiDef.h:576
Represents a 256-unit, null-terminated, kChar sequence.
kTypeName methodName
Method name (e.g. "Clone").
Definition: kApiDef.h:2467
kPointer receiver
Callback receiver context pointer.
Definition: kApiDef.h:1859
kTypeName name
Enumerator name (e.g. "kPIXEL_FORMAT_8BPP_GREYSCALE").
Definition: kApiDef.h:2493
#define kALLOC_TRAIT_CUDA_PINNED
Allocates Cuda pinned memory (host or device).
Definition: kApiDef.h:2284
Rotated rectangle structure with 32-bit floating-point fields.
Definition: kApiDef.h:1614
k64f y
Y-coordinate of the origin.
Definition: kApiDef.h:1538
k32s z
Z-coordinate value.
Definition: kApiDef.h:1389
Represents a void pointer.
32-bit color pixel structure (B/G/R/X).
Definition: kApiDef.h:1664
kStatus kSize_Parse(kSize *value, const kChar *str)
Converts string to kSize value.
k32f x
X-coordinate value.
Definition: kApiDef.h:1333
kBool kThreadId_Compare(kThreadId a, kThreadId b)
Compares two thread identifiers for equality.
kByte address[6]
Address bytes (most significant byte first).
Definition: kApiDef.h:1748
kStatus kSSize_Parse(kSSize *value, const kChar *str)
Converts string to kSSize value.
kBool kAllocTrait_SupportsContext(kAllocTrait traits)
Reports whether the kALLOC_TRAIT_CONTEXT trait is present in an allocator trait bitset.
Definition: kApiDef.h:2332
static kInline std::enable_if< std::is_unsigned< T >::value, T >::type kDivideCeil(const T &a, const T &b)
Calculates the quotient of two unsigned integers, rounding up.
Definition: kApiDef.h:2116
T kQuantizeFloor(const T &value, const T &granularity)
Rounds the specified input value down to the nearest multiple of the specified granularity.
Definition: kApiDef.h:2148
kBool kChar_IsLetter(kChar ch)
Checks whether ASCII character is a letter.
Definition: kApiDef.h:439
T kClamp(const T &v, const T &min, const T &max)
Returns a value limited to the specified range.
Definition: kApiDef.h:2068
k16s z
Z-coordinate value.
Definition: kApiDef.h:1374
T kMax(const T &a, const T &b)
Returns the maximum of two numbers.
Definition: kApiDef.h:2051
kStatus k32f_Format(k32f value, kChar *buffer, kSize capacity)
Converts k32f value to string.
Represents a 16-bit unsigned integer.
kStatus k32u_Format(k32u value, kChar *buffer, kSize capacity)
Converts k32u value to string.
k32s xc
X-coordinate of the rectangle center.
Definition: kApiDef.h:1599
Rotated rectangle structure with 32-bit signed integer fields.
Definition: kApiDef.h:1597
kBool kAllocTrait_IsSerial(kAllocTrait traits)
Reports whether the kALLOC_TRAIT_SERIAL trait is present in an allocator trait bitset.
Definition: kApiDef.h:2308
k32f yc
Y-coordinate of the rectangle center.
Definition: kApiDef.h:1617
kStatus kBool_Format(kBool value, kChar *buffer, kSize capacity)
Converts kBool value to string.
Represents an unsigned integer that can store a pointer address.
Abstract base class for memory allocator types.
k32s angle
Rotation angle of the rectangle.
Definition: kApiDef.h:1603
void * kPointer_ItemOffset(const void *pointer, kSSize itemIndex, kSize itemSize)
Gets a pointer to the Nth element of an array.
Definition: kApiDef.h:336
kTypeName displayName
Formatted display name (e.g. "8bpp Greyscale");.
Definition: kApiDef.h:2494
Represents type field information.
Definition: kApiDef.h:2477
k64f width
Width of the rectangular cuboid.
Definition: kApiDef.h:1570
Represents an 8-bit unsigned integer.
k64f x
X-coordinate of the origin.
Definition: kApiDef.h:1567
k64f depth
Depth of the rectangular cuboid.
Definition: kApiDef.h:1572
#define kInlineFx(TYPE)
Inline method declaration helper.
Definition: kApiDef.h:29
k64f y
Y-coordinate value.
Definition: kApiDef.h:1418
#define k64F_NULL
k64f invalid value.
Definition: kApiDef.h:222
k64f x
X-coordinate value.
Definition: kApiDef.h:1417
kBool kAllocTrait_IsNonAtomic(kAllocTrait traits)
Reports whether the kALLOC_TRAIT_NON_ATOMIC trait is present in an allocator trait bitset...
Definition: kApiDef.h:2320
Represents enumerator information.
Definition: kApiDef.h:2490
Represents a single unit (byte) in a UTF-8 character.
#define kALLOC_TRAIT_CONTEXT
Allocator supports use of a context object during copy operations.
Definition: kApiDef.h:2283
Represents a byte on the current platform.
kStatus k64s_Format(k64s value, kChar *buffer, kSize capacity)
Converts k64s value to string.
T kAdjustCeil(const T &value, const T &min, const T &max, const T &granularity)
Rounds the specified input up, conforming to minimum, maximum, and granularity constraints.
Definition: kApiDef.h:2214
kStatus k16u_Parse(k16u *value, const kChar *str)
Converts string to k16u value.
k16s x
X-coordinate value.
Definition: kApiDef.h:1305
k16s y
Y-coordinate value.
Definition: kApiDef.h:1373
kStatus kSSize_Format(kSSize value, kChar *buffer, kSize capacity)
Converts kSSize value to string.
kSize(kCall * kHashFx)(const void *item)
Callback signature to determine hash code of an item.
Definition: kApiDef.h:1838
kStatus k64f_Parse(k64f *value, const kChar *str)
Converts string to k64f value.
k32f angle
Rotation angle of the rectangle.
Definition: kApiDef.h:1620
Represents a signed integer that can store a pointer address.
typedef kStatus(kCall *kMsgQueueDropFx)(kPointer receiver
Defines the signature of a callback function to handle dropped items.
k32s height
Height of the rectangle.
Definition: kApiDef.h:1508
Rectangle structure with 32-bit floating-point fields.
Definition: kApiDef.h:1519
kBool kIsError(kStatus status)
Returns kTRUE if the given status value is not kOK.
Definition: kApiDef.h:564
k32s kVersion_Compare(kVersion version1, kVersion version2)
Returns an integral value indicating the relationship between the versions.
Definition: kApiDef.h:870
kBool kAllocTrait_IsCudaPinned(kAllocTrait traits)
Reports whether the kALLOC_TRAIT_CUDA_PINNED trait is present in an allocator trait bitset...
Definition: kApiDef.h:2344
k32s width
Width of the rectangle.
Definition: kApiDef.h:1507
#define k32F_NULL
k32f invalid value.
Definition: kApiDef.h:193
kStatus k32u_Parse(k32u *value, const kChar *str)
Converts string to k32u value.
k32s x
X-coordinate value.
Definition: kApiDef.h:1319
k32u width
Width of the ROI.
Definition: kApiDef.h:1491
k32s height
Height of the rectangle.
Definition: kApiDef.h:1602
Rectangle structure with 64-bit floating-point fields.
Definition: kApiDef.h:1535
Represents a 128-unit, null-terminated, kChar sequence.
k32f x
X-coordinate value.
Definition: kApiDef.h:1402
k8u kVersion_Minor(kVersion version)
Returns the minor part of a version number.
Definition: kApiDef.h:894
#define kALLOC_TRAIT_CUDA_MANAGED
Allocates Cuda managed memory (host or device).
Definition: kApiDef.h:2285
kChar kChar_ToUpper(kChar ch)
Convert ASCII character to upper case.
Definition: kApiDef.h:415
kStatus k16s_Format(k16s value, kChar *buffer, kSize capacity)
Converts k16s value to string.
kBool(kCall * kEqualsFx)(const void *item1, const void *item2)
Callback signature to determine equality of two items.
Definition: kApiDef.h:1830
k8u kVersion_Major(kVersion version)
Returns the major part of a version number.
Definition: kApiDef.h:882
kBool k64f_IsNull(k64f value)
Tests for null k64f.
Definition: kApiDef.h:243
T kQuantizeCeil(const T &value, const T &granularity)
Rounds the specified input value up to the nearest multiple of the specified granularity.
Definition: kApiDef.h:2164
k16s y
Y-coordinate value.
Definition: kApiDef.h:1306
Represents type method information.
Definition: kApiDef.h:2465
k16s x
X-coordinate value.
Definition: kApiDef.h:1372
k32f z
Z-coordinate value.
Definition: kApiDef.h:1404
kTypeName name
Field name.
Definition: kApiDef.h:2479
kStatus k32f_Parse(k32f *value, const kChar *str)
Converts string to k32f value.
k64f width
Width of the rectangle.
Definition: kApiDef.h:1539
k64f z
Z-coordinate value.
Definition: kApiDef.h:1419
Represents a callback function and context pointer.
Definition: kApiDef.h:1856
void kItemCopy(void *dest, const void *src, kSize size)
Performs a small copy with minimal overhead.
Definition: kApiDef.h:2249
k8u kVersion_Build(kVersion version)
Returns the build part of a version number.
Definition: kApiDef.h:918
k8u r
Red component value.
Definition: kApiDef.h:1696
2D point structure with 32-bit floating-point fields.
Definition: kApiDef.h:1331
k64f y
Y-coordinate of the origin.
Definition: kApiDef.h:1568
kStatus k32s_Format(k32s value, kChar *buffer, kSize capacity)
Converts k32s value to string.
Preset compression levels.
k16s w
W-coordinate value.
Definition: kApiDef.h:1447
k32s yc
Y-coordinate of the rectangle center.
Definition: kApiDef.h:1600
k8u r
Red component value.
Definition: kApiDef.h:1725
Represents a 32-bit signed integer.
Represents an Ethernet address.
Definition: kApiDef.h:1746
void * kPointer_ByteOffset(const void *pointer, kSSize offset)
Calculates a pointer address from a base address and a byte offset.
Definition: kApiDef.h:322
void(kCall * kFunction)()
Generic pointer to function.
Definition: kApiDef.h:31
k8u r
Red component value.
Definition: kApiDef.h:1668
k32f height
Height of the rectangle.
Definition: kApiDef.h:1619
kBool kChar_IsDigit(kChar ch)
Checks whether ASCII character is a digit.
Definition: kApiDef.h:451
k64f x
X-coordinate value.
Definition: kApiDef.h:1347
void kItemZero(void *dest, kSize size)
Zero-initializes a small amount of memory with minimal overhead.
Definition: kApiDef.h:2267
kVersion kVersion_Create(k32u major, k32u minor, k32u release, k32u build)
Creates a version value from its constituent parts.
Definition: kApiDef.h:817
kType type
Field type.
Definition: kApiDef.h:2480
k8u kVersion_Release(kVersion version)
Returns the release part of a version number.
Definition: kApiDef.h:906
kEndianness kEndianness_Host()
Reports the endianness of the current platform.
Definition: kApiDef.h:941
kStatus k16s_Parse(k16s *value, const kChar *str)
Converts string to k16s value.
2D point structure with 64-bit floating-point fields.
Definition: kApiDef.h:1345
kBool kEndianness_ShouldReverse(kEndianness endianness)
Reports whether byte ordering must be reversed to be consistent with the current platform.
Definition: kApiDef.h:952
kStatus(kCall * kCallbackFx)(kPointer receiver, kPointer sender, void *args)
Callback signature for a generic event handler.
Definition: kApiDef.h:1848
#define kALLOC_TRAIT_CUDA_DEVICE
Allocates Cuda device memory (device only).
Definition: kApiDef.h:2286
k8u g
Green component value.
Definition: kApiDef.h:1667
Represents a 64-bit signed integer.
Window structure with 32-bit unsigned integer fields.
Definition: kApiDef.h:1487
kStatus kSize_Format(kSize value, kChar *buffer, kSize capacity)
Converts kSize value to string.
kBool kAllocTrait_IsCudaDeviceAccessible(kAllocTrait traits)
Reports whether the memory is Cuda device-accessible.
Definition: kApiDef.h:2380
T kMin(const T &a, const T &b)
Returns the minimum of two numbers.
Definition: kApiDef.h:2035
#define kALLOC_TRAIT_FOREIGN
Allocates memory in a foreign memory domain (non-host address space).
Definition: kApiDef.h:2280
kStatus kVersion_Format(kVersion version, kChar *buffer, kSize capacity)
Formats a version to a string buffer.
Represents a 16-unit, null-terminated, kChar sequence.
Flags that control how a file is opened.
Represents an 8-bit signed integer.
Represents the byte-ordering of primitive data types.
k32f width
Width of the rectangle.
Definition: kApiDef.h:1618
k8u b
Blue component value.
Definition: kApiDef.h:1694
k16s height
Height of the rectangle.
Definition: kApiDef.h:1476
kStatus k8s_Format(k8s value, kChar *buffer, kSize capacity)
Converts k8s value to string.
Represents metadata about a type (class, interface, or value).
k8u g
Green component value.
Definition: kApiDef.h:1695
kStatus k64s_Parse(k64s *value, const kChar *str)
Converts string to k64s value.
k16s x
X-coordinate value.
Definition: kApiDef.h:1444
k32s x
X-coordinate value.
Definition: kApiDef.h:1387
kStatus kVersion_Parse(kVersion *version, const kChar *buffer)
Parses a version from a formatted string.
Represents a 32-unit, null-terminated, kChar sequence.
kStatus kMacAddress_Format(kMacAddress address, kChar *text, kSize capacity)
Formats an Ethernet MAC address as a string.
k32u top
Vertical origin.
Definition: kApiDef.h:1490
3D point structure with 16-bit signed integer fields.
Definition: kApiDef.h:1370
k32s value
Enumerator numeric value.
Definition: kApiDef.h:2492
kTypeName functionName
Full function name (e.g. "kObject_Clone").
Definition: kApiDef.h:2468
Represents a 16-bit signed integer.
k32f y
Y-coordinate of the origin.
Definition: kApiDef.h:1522
Represents a 32-bit floating-point number.
k64f y
Y-coordinate value.
Definition: kApiDef.h:1348
Represents a version number.
k8u a
Alpha component value.
Definition: kApiDef.h:1697
#define kOK
Operation successful.
Definition: kApiDef.h:543
static kInline std::enable_if< std::is_unsigned< T >::value, T >::type kDivideFloor(const T &a, const T &b)
Calculates the quotient of two unsigned integers, rounding down.
Definition: kApiDef.h:2084
Represents an error code.
k64f z
Z-coordinate of the origin.
Definition: kApiDef.h:1569
Represents a thread priority class.
kStatus k64u_Format(k64u value, kChar *buffer, kSize capacity)
Converts k64u value to string.
k8u x
Undefined.
Definition: kApiDef.h:1669
k32u height
Height of the ROI.
Definition: kApiDef.h:1492
k32s y
Y-coordinate value.
Definition: kApiDef.h:1320
kSize offset
Offset of field within structure (bytes).
Definition: kApiDef.h:2481
k16s y
Y-coordinate value.
Definition: kApiDef.h:1445
#define kCall
kApi standard function calling convention.
Definition: kApiDef.h:15
Image color filter array type.
k32f width
Width of the rectangle.
Definition: kApiDef.h:1523
kStatus k16u_Format(k16u value, kChar *buffer, kSize capacity)
Converts k16u value to string.
Rectangular cuboid structure with 64-bit floating-point fields.
Definition: kApiDef.h:1565
kStatus k64f_Format(k64f value, kChar *buffer, kSize capacity)
Converts k64f value to string.
Rectangle structure with 16-bit signed integer fields.
Definition: kApiDef.h:1471
kStatus k8u_Format(k8u value, kChar *buffer, kSize capacity)
Converts k8u value to string.
24-bit color pixel structure (B/G/R).
Definition: kApiDef.h:1721
Represents a 64-bit floating-point number.
Represents a comparison type.
kSSize kPointer_Diff(void *a, void *b)
Calculates the signed difference between two pointers.
Definition: kApiDef.h:349
k32s x
X-coordinate of the origin.
Definition: kApiDef.h:1505
static kInline std::enable_if< std::is_unsigned< T >::value, T >::type kAbs(const T &v)
Returns the absolute value of an unsigned number.
Definition: kApiDef.h:1974
Represents a memory allocator trait.
k32f xc
X-coordinate of the rectangle center.
Definition: kApiDef.h:1616
2D point structure with 32-bit signed integer fields.
Definition: kApiDef.h:1317
Represents a boolean value.
kStatus k64u_Parse(k64u *value, const kChar *str)
Converts string to k64u value.
k16s x
X-coordinate of the origin.
Definition: kApiDef.h:1473
Represents alignment options for allocations.
kStatus kMacAddress_Parse(kMacAddress *address, const kChar *text)
Parses a text-formatted Ethernet MAC address.
kSize count
Count of values in this field (typically 1; can be higher for "array value" fields, e.g. kText32).
Definition: kApiDef.h:2482
T kAdjustFloor(const T &value, const T &min, const T &max, const T &granularity)
Rounds the specified input down, conforming to minimum, maximum, and granularity constraints.
Definition: kApiDef.h:2186
k32f height
Height of the rectangle.
Definition: kApiDef.h:1524
k8u g
Green component value.
Definition: kApiDef.h:1724
3D point structure with 64-bit floating-point fields.
Definition: kApiDef.h:1415
static kInline std::enable_if< std::is_unsigned< T >::value, T >::type kSign(const T &v)
Returns the sign of an unsigned number.
Definition: kApiDef.h:2004
kBool kAllocTrait_IsCudaDevice(kAllocTrait traits)
Reports whether the kALLOC_TRAIT_CUDA_DEVICE trait is present in an allocator trait bitset...
Definition: kApiDef.h:2368
3D point structure with 32-bit signed integer fields.
Definition: kApiDef.h:1385
k16s z
Z-coordinate value.
Definition: kApiDef.h:1446
kStatus k8u_Parse(k8u *value, const kChar *str)
Converts string to k8u value.
k32f y
Y-coordinate value.
Definition: kApiDef.h:1403
4D point structure with 16-bit signed integer fields.
Definition: kApiDef.h:1442
kStatus k8s_Parse(k8s *value, const kChar *str)
Converts string to k8s value.