MkTypeS - class known as typ or type is used as class-base for a Managed-Object-Technology (MOT) type … More...
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 … | |
MkSuperTypeC_Class_Define_C_API | |
MkSuperTypeS - low level definition, access and cast … | |
Classes | |
struct | libmkkernel::MkTypeS |
MkTypeS - class known as typ or type is used as class-base for a Managed-Object-Technology (MOT) type … More... | |
struct | libmkkernel::MkSuperTypeS |
super-class-base, the MkTypeS using the super-macro-syntax for all non specific types … More... | |
Macros | |
#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 | MkTypeSlotResolve(_tt, fptr, force) |
search and return functionPtr(slot) for the tt-type. | |
#define | MkTypeSlotCall(_tt, fptr, ...) |
Functions | |
MK_TYP | libmkkernel::MkTyp (const MK_MNG mng) |
type-check and cast a unknown-managed-object into an MkTypeS pointer or MK_NULL if not possible | |
MK_TYPN | libmkkernel::MkTypN (const MK_MNGN mng) |
type-check and cast a unknown-managed-object into an MkTypeS pointer or MK_NULL if not possible | |
MK_EXTERN MK_PTR | libmkkernel::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 libmkkernel::MkTypeS and provide the type-property (static-property) and the type-method (slot).
The instance-type is derived from the libmkkernel::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 |
---|---|
MkSuperTypeS | super-class-base, the MkTypeS using the super-macro-syntax for all non specific types |
— | — |
MkBufferS | instance-type → This is the main-struct to define an instance |
MkBufferST | instance-type as MkSuperTypeS-class-type |
MkBufferSTT | instance-type as MkTypeS-class-type (cast from MkBufferST into MkTypeS ) |
— | — |
MkBufferC_T | class as MkSuperTypeS-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 |
— | — |
libmkkernel::MK_BUF | class-shortcut for struct MkBufferS * , all shortcut using the XX_YYY syntax (only for public API) |
libmkkernel::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 MkSuperTypeS-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 MkSuperTypeS-class-type |
— | — |
MkBufferCT | class as MkSuperTypeS-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 libmkkernel::MkTypeS is used. To cast a specific-class-type into a common-class-type use:
type->super.typ
MkTYP(type)->XYZ
(pointer) or MkTYP_R(type).XYZ
(reference)To get the common-class-type from the instance use:
instance->super.obj.type
MkOBJ(instance)->type
(pointer) or MkOBJ_R(instance).type
(reference)To get the class-base from the class-type use:
instance->super.obj.type->base
MkOBJ(instance)->type->base
(pointer) or MkOBJ_R(instance).type->base
(reference)The predefined class-type is an instance of the default-class-type (libmkkernel::MkSuperTypeS) …
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 MkTYP | ( | x | ) |
cast a known-managed-object into an MkTypeS pointer
Definition at line 3763 of file LibMkKernel_mk.h.
#define MkTYP_R | ( | x | ) |
cast a known-managed-object into an MkTypeS reference
Definition at line 3761 of file LibMkKernel_mk.h.
#define MkTypeSlotCall | ( | _tt, | |
fptr, | |||
... ) |
Definition at line 3869 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 RuntimeInit.
MK_NULL
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 3860 of file LibMkKernel_mk.h.
type-check and cast a unknown-managed-object into an MkTypeS pointer or MK_NULL
if not possible
Definition at line 3740 of file LibMkKernel_mk.h.
MK_EXTERN MK_PTR libmkkernel::MkTypeSlotResolveP | ( | MK_RT | mkrt, |
MK_TYPN const | type, | ||
size_t const | offset, | ||
bool const | force ) |
hidden function for MkTypeSlotResolve
type-check and cast a unknown-managed-object into an MkTypeS pointer or MK_NULL
if not possible
Definition at line 3751 of file LibMkKernel_mk.h.