theKernel 10.0
Loading...
Searching...
No Matches
MkObjectC_Obj_C_API

MkObjectC - managed-object details More...

+ Collaboration diagram for MkObjectC_Obj_C_API:

Functions

MK_OBJ libmkkernel::MkObjCopy_RT (MK_RT mkrt, MK_OBJ const tgtmng, MK_OBJN const srcmng)
 call the copy from the object
 
MK_OBJ libmkkernel::MkObjReset_RT (MK_RT mkrt, MK_OBJ const obj)
 free the internal memory of an object and initialize the local variables to default values
 

MkSelf

typedef void(* libmkkernel::MkSelfIncrF) (MK_RT mkrt, MK_PTR self, MK_PTR const env)
 
typedef void(* libmkkernel::MkSelfDecrF) (MK_RT mkrt, MK_PTR self, MK_PTR const env)
 
static void libmkkernel::MkSelfSet (MK_OBJ const obj, MK_PTR const self, MK_PTR const env)
 set the MkObjectS::self value
 
static MK_PTR libmkkernel::MkSelfGet (MK_OBJ const obj)
 get the MkObjectS::self value
 
static MK_ATTR_HOT enum MkErrorE libmkkernel::MkSelfNew_RT (MK_RT mkrt, MK_OBJ obj, MK_PTR *self_out, MK_PTR const env)
 return the self pointer for a given obj
 
MK_PTR libmkkernel::MkSelfCreate_RT (MK_RT mkrt, MK_OBJ const obj, MK_PTR const env)
 create the MkObjectS::self value
 
bool libmkkernel::MkSelfDelete_RT (MK_RT mkrt, MK_OBJ const obj)
 delete the MkObjectS::self value
 
bool libmkkernel::MkSelfDeleteForce_RT (MK_RT mkrt, MK_OBJ obj)
 force delete an instance, last step in instance-destructor
 
void libmkkernel::MkSelfUnlink_RT (MK_RT mkrt, MK_OBJ obj)
 Run the MkTypeS::selfUnlink slot from the instance...
 
static bool libmkkernel::MkSelfExists (MK_OBJN obj)
 Check if the MkObjectS::self exists …
 
#define MkSelfSet_3X(x, self, env)
 
#define MkSelfGet_1X(x)
 
#define MkSelfNew_3X(x, self_out, env)
 
#define MkSelfCreate_2X(x, env)
 
#define MkSelfDelete_1X(x)
 
#define MkSelfDeleteForce_1X(x)
 
#define MkSelfUnlink_1X(x)
 
#define MkSelfExists_1X(x)
 

MkRef…

reference management functions

static void libmkkernel::MkRefIncr (MK_OBJ obj)
 increment the reference-count
 
void libmkkernel::MkRefDecr_RT (MK_RT mkrt, MK_OBJ obj)
 decrement the reference-count
 
static void libmkkernel::MkRefIncrSelf (MK_OBJ const obj, MK_PTR const self, MK_PTR const env)
 ATOMIC operation -> link self with reference-count.
 
MK_OBJ libmkkernel::MkRefDecrWithoutSelf_RT (MK_RT mkrt, MK_OBJ const obj)
 ATOMIC operation -> unlink self with reference-count.
 
MK_OBJ libmkkernel::MkRefDecrWithUnlinkSelf_RT (MK_RT mkrt, MK_OBJ const obj)
 ATOMIC operation -> unlink self from META und decr-ref-count in META.
 
static MK_I32 libmkkernel::MkRefGet (MK_OBJ const obj)
 get the reference-count
 
static MK_I32 libmkkernel::MkRefLock (MK_OBJ const obj)
 lock the object
 
static bool libmkkernel::MkRefIsLocked (MK_OBJ const obj)
 check if object is locked
 
MK_NUM libmkkernel::MkRefCidN_RT (MK_RT mkrt)
 return the reference-count-recursion-level
 
#define MkRefLOCK   999999
 unchangeable reference
 
#define MkRefIncr_1X(x)
 
#define MkRefIncr_1M(m)
 
#define MkRefIncr_FX(x)
 protect code-block, do not call the destructor…
 
#define MkRefDecr_O(o)
 
#define MkRefDecr_X(x)
 
#define MkRefDecr_X_NULL(x)
 same as MkRefDecr_X but do not expect a runtime-cache.
 
#define MkRefDecr_M(m)
 
#define MkRefDecr_M_NULL(m)
 same as MkRefDecr_M but do not expect a runtime-cache.
 
#define MkRefDecr_FX(x)
 protect code-block, do not call the destructor…
 
#define MkRefIncrSelf_2X(x, s)
 
#define MkRefGet_1X(x)
 
#define MkRefLock_1X(x)
 
#define MkRefIsLocked_1X(x)
 
#define MkRefSet(target, source)
 update target with source and keep the MkObjectS::refCount in sync
 

MkObjectC - MkObjectC_Obj_C_API - overload

#define MkRefCidN_NULL()
 
#define MkObjCopy_NULL(...)
 
#define MkObjCopy(...)
 
#define MkObjReset_NULL(...)
 
#define MkObjReset(...)
 
#define MkRefDecrWithUnlinkSelf_NULL(...)
 
#define MkRefDecrWithUnlinkSelf(...)
 
#define MkRefDecrWithoutSelf_NULL(...)
 
#define MkRefDecrWithoutSelf(...)
 
#define MkSelfCreate_NULL(...)
 
#define MkSelfCreate(...)
 
#define MkSelfNew_NULL(...)
 
#define MkSelfNew(...)
 
#define MkSelfNew_E(...)
 
#define MkSelfNew_C(...)
 
#define MkRefCidN_NULL()
 
#define MkRefCidN()
 
#define MkRefDecr_NULL(...)
 
#define MkRefDecr(...)
 
#define MkSelfDelete_NULL(...)
 
#define MkSelfDelete(...)
 
#define MkSelfDeleteForce_NULL(...)
 
#define MkSelfDeleteForce(...)
 
#define MkSelfUnlink_NULL(...)
 
#define MkSelfUnlink(...)
 

Detailed Description

MkObjectC - managed-object details

Managed-Object-Technology (MOT) is a class system in C that is designed to integrate automatically into other software, which of course also includes other programming languages.

See also
Managed-Object

Macro Definition Documentation

◆ MkObjCopy

#define MkObjCopy ( ...)
Value:
MkObjCopy_RT(MK_RT_CALL __VA_ARGS__)
#define MK_RT_CALL

Definition at line 1673 of file kernel_overload_mk.h.

◆ MkObjCopy_NULL

#define MkObjCopy_NULL ( ...)
Value:
MkObjCopy_RT(MK_RT_CALL_NULL __VA_ARGS__)
#define MK_RT_CALL_NULL

Definition at line 1672 of file kernel_overload_mk.h.

◆ MkObjReset

#define MkObjReset ( ...)
Value:
MkObjReset_RT(MK_RT_CALL __VA_ARGS__)

Definition at line 1675 of file kernel_overload_mk.h.

◆ MkObjReset_NULL

#define MkObjReset_NULL ( ...)
Value:
MkObjReset_RT(MK_RT_CALL_NULL __VA_ARGS__)

Definition at line 1674 of file kernel_overload_mk.h.

◆ MkRefCidN

#define MkRefCidN ( )
Value:
MkRefCidN_RT(MK_RT_CALL_ONLY)
#define MK_RT_CALL_ONLY

Definition at line 1693 of file kernel_overload_mk.h.

◆ MkRefCidN_NULL [1/2]

#define MkRefCidN_NULL ( )
Value:
MkRefCidN_RT(MK_RT_CALL_NULL_ONLY)
#define MK_RT_CALL_NULL_ONLY

Definition at line 1692 of file kernel_overload_mk.h.

◆ MkRefCidN_NULL [2/2]

#define MkRefCidN_NULL ( )
Value:
MkRefCidN_RT(MK_RT_CALL_NULL_ONLY)

Definition at line 4768 of file LibMkKernel_mk.h.

◆ MkRefDecr

#define MkRefDecr ( ...)
Value:
MkRefDecr_RT(MK_RT_CALL __VA_ARGS__)

Definition at line 1695 of file kernel_overload_mk.h.

◆ MkRefDecr_FX

#define MkRefDecr_FX ( x)
Value:
do { --(MkOBJ_R(x).refCount); } while(0)
#define MkOBJ_R(x)
cast a known-object into an MkObjectS reference

protect code-block, do not call the destructor…

Only call MkRefIncr_FX and MkRefDecr_FX together

MkRefIncr_FX(instance);
// do some operation which COULD call the destructor
MkRefDecr_FX(instance);
if (instance->refCount <= 0) {
// instance have to be deleted → clean up!!
MkSelfDeleteForce(instance); // DELETE!
}
#define MkRefDecr_FX(x)
protect code-block, do not call the destructor…
#define MkRefIncr_FX(x)
protect code-block, do not call the destructor…
#define MkSelfDeleteForce(...)

Definition at line 4665 of file LibMkKernel_mk.h.

◆ MkRefDecr_M

#define MkRefDecr_M ( m)
Value:
do { MkRefDecr_RT(MK_RT_CALL MkObj(m)); m=NULL; } while (0)

decrement MkObjectS::refCount with runtime-cast of the instance-pointer.

Parameters
[in]mOnly use this if you dont trust the pointer. The pointer-cast will be MK_NULL if the pointer is invalid or broken.

Definition at line 4660 of file LibMkKernel_mk.h.

◆ MkRefDecr_M_NULL

#define MkRefDecr_M_NULL ( m)
Value:
do { MkRefDecr_RT(MK_RT_NULL MkObj(m)); m=NULL; } while (0)
#define MK_RT_NULL

same as MkRefDecr_M but do not expect a runtime-cache.

Definition at line 4662 of file LibMkKernel_mk.h.

◆ MkRefDecr_NULL

#define MkRefDecr_NULL ( ...)
Value:
MkRefDecr_RT(MK_RT_CALL_NULL __VA_ARGS__)

Definition at line 1694 of file kernel_overload_mk.h.

◆ MkRefDecr_O

#define MkRefDecr_O ( o)
Value:
do { MkRefDecr_RT(MK_RT_CALL o); o=NULL; } while (0)

decrement MkObjectS::refCount without cast of the object-pointer.

Parameters
[in]oPrefer this if you trust the pointer and the pointer is a MkObjectC.

Definition at line 4649 of file LibMkKernel_mk.h.

◆ MkRefDecr_X

#define MkRefDecr_X ( x)
Value:
do { MkRefDecr_RT(MK_RT_CALL MkOBJ(x)); x=NULL; } while (0)
#define MkOBJ(x)
cast a known-object into an MkObjectS pointer

decrement MkObjectS::refCount with compiletime-cast of the instance-pointer.

Parameters
[in]xPrefer this if you trust the pointer and the pointer is not a MkObjectC.

Definition at line 4653 of file LibMkKernel_mk.h.

◆ MkRefDecr_X_NULL

#define MkRefDecr_X_NULL ( x)
Value:
do { MkRefDecr_RT(MK_RT_NULL MkOBJ(x)); x=NULL; } while (0)

same as MkRefDecr_X but do not expect a runtime-cache.

Definition at line 4655 of file LibMkKernel_mk.h.

◆ MkRefDecrWithoutSelf

#define MkRefDecrWithoutSelf ( ...)
Value:
MkRefDecrWithoutSelf_RT(MK_RT_CALL __VA_ARGS__)

Definition at line 1679 of file kernel_overload_mk.h.

◆ MkRefDecrWithoutSelf_NULL

#define MkRefDecrWithoutSelf_NULL ( ...)
Value:
MkRefDecrWithoutSelf_RT(MK_RT_CALL_NULL __VA_ARGS__)

Definition at line 1678 of file kernel_overload_mk.h.

◆ MkRefDecrWithUnlinkSelf

#define MkRefDecrWithUnlinkSelf ( ...)
Value:
MkRefDecrWithUnlinkSelf_RT(MK_RT_CALL __VA_ARGS__)

Definition at line 1677 of file kernel_overload_mk.h.

◆ MkRefDecrWithUnlinkSelf_NULL

#define MkRefDecrWithUnlinkSelf_NULL ( ...)
Value:
MkRefDecrWithUnlinkSelf_RT(MK_RT_CALL_NULL __VA_ARGS__)

Definition at line 1676 of file kernel_overload_mk.h.

◆ MkRefGet_1X

#define MkRefGet_1X ( x)
Value:
MkRefGet(MkOBJ(x))

Definition at line 4733 of file LibMkKernel_mk.h.

◆ MkRefIncr_1M

#define MkRefIncr_1M ( m)
Value:
MkRefIncr(MkObj(m))

Definition at line 4615 of file LibMkKernel_mk.h.

◆ MkRefIncr_1X

#define MkRefIncr_1X ( x)
Value:
MkRefIncr(MkOBJ(x))

Definition at line 4614 of file LibMkKernel_mk.h.

◆ MkRefIncr_FX

#define MkRefIncr_FX ( x)
Value:
MkRefIncr(MkOBJ(x))

protect code-block, do not call the destructor…

Only call MkRefIncr_FX and MkRefDecr_FX together

MkRefIncr_FX(instance);
// do some operation which COULD call the destructor
MkRefDecr_FX(instance);
if (instance->refCount <= 0) {
// instance have to be deleted → clean up!!
MkSelfDeleteForce(instance); // DELETE!
}

Definition at line 4630 of file LibMkKernel_mk.h.

◆ MkRefIncrSelf_2X

#define MkRefIncrSelf_2X ( x,
s )
Value:
MkRefIncrSelf(MkOBJ(x),s)

Definition at line 4682 of file LibMkKernel_mk.h.

◆ MkRefIsLocked_1X

#define MkRefIsLocked_1X ( x)
Value:
MkRefIsLocked(MkOBJ(x))

Definition at line 4752 of file LibMkKernel_mk.h.

◆ MkRefLOCK

#define MkRefLOCK   999999

unchangeable reference

Definition at line 4604 of file LibMkKernel_mk.h.

◆ MkRefLock_1X

#define MkRefLock_1X ( x)
Value:
MkRefLock(MkOBJ(x))

Definition at line 4742 of file LibMkKernel_mk.h.

◆ MkRefSet

#define MkRefSet ( target,
source )
Value:
({ \
if (target != source) { \
typeof(target) targetSave=target; \
target = source;\
MkRefDecr_X(targetSave);\
MkRefIncr_1X(target);\
} \
target;\
})

update target with source and keep the MkObjectS::refCount in sync

Definition at line 4755 of file LibMkKernel_mk.h.

4755#define MkRefSet(target,source) ({ \
4756 if (target != source) { \
4757 typeof(target) targetSave=target; \
4758 target = source;\
4759 MkRefDecr_X(targetSave);\
4760 MkRefIncr_1X(target);\
4761 } \
4762 target;\
4763})

◆ MkSelfCreate

#define MkSelfCreate ( ...)
Value:
MkSelfCreate_RT(MK_RT_CALL __VA_ARGS__)

Definition at line 1683 of file kernel_overload_mk.h.

◆ MkSelfCreate_2X

#define MkSelfCreate_2X ( x,
env )
Value:
#define MkSelfCreate(...)

Definition at line 4856 of file LibMkKernel_mk.h.

◆ MkSelfCreate_NULL

#define MkSelfCreate_NULL ( ...)
Value:
MkSelfCreate_RT(MK_RT_CALL_NULL __VA_ARGS__)

Definition at line 1682 of file kernel_overload_mk.h.

◆ MkSelfDelete

#define MkSelfDelete ( ...)
Value:
MkSelfDelete_RT(MK_RT_CALL __VA_ARGS__)

Definition at line 1697 of file kernel_overload_mk.h.

◆ MkSelfDelete_1X

#define MkSelfDelete_1X ( x)
Value:
MkSelfDelete_RT(MK_RT_CALL MkOBJ(x))

Definition at line 4872 of file LibMkKernel_mk.h.

◆ MkSelfDelete_NULL

#define MkSelfDelete_NULL ( ...)
Value:
MkSelfDelete_RT(MK_RT_CALL_NULL __VA_ARGS__)

Definition at line 1696 of file kernel_overload_mk.h.

◆ MkSelfDeleteForce

#define MkSelfDeleteForce ( ...)
Value:
MkSelfDeleteForce_RT(MK_RT_CALL __VA_ARGS__)

Definition at line 1699 of file kernel_overload_mk.h.

◆ MkSelfDeleteForce_1X

#define MkSelfDeleteForce_1X ( x)
Value:

Definition at line 4896 of file LibMkKernel_mk.h.

◆ MkSelfDeleteForce_NULL

#define MkSelfDeleteForce_NULL ( ...)
Value:
MkSelfDeleteForce_RT(MK_RT_CALL_NULL __VA_ARGS__)

Definition at line 1698 of file kernel_overload_mk.h.

◆ MkSelfExists_1X

#define MkSelfExists_1X ( x)
Value:
MkSelExists(MkOBJ(x))

Definition at line 4930 of file LibMkKernel_mk.h.

◆ MkSelfGet_1X

#define MkSelfGet_1X ( x)
Value:
MkSelfGet(MkOBJ(x))

Definition at line 4806 of file LibMkKernel_mk.h.

◆ MkSelfNew

#define MkSelfNew ( ...)
Value:
MkSelfNew_RT(MK_RT_CALL __VA_ARGS__)

Definition at line 1687 of file kernel_overload_mk.h.

◆ MkSelfNew_3X

#define MkSelfNew_3X ( x,
self_out,
env )
Value:
MkSelfNew(MkOBJ(x),self_out,env)
#define MkSelfNew(...)

Definition at line 4839 of file LibMkKernel_mk.h.

◆ MkSelfNew_C

#define MkSelfNew_C ( ...)
Value:
if (MkErrorCheckI(MkSelfNew(__VA_ARGS__)))
#define MkErrorCheckI(err)

Definition at line 1689 of file kernel_overload_mk.h.

◆ MkSelfNew_E

#define MkSelfNew_E ( ...)
Value:
MkErrorCheck(MkSelfNew(__VA_ARGS__))
#define MkErrorCheck(err)
check return-code and goto error on error …

Definition at line 1688 of file kernel_overload_mk.h.

◆ MkSelfNew_NULL

#define MkSelfNew_NULL ( ...)
Value:
MkSelfNew_RT(MK_RT_CALL_NULL __VA_ARGS__)

Definition at line 1686 of file kernel_overload_mk.h.

◆ MkSelfSet_3X

#define MkSelfSet_3X ( x,
self,
env )
Value:
MkSelfSet(MkOBJ(x),self,env)

Definition at line 4795 of file LibMkKernel_mk.h.

◆ MkSelfUnlink

#define MkSelfUnlink ( ...)
Value:
MkSelfUnlink_RT(MK_RT_CALL __VA_ARGS__)

Definition at line 1701 of file kernel_overload_mk.h.

◆ MkSelfUnlink_1X

#define MkSelfUnlink_1X ( x)
Value:
#define MkSelfUnlink(...)

Definition at line 4921 of file LibMkKernel_mk.h.

◆ MkSelfUnlink_NULL

#define MkSelfUnlink_NULL ( ...)
Value:
MkSelfUnlink_RT(MK_RT_CALL_NULL __VA_ARGS__)

Definition at line 1700 of file kernel_overload_mk.h.

Typedef Documentation

◆ MkSelfDecrF

typedef void(* libmkkernel::MkSelfDecrF) (MK_RT mkrt,MK_PTR self, MK_PTR const env)

Definition at line 4782 of file LibMkKernel_mk.h.

◆ MkSelfIncrF

typedef void(* libmkkernel::MkSelfIncrF) (MK_RT mkrt,MK_PTR self, MK_PTR const env)

Definition at line 4781 of file LibMkKernel_mk.h.

Function Documentation

◆ MkObjCopy_RT()

MK_OBJ libmkkernel::MkObjCopy_RT ( MK_RT mkrt,
MK_OBJ const tgtmng,
MK_OBJN const srcmng )

call the copy from the object

Returns
the new object or MK_NULL if no Merge-Constructor is available
See also
libmkkernel::MkObjDup_RT libmkkernel::MkObjReset_RT

◆ MkObjReset_RT()

MK_OBJ libmkkernel::MkObjReset_RT ( MK_RT mkrt,
MK_OBJ const obj )

free the internal memory of an object and initialize the local variables to default values

See also
libmkkernel::MkObjDup_RT libmkkernel::MkObjMerge_RT

◆ MkRefCidN_RT()

MK_NUM libmkkernel::MkRefCidN_RT ( MK_RT mkrt)

return the reference-count-recursion-level

+ Here is the caller graph for this function:

◆ MkRefDecr_RT()

void libmkkernel::MkRefDecr_RT ( MK_RT mkrt,
MK_OBJ obj )

decrement the reference-count

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API

◆ MkRefDecrWithoutSelf_RT()

MK_OBJ libmkkernel::MkRefDecrWithoutSelf_RT ( MK_RT mkrt,
MK_OBJ const obj )

ATOMIC operation -> unlink self with reference-count.

First the MkObjectS::self and MkObjectS::env will be set to NULL and than MkRefDecr is called.

This api-function is used to free ccmkkernel ressources on an already destroyed Target-Programming-Language (TPL) instance.

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
Returns
always return NULL
See also
MkRefIncr MkSelfSet MkRefIncrSelf
+ Here is the caller graph for this function:

◆ MkRefDecrWithUnlinkSelf_RT()

MK_OBJ libmkkernel::MkRefDecrWithUnlinkSelf_RT ( MK_RT mkrt,
MK_OBJ const obj )

ATOMIC operation -> unlink self from META und decr-ref-count in META.

This ATOMIC operation has 2 steps:

  1. unlink the META from SELF using the MkSelfUnlink call This api-function is used to free ccmkkernel ressources on an existing Target-Programming-Language (TPL) instance.
Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
Returns
always return NULL
See also
MkRefIncr MkSelfSet MkRefIncrSelf
+ Here is the caller graph for this function:

◆ MkRefGet()

static MK_I32 libmkkernel::MkRefGet ( MK_OBJ const obj)
inlinestatic

get the reference-count

Parameters
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
Returns
the reference-count

Definition at line 4728 of file LibMkKernel_mk.h.

4728 {
4729 MK_INSTANCE_HDL(obj);
4730 return (*obj).refCount;
4731}
#define MK_INSTANCE_HDL(x)
+ Here is the caller graph for this function:

◆ MkRefIncr()

static void libmkkernel::MkRefIncr ( MK_OBJ obj)
inlinestatic

increment the reference-count

Parameters
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API

Definition at line 4610 of file LibMkKernel_mk.h.

4610 {
4611 if (obj) ++(*obj).refCount;
4612}

◆ MkRefIncrSelf()

static void libmkkernel::MkRefIncrSelf ( MK_OBJ const obj,
MK_PTR const self,
MK_PTR const env )
inlinestatic

ATOMIC operation -> link self with reference-count.

Parameters
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
[in]selfthis is the self pointer of the object in the programming-language-shell used for ccmkkernel pointer.
[in]envstorage for an application specific environment pointer. (java: JNIEnv*)
See also
MkRefIncr MkSelfSet MkRefDecrWithoutSelf

Definition at line 4675 of file LibMkKernel_mk.h.

4675 {
4676 MK_INSTANCE_HDL(obj);
4677 obj->refCount++;
4678 obj->self = (obj->type->noSelf ? NULL : self);
4679 obj->env = env;
4680}
+ Here is the caller graph for this function:

◆ MkRefIsLocked()

static bool libmkkernel::MkRefIsLocked ( MK_OBJ const obj)
inlinestatic

check if object is locked

Parameters
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
Returns
the boolean value

Definition at line 4748 of file LibMkKernel_mk.h.

4748 {
4749 MK_INSTANCE_HDL(obj);
4750 return (*obj).refCount >= MkRefLOCK;
4751}
#define MkRefLOCK
unchangeable reference
+ Here is the caller graph for this function:

◆ MkRefLock()

static MK_I32 libmkkernel::MkRefLock ( MK_OBJ const obj)
inlinestatic

lock the object

Parameters
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API

Definition at line 4738 of file LibMkKernel_mk.h.

4738 {
4739 MK_INSTANCE_HDL(obj);
4740 return (*obj).refCount=MkRefLOCK;
4741}
+ Here is the caller graph for this function:

◆ MkSelfCreate_RT()

MK_PTR libmkkernel::MkSelfCreate_RT ( MK_RT mkrt,
MK_OBJ const obj,
MK_PTR const env )

create the MkObjectS::self value

create the self from the object mng using MkTypeS::selfCreate

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
[in]envstorage for an application specific environment pointer. (java: JNIEnv*)
Returns
the MkObjectS::self value
+ Here is the caller graph for this function:

◆ MkSelfDelete_RT()

bool libmkkernel::MkSelfDelete_RT ( MK_RT mkrt,
MK_OBJ const obj )

delete the MkObjectS::self value

delete the self from obj using MkTypeS::selfDelete

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
Returns
true if self and mq-obj was deleted and false if self is not available or self-delete does not delete the mq-obj

◆ MkSelfDeleteForce_RT()

bool libmkkernel::MkSelfDeleteForce_RT ( MK_RT mkrt,
MK_OBJ obj )

force delete an instance, last step in instance-destructor

A instance has two parts an PLMK (Programming-Language-Micro-Kernel)-part and a TPL-part, the PLMK (Programming-Language-Micro-Kernel)-part have to be deleted but the deletion of the TPL-part depend on the TPL object-model-philosophy. Some TPL have a HARD-delete some TPL have only a SOFT-delete, read more at MkObjectDelete.

This function will do the following steps:

  1. if available -> call MkTypeS::selfDelete if MkTypeS::selfCreate was called first
  2. if 1. was not done and MkTypeS::selfUnlink is available -> unlink the TPL-instance from the PLMK (Programming-Language-Micro-Kernel)-instance.
  3. if non-local -> set the MkObjectS::signature to MK_NULL_SIGNATURE and free the memory
Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
Returns
true if instance is global or was already deleted and false if local

◆ MkSelfExists()

static bool libmkkernel::MkSelfExists ( MK_OBJN obj)
inlinestatic

Check if the MkObjectS::self exists …

Definition at line 4925 of file LibMkKernel_mk.h.

4925 {
4926 MK_INSTANCE_HDL(obj);
4927 return obj->self != NULL;
4928}
+ Here is the caller graph for this function:

◆ MkSelfGet()

static MK_PTR libmkkernel::MkSelfGet ( MK_OBJ const obj)
inlinestatic

get the MkObjectS::self value

Parameters
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
Returns
the MkObjectS::self value

Definition at line 4801 of file LibMkKernel_mk.h.

4801 {
4802 // BUG FIX - 1 mar 2023: remove nonnull on obj because C# require this
4803 return obj ? obj->self : NULL;
4804}
+ Here is the caller graph for this function:

◆ MkSelfNew_RT()

static enum MkErrorE libmkkernel::MkSelfNew_RT ( MK_RT mkrt,
MK_OBJ obj,
MK_PTR * self_out,
MK_PTR const env )
inlinestatic

return the self pointer for a given obj

This is an important function because every return of a managed-object in a Target-Programming-Language (TPL) will call this function to check if the self is already set. If true the self is returned and if false a new self is created.

the following steps are done:

  • if obj has a self pointer (MkSelfGet)
    • if refCount > 0 return the self pointer
    • if refCount <= 0 return an error
  • if obj NOT has a self pointer... create a self pointer
Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
[out]self_outthe new ccmkkernel object as return
[in]envstorage for an application specific environment pointer. This pointer will be passed to MkTypeS::selfCreate. (example java: JNIEnv*)
Returns

Definition at line 13498 of file LibMkKernel_mk.h.

13500 {
13501 if (MkRefGet(obj) <= 0) {
13502 MkErrorSetV_2M(obj, "RefCount Error: object '%s' has 'self' but 'refCout <= 0", obj->type->type_name);
13503 goto error;
13504 } else {
13505 ret = MK_CONTINUE;
13506 if (MK_RT_REF.MkSelfIncrOnCacheB && MK_RT_REF.fSelfIncr) (*MK_RT_REF.fSelfIncr)(MK_RT_CALL self, env);
13507 goto end;
13508 }
13509 }
13510 self = MkSelfCreate(obj, env);
13511 if (self == NULL) {
13512 MkErrorSetV_2M(obj, "Error: '%s->SelfCreate' return a NULL pointer", obj->type->type_name);
13513 goto error;
13514 }
13515end:
13516 *self_out = self;
13517 return ret;
13518error:
13519 *self_out = NULL;
13520 return MK_ERROR;
13521}
13522
13525
struct MkErrorS * MK_ERR
class-shortcut for struct MkErrorS *, all shortcut using the XX_YYY syntax (only for public API) …
#define MkErrorSetV_2M(err, printfmt,...)
#define mk_inline
@ MK_CONTINUE
(transient) raise an continue-event, the calling-function must handle this.
@ MK_ERROR
(persistent) raise an error-event, the calling-fucntion is interrupted.
static MK_ERR MkObjectToError_RT(MK_RT mkrt, MK_OBJ const obj)
Error-Slot - return an error-object pre initialized with obj data.
static MK_I32 MkRefGet(MK_OBJ const obj)
get the reference-count
#define MK_ATTR_RT_INSTANCE
#define MK_RT_REF

◆ MkSelfSet()

static void libmkkernel::MkSelfSet ( MK_OBJ const obj,
MK_PTR const self,
MK_PTR const env )
inlinestatic

set the MkObjectS::self value

Parameters
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
[in]selfthe target-language-self-pointer usually self or this
[in]envstorage for an application specific environment pointer. (java: JNIEnv*)

Definition at line 4789 of file LibMkKernel_mk.h.

4789 {
4790 MK_INSTANCE_HDL(obj);
4791 obj->env = env;
4792 obj->self = (obj->type->noSelf ? NULL : self);
4793}
+ Here is the caller graph for this function:

◆ MkSelfUnlink_RT()

void libmkkernel::MkSelfUnlink_RT ( MK_RT mkrt,
MK_OBJ obj )

Run the MkTypeS::selfUnlink slot from the instance...

An instance has a META-part and a LNG-part, both are connected by MkObjectS::self and an LNG-specific proprietary connector. This low-level function will separate the MQpart from the LNG-part, leaving TWO independent objects.

The unlink has the following consequence:

  1. When accessing the LNG-part, a NOT-INITIALIZED-EXCEPTION is generated
  2. The MQ-part can be deleted without deleting the LNG-part
  3. Accessing the MQ-part via the LNG-code creates a new LNG-part connected to the MQ-part
Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]objthe MkObjectS instance to work on - a MANAGED OBJECT after type-check and able to be supported by the MkObjectS API
Attention
This function has only an effect if the MkTypeS::selfUnlink slot is available.
This function has only an effect if the MkObjectS::self is non MK_NULL.