MkTypeS - class known as typ or type is used as class-base for a Managed-Object-Technology (MOT) type … More...
Collaboration diagram for MkTypeC_C_API:Topics | |
| MkTypeC_Class_C_API | |
| MkTypeS - define the class … | |
| MkTypeC_TOR_C_API | |
| MkTypeS - various functions to create, initialize and destroy a type … | |
| MkTypeC_Misc_C_API | |
| MkTypeS - various functions to work on type-data … | |
| MkTypeC_Class_Define_C_API | |
| MkTypeS - low level definition, access and cast … | |
| MkTypeDefC_Class_Define_C_API | |
| MkTypeDefS - low level definition, access and cast … | |
Data Structures | |
| struct | MkTypeS |
| MkTypeS - class known as typ or type is used as class-base for a Managed-Object-Technology (MOT) type … More... | |
| struct | MkTypeDefS |
| super-class-base, the MkTypeS using the super-macro-syntax for all non specific types … More... | |
Macros | |
| #define | MkDbgTyp2(t, c) |
| #define | MkDbgTyp(t) |
| #define | MkDbgTypListAll2(t, c) |
| #define | MkDbgTypListAll(t) |
| #define | MkDbgTypInstances_2(t, c) |
| #define | MkDbgTypInstances(t) |
| #define | MkTYP_R(x) |
| cast a known-managed-object into an MkTypeS reference | |
| #define | MkTYP(x) |
| cast a known-managed-object into an MkTypeS pointer | |
| #define | MkTYP_O(o) |
| cast an o-instance into an MkTypeS pointer | |
| #define | MkTYP_X(x) |
| cast an x-instance into an MkTypeS pointer | |
| #define | MkTypeSlotResolve(_tt, fptr, force) |
| search and return functionPtr(slot) for the tt-type. | |
| #define | MkTypeSlotCall(_tt, fptr, ...) |
Functions | |
| static MK_TYP | MkTyp (const MK_MNG mng) |
type-check and cast a unknown-managed-object into an MkTypeS pointer or None if not possible | |
| static MK_TYPN | MkTypN (const MK_MNGN mng) |
type-check and cast a unknown-managed-object into an MkTypeS pointer or None if not possible | |
| MK_PTR | MkTypeSlotResolveP (MK_RT mkrt, MK_TYPN const type, size_t const offset, bool const force) |
| hidden function for MkTypeSlotResolve | |
MkTypeS - class known as typ or type is used as class-base for a Managed-Object-Technology (MOT) type …
In Managed-Object-Technology (MOT) everything is a struct, there is a class-type-struc and a instance-type-struc:
The class-type is derived from the MkTypeS and provide the type-property (static-property) and the type-method (slot).
The instance-type is derived from the MkObjectS and provide the instance-property and the instance-method.
The instance is full defined by min 4 structs and optional multiple base-structs/type(s) :
The following naming-convention exist for the C-API (example: MkBufferC)
| name | definition |
|---|---|
| MkTypeDefS | super-class-base, add the super.typ macro-syntay to the MkTypeS |
| — | — |
| MkBufferS | instance-type → This is the main-struct to define an instance |
| MkBufferST | instance-type as MkTypeDefS-class-type |
| MkBufferSTT | instance-type as MkTypeS-class-type (cast from MkBufferST into MkTypeS) |
| — | — |
| MkBufferC_T | class as MkTypeDefS-class-type, useable in a class-macro as: class##_T |
| MkBufferC_TT | class as MkTypeS-class-type, useable in a class-macro as: class##_TT |
| — | — |
| MK_BUF | class-shortcut for struct MkBufferS *, all shortcut using the XX_YYY syntax (only for public API) |
| MK_BUFR | class-shortcut for const struct MkBufferS *, all const shortcut using the XX_YYYC syntax (only for public API) … |
| MkBufferCR | reference-shortcut for struct MkBufferS, all shortcut using the XX_YYYR syntax (only for public API) |
| — | — |
| MkBufferCT_X(instance) | cast from an instance into the MkTypeDefS-class-type |
| MkBufferCTT_X(instance) | cast from an instance into the MkTypeS-class-type |
| MkBufferCT_TT(typ) | cast from an MkTypeS-class-type into an MkTypeDefS-class-type |
| — | — |
| MkBufferCT | class as MkTypeDefS-class-type for MkBufferC in the Target-Programming-Language (TPL) |
| MkBufferCTT | class as MkTypeS-class-type for MkBufferC in the Target-Programming-Language (TPL) |
The struct(s) are defined as:
To use the specific-class-type as argument to a function or as property in a struct the common-class-type of type MkTypeS is used. To cast a specific-class-type into a common-class-type use:
type->super.typMkTYP(type)->XYZ (pointer) or MkTYP_R(type).XYZ (reference)To get the common-class-type from the instance use:
instance->super.obj.typeMkOBJ(instance)->type (pointer) or MkOBJ_R(instance).type (reference)To get the class-base from the class-type use:
instance->super.obj.type->type_baseMkOBJ(instance)->type->type_base (pointer) or MkOBJ_R(instance).type->type_base (reference)The predefined class-type is an instance of the default-class-type (MkTypeDefS) …
The properties and slots of the class-type are predefined by the class-base and may be overwritten …
The following relationship between the three different struct exists:
MkBufferCT_X(instance))| #define MkDbgTyp | ( | t | ) |
Definition at line 3909 of file LibMkKernel_mk.h.
| #define MkDbgTyp2 | ( | t, | |
| c ) |
Definition at line 3905 of file LibMkKernel_mk.h.
| #define MkDbgTypInstances | ( | t | ) |
Definition at line 3940 of file LibMkKernel_mk.h.
| #define MkDbgTypInstances_2 | ( | t, | |
| c ) |
Definition at line 3920 of file LibMkKernel_mk.h.
| #define MkDbgTypListAll | ( | t | ) |
Definition at line 3918 of file LibMkKernel_mk.h.
| #define MkDbgTypListAll2 | ( | t, | |
| c ) |
Definition at line 3910 of file LibMkKernel_mk.h.
| #define MkTYP | ( | x | ) |
cast a known-managed-object into an MkTypeS pointer
Definition at line 4108 of file LibMkKernel_mk.h.
| #define MkTYP_O | ( | o | ) |
cast an o-instance into an MkTypeS pointer
Definition at line 4110 of file LibMkKernel_mk.h.
| #define MkTYP_R | ( | x | ) |
cast a known-managed-object into an MkTypeS reference
Definition at line 4106 of file LibMkKernel_mk.h.
| #define MkTYP_X | ( | x | ) |
cast an x-instance into an MkTypeS pointer
Definition at line 4112 of file LibMkKernel_mk.h.
| #define MkTypeSlotCall | ( | _tt, | |
| fptr, | |||
| ... ) |
Definition at line 4216 of file LibMkKernel_mk.h.
| #define MkTypeSlotResolve | ( | _tt, | |
| fptr, | |||
| force ) |
search and return functionPtr(slot) for the tt-type.
The search start with tt-type and end with MkTypeS, the root of all types. With force=false the search is done only once and not-found is marked with 0x1. To be sure your functionPtr(slot) will be found add the slot very-early into the library boot. A good place will be at the Setup (constructor) or at the RuntimeSetup.
None if not found| [in] | _tt | the start of the search, use MkTYP(mng) as input |
| [in] | fptr | the attribute of tt to search for, use man offsetof for more info |
| [in] | force | use/notuse the 0x1 hint. If a new functionPtr(slot) was added the force=true will find it. |
Definition at line 4207 of file LibMkKernel_mk.h.
type-check and cast a unknown-managed-object into an MkTypeS pointer or None if not possible
Definition at line 4085 of file LibMkKernel_mk.h.
hidden function for MkTypeSlotResolve
type-check and cast a unknown-managed-object into an MkTypeS pointer or None if not possible
Definition at line 4096 of file LibMkKernel_mk.h.