MkObjectC - create and destroy a managed-object … More...
Macros | |
#define | MkObjInit2(rtmkV, rtExtV, sigV, typeV, refCountV, isLocalV) |
Initialize an MkObjectS. | |
#define | MkObjInit(rtmkV, rtExtV, cls, refCountV, isLocalV) |
#define | MkObjInitFromType(typeV, isLocalV) |
#define | MkObjInitFromInstance(instV) |
#define | MkObjectDelete_NULL(obj) |
#define | MkObjectDelete_NULL_X(x) |
#define | MkObjectDelete_1X(x) |
#define | MkObjectDeleteToNull(fct, NS, x) |
#define | MkObjectDeleteToNull_X(fct, NS, x) |
#define | MkObjectDispose_NULL(obj) |
#define | MkObjectDispose_NULL_X(x) |
#define | MkObjectDispose_1X(x) |
#define | MkObjectDeleteCallF_CHECK |
validate call to MkObjectDeleteCallF | |
#define | MkObjectDeleteCallF_ARGS |
the MkObjectDeleteCallF arguments with default names | |
#define | MkObjectDeleteCallF_CALL MK_RT_CALL obj, __data__ |
#define | MkObjectDeleteFreeF_ARGS MK_RT_ARGS MK_CBP *dataP __parser__(inout) |
the MkObjectDeleteFreeF arguments with default names | |
Typedefs | |
typedef enum MkErrorE(* | MkObjectDeleteCallF) (MK_RT mkrt, MK_OBJN const obj, MK_STRN const typeName, MK_HDL const typeHdl, MK_HDL const objHdl, MK_CBP const __data__) |
static callback to delete an obj … | |
typedef void(* | MkObjectDeleteFreeF) (MkObjectDeleteFreeF_ARGS) |
Functions | |
MK_OBJ | MkObjDup_RT (MK_RT mkrt, MK_OBJ const srcobj) |
call the Dup-Constructor from the object | |
MK_OBJ | MkObjDup2_RT (MK_RT mkrt, MK_OBJ const srcmng, MK_STRN const ident) |
call the Dup2-Constructor from the object | |
MK_OBJ | MkObjMerge_RT (MK_RT mkrt, MK_OBJ const obj) |
Constructor - create a new object as a merge from an existing object | |
MK_OBJ | MkObjCreate_RT (MK_RT mkrt, MK_TYP type, MK_PTR nat, MK_PTR lnk) |
call the Constructor from the object | |
void | MkObjectDelete_RT (MK_RT mkrt, MK_OBJ obj) |
Delete-Slot - delete an instance. | |
void | MkObjectDispose_RT (MK_RT mkrt, MK_OBJ obj) |
Dispose-Slot - untie the connection between the Native-C#-Instance and the csmkkernel-Instance. | |
enum MkErrorE | MkObjectDeleteCallbackSetup_RT (MK_RT mkrt, MK_STRN ident, MkObjectDeleteCallF fCall, MK_CBP callback, MkObjectDeleteFreeF fFree, MK_STRN filter) |
Create/Delete the instance-delete-callback … | |
void | MkObjectDeleteCallbackCleanup_RT (MK_RT mkrt, MK_STRN ident) |
cleanup the DeleteCallback installed with MkObjectDeleteCallbackSetup … | |
MkObjectC - MkObjectC_TOR_C_API - overload | |
#define | MkObjDup_NULL(...) |
#define | MkObjDup(...) |
#define | MkObjMerge_NULL(...) |
#define | MkObjMerge(...) |
#define | MkObjCreate_NULL(...) |
#define | MkObjCreate(...) |
#define | MkObjCreate_2(nat, lnk) |
#define | MkObjectDispose(x) |
#define | MkObjectDelete(x) |
#define | MkObjDup2_NULL(...) |
#define | MkObjDup2(...) |
#define | MkObjectDeleteCallbackCleanup_NULL(...) |
#define | MkObjectDeleteCallbackCleanup(...) |
#define | MkObjectDeleteCallbackSetup_NULL(...) |
#define | MkObjectDeleteCallbackSetup(...) |
#define | MkObjectDeleteCallbackSetup_E(...) |
#define | MkObjectDeleteCallbackSetup_C(...) |
MkObjectC - create and destroy a managed-object …
#define MkObjCreate | ( | ... | ) |
Definition at line 1796 of file kernel_overload_mk.h.
#define MkObjCreate_2 | ( | nat, | |
lnk ) |
Definition at line 1797 of file kernel_overload_mk.h.
#define MkObjCreate_NULL | ( | ... | ) |
Definition at line 1795 of file kernel_overload_mk.h.
#define MkObjDup | ( | ... | ) |
Definition at line 1790 of file kernel_overload_mk.h.
#define MkObjDup2 | ( | ... | ) |
Definition at line 1807 of file kernel_overload_mk.h.
#define MkObjDup2_NULL | ( | ... | ) |
Definition at line 1806 of file kernel_overload_mk.h.
#define MkObjDup_NULL | ( | ... | ) |
Definition at line 1789 of file kernel_overload_mk.h.
#define MkObjectDelete | ( | x | ) |
Definition at line 1803 of file kernel_overload_mk.h.
#define MkObjectDelete_1X | ( | x | ) |
Definition at line 4394 of file LibMkKernel_mk.h.
#define MkObjectDelete_NULL | ( | obj | ) |
Definition at line 4392 of file LibMkKernel_mk.h.
#define MkObjectDelete_NULL_X | ( | x | ) |
Definition at line 4393 of file LibMkKernel_mk.h.
#define MkObjectDeleteCallbackCleanup | ( | ... | ) |
Definition at line 1811 of file kernel_overload_mk.h.
#define MkObjectDeleteCallbackCleanup_NULL | ( | ... | ) |
Definition at line 1810 of file kernel_overload_mk.h.
#define MkObjectDeleteCallbackSetup | ( | ... | ) |
Definition at line 1813 of file kernel_overload_mk.h.
#define MkObjectDeleteCallbackSetup_C | ( | ... | ) |
Definition at line 1815 of file kernel_overload_mk.h.
#define MkObjectDeleteCallbackSetup_E | ( | ... | ) |
Definition at line 1814 of file kernel_overload_mk.h.
#define MkObjectDeleteCallbackSetup_NULL | ( | ... | ) |
Definition at line 1812 of file kernel_overload_mk.h.
#define MkObjectDeleteCallF_ARGS |
the MkObjectDeleteCallF arguments with default names
Definition at line 4431 of file LibMkKernel_mk.h.
#define MkObjectDeleteCallF_CALL MK_RT_CALL obj, __data__ |
Definition at line 4439 of file LibMkKernel_mk.h.
#define MkObjectDeleteCallF_CHECK |
validate call to MkObjectDeleteCallF
Definition at line 4425 of file LibMkKernel_mk.h.
#define MkObjectDeleteFreeF_ARGS MK_RT_ARGS MK_CBP *dataP __parser__(inout) |
the MkObjectDeleteFreeF arguments with default names
Definition at line 4489 of file LibMkKernel_mk.h.
#define MkObjectDeleteToNull | ( | fct, | |
NS, | |||
x ) |
Definition at line 4396 of file LibMkKernel_mk.h.
#define MkObjectDeleteToNull_X | ( | fct, | |
NS, | |||
x ) |
Definition at line 4397 of file LibMkKernel_mk.h.
#define MkObjectDispose | ( | x | ) |
Definition at line 1800 of file kernel_overload_mk.h.
#define MkObjectDispose_1X | ( | x | ) |
Definition at line 4422 of file LibMkKernel_mk.h.
#define MkObjectDispose_NULL | ( | obj | ) |
Definition at line 4420 of file LibMkKernel_mk.h.
#define MkObjectDispose_NULL_X | ( | x | ) |
Definition at line 4421 of file LibMkKernel_mk.h.
#define MkObjInit | ( | rtmkV, | |
rtExtV, | |||
cls, | |||
refCountV, | |||
isLocalV ) |
Definition at line 4284 of file LibMkKernel_mk.h.
#define MkObjInit2 | ( | rtmkV, | |
rtExtV, | |||
sigV, | |||
typeV, | |||
refCountV, | |||
isLocalV ) |
Initialize an MkObjectS.
This is internal code used in the CTOR toinitialize the memory after the new object was created.
Definition at line 4247 of file LibMkKernel_mk.h.
#define MkObjInitFromInstance | ( | instV | ) |
Definition at line 4292 of file LibMkKernel_mk.h.
#define MkObjInitFromType | ( | typeV, | |
isLocalV ) |
Definition at line 4288 of file LibMkKernel_mk.h.
#define MkObjMerge | ( | ... | ) |
Definition at line 1792 of file kernel_overload_mk.h.
#define MkObjMerge_NULL | ( | ... | ) |
Definition at line 1791 of file kernel_overload_mk.h.
typedef enum MkErrorE( * MkObjectDeleteCallF) (MK_RT mkrt,MK_OBJN const obj, MK_STRN const typeName, MK_HDL const typeHdl, MK_HDL const objHdl, MK_CBP const __data__) |
static callback to delete an obj …
This callback is called when the obj is deleted. Setting up the callback is done using the MkObjectDeleteCallbackSetup function.
Deleting an obj is not easy because there are generally two parts, the Target-Programming-Language (TPL) part and the Programming-Language-Micro-Kernel (PLMK) part.
Generally, two callbacks are involved:
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | obj | the theKernel part of the object, only use internal in the C-callback |
[in] | typeName | the return from MkObjectToNameOfType |
[in] | typeHdl | the return from MkObjectHandleGetOfType |
[in] | objHdl | the return from MkObjectHandleGet |
MkExceptionC | → The default-exception from the Programming-Language-Micro-Kernel (PLMK) |
It is a design flaw to use obj in the TPL-callback because using obj or using the MkObjectHandleResolve function on objHdl will recreate the already deleted TPL-object and this generally breaks the TPL-runtime.
Just think of a Garbage-Collection (GC) deleting an object and that object is reborn in the GC deletion process.
Definition at line 4415 of file LibMkKernel_mk.h.
typedef void( * MkObjectDeleteFreeF) (MkObjectDeleteFreeF_ARGS) |
Definition at line 4492 of file LibMkKernel_mk.h.
call the Constructor from the object
Create a new object using type and an additional nat. This requie a MkTypeS::constructor be available
call the Dup2-Constructor from the object
The Dup2-Constructor create a new object-shell, and copy all the internal data from the srcobj to the newobj. An additional ident is used to set e name ressource After the Dup2-Constructor the srcobj is unchanged.
call the Dup-Constructor from the object
This is an Instance-Callback the real Dup function called depend on the MkObjectS::type.
The Dup-Constructor create a new object-shell, and copy all the internal data from the srcobj to the newobj. After the Dup-Constructor the srcobj is unchanged.
The new instance belongs to the caller and may have to be released if necessary. A manual release using ObjectDelete is always possible, but the instance can no longer be used afterwards.
Delete-Slot - delete an instance.
There are two different ways to delete an instance:
ObjectDispose | to free the internal data but keep the outher shell alive - this is called a SOFT-DELETE |
ObjectDelete | to delete the outher shell including the internal data - this is called a HARD-DELETE |
cleanup the DeleteCallback installed with MkObjectDeleteCallbackSetup …
enum MkErrorE MkObjectDeleteCallbackSetup_RT | ( | MK_RT | mkrt, |
MK_STRN | ident, | ||
MkObjectDeleteCallF | fCall, | ||
MK_CBP | callback, | ||
MkObjectDeleteFreeF | fFree, | ||
MK_STRN | filter ) |
Create/Delete the instance-delete-callback …
The callback is called shortly before deleting an instance and is used to synchronize object management across the network.
The ident identifies the callback
ALL
is used than all callbacks are deleted first.The fCall (C-Only) or callback (Non-C) it is the callback called
The filter is a POSIX Extended Regular Expression to filter on type-names.
""
: MkBufferC
. man 7 regex
. [in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | ident | Identify the callback, have to ne non null and not "" . |
[in] | fCall | (C-Only) Internal required: the callback, if null than the callback is deleted. |
[in] | callback | Optional: the parameter for fcall, for cleanup use fFree. |
[in] | fFree | (C-Only) Internal optional: cleanup callback data |
[in] | filter | Optional: is an regular expression to filter for MkTypeS::type_name. |
MkObjectDeleteCallbackSetup
: callback signatureMkObjectDeleteCallbackSetup
: callback exampleDispose-Slot - untie the connection between the Native-C#-Instance and the csmkkernel-Instance.
There are two different ways to delete an instance:
ObjectDispose | to free the internal data but keep the outher shell alive - this is called a SOFT-DELETE |
ObjectDelete | to delete the outher shell including the internal data - this is called a HARD-DELETE |
Constructor - create a new object as a merge from an existing object
The Merge-Constructor create a new object-shell, and take-over all the internal data from the source-object. After the Merge-Constructor the source-object is empty as if a object-reset was called.
One usage of the Merge-Constructor is to get a lightweight-copy of a Thread-Local-Storage object for external usage.
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | obj | The source-object of the merge. |