theKernel 10.0 NHI1 - theKernel - theLink - theConfig - theSq3Lite - theCompiler - theBrain - theGuard
c - tcl - py - jv - cc
Loading...
Searching...
No Matches
MkObjectC_Obj_C_API

MkObjectC - managed-object details More...

+ Collaboration diagram for MkObjectC_Obj_C_API:

Functions

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

MkSelf

typedef void(* MkSelfIncrF) (MK_RT const mkrt, MK_PTR self, MK_PTR const env)
 
typedef void(* MkSelfDecrF) (MK_RT const mkrt, MK_PTR self, MK_PTR const env)
 
 MK_ATTR_HDL
 
void MkSelfSet (MK_OBJ const obj, MK_PTR const self, MK_PTR const env)
 set the MkObjectS::self value
 
MK_PTR MkSelfGet (MK_OBJ const obj)
 get the MkObjectS::self value
 
mk_attr_hot enum MkErrorE MkSelfNew_RT (MK_RT const mkrt, MK_OBJ obj, MK_PTR *self_out, MK_PTR const env)
 return the self pointer for a given obj
 
MK_EXTERN MK_PTR MkSelfCreate_RT (MK_RT const mkrt, MK_OBJ const obj, MK_PTR const env) MK_RT_ATTR_HDL
 create the MkObjectS::self value
 
MK_EXTERN bool MkSelfDelete_RT (MK_RT const mkrt, MK_OBJ const obj) MK_RT_ATTR_HDL
 delete the MkObjectS::self value
 
MK_EXTERN bool MkSelfDeleteForce_RT (MK_RT const mkrt, MK_OBJ obj) MK_RT_ATTR_HDL
 force delete an instance, last step in instance-destructor
 
MK_EXTERN void MkSelfUnlink_RT (MK_RT const mkrt, MK_OBJ obj) MK_RT_ATTR_HDL
 Run the MkTypeS::selfUnlink slot from the instance...
 
#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)
 

MkRef…

reference management functions

void MkRefIncr (MK_OBJ obj)
 increment the reference-count
 
MK_EXTERN void MkRefDecr_RT (MK_RT const mkrt, MK_OBJ obj) MK_RT_ATTR_HDL
 decrement the reference-count
 
MK_ATTR_HDL void MkRefIncrSelf (MK_OBJ const obj, MK_PTR const self, MK_PTR const env)
 ATOMIC operation -> link self with reference-count.
 
MK_EXTERN MK_OBJ MkRefDecrWithoutSelf_RT (MK_RT const mkrt, MK_OBJ const obj) MK_RT_ATTR_HDL
 ATOMIC operation -> unlink self with reference-count.
 
MK_ATTR_HDL MK_I32 MkRefGet (MK_OBJ const obj)
 get the reference-count
 
MK_ATTR_HDL MK_I32 MkRefLock (MK_OBJ const obj)
 lock the object
 
MK_ATTR_HDL bool MkRefIsLocked (MK_OBJ const obj)
 check if object is locked
 
MK_EXTERN MK_NUM MkRefCidN_RT (MK_RT_PARSER_ONLY)
 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 - function

MK_EXTERN MK_I32 MkRefGetP (MK_OBJ const obj)
 Non-inline replacement for MkRefGet
 
MK_EXTERN void MkRefIncrSelfP (MK_OBJ const obj, MK_PTR const self, MK_PTR const env)
 Non-inline replacement for MkRefIncrSelf
 
MK_EXTERN MK_BOOL MkRefIsLockedP (MK_OBJ const obj)
 Non-inline replacement for MkRefIsLocked
 
MK_EXTERN MK_I32 MkRefLockP (MK_OBJ const obj)
 Non-inline replacement for MkRefLock
 
MK_EXTERN MK_PTR MkSelfGetP (MK_OBJ const obj)
 Non-inline replacement for MkSelfGet
 
MK_EXTERN void MkSelfSetP (MK_OBJ const obj, MK_PTR const self, MK_PTR const env)
 Non-inline replacement for MkSelfSet
 
MK_EXTERN enum MkErrorE MkSelfNewP (MK_RT const mkrt, MK_OBJ obj, MK_PTR *self_out, MK_PTR const env)
 Non-inline replacement for MkSelfNew
 
MK_EXTERN void MkRefIncrP (MK_OBJ obj)
 Non-inline replacement for MkRefIncr
 

MkObjectC - MkObjectC_Obj_C_API - overload

#define MkRefCidN_NULL()
 
#define MkObjCopy_NULL(...)
 
#define MkObjCopy(...)
 
#define MkRefDecrWithoutSelf_NULL(...)
 
#define MkRefDecrWithoutSelf(...)
 
#define MkObjReset_NULL(...)
 
#define MkObjReset(...)
 
#define MkSelfNew_NULL(...)
 
#define MkSelfNew(...)
 
#define MkSelfNew_E(...)
 
#define MkSelfNew_C(...)
 
#define MkRefCidN_NULL()
 
#define MkRefCidN()
 
#define MkRefDecr_NULL(...)
 
#define MkRefDecr(...)
 
#define MkSelfCreate_NULL(...)
 
#define MkSelfCreate(...)
 
#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:
MK_EXTERN MK_OBJ MkObjCopy_RT(MK_RT const mkrt, MK_OBJ const tgtmng, MK_OBJN const srcmng) MK_RT_ATTR_HDL
call the copy from the object
#define MK_RT_CALL

Definition at line 1578 of file kernel_overload_mk.h.

◆ MkObjCopy_NULL

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

Definition at line 1577 of file kernel_overload_mk.h.

◆ MkObjReset

#define MkObjReset ( ...)
Value:
MK_EXTERN void MkObjReset_RT(MK_RT const mkrt, MK_OBJ const obj) MK_RT_ATTR_HDL
free the internal memory of an object and initialize the local variables to default values

Definition at line 1584 of file kernel_overload_mk.h.

◆ MkObjReset_NULL

#define MkObjReset_NULL ( ...)
Value:

Definition at line 1583 of file kernel_overload_mk.h.

◆ MkRefCidN

#define MkRefCidN ( )
Value:
MK_EXTERN MK_NUM MkRefCidN_RT(MK_RT_PARSER_ONLY)
return the reference-count-recursion-level
#define MK_RT_CALL_ONLY

Definition at line 1594 of file kernel_overload_mk.h.

◆ MkRefCidN_NULL [1/2]

#define MkRefCidN_NULL ( )
Value:

Definition at line 1593 of file kernel_overload_mk.h.

◆ MkRefCidN_NULL [2/2]

#define MkRefCidN_NULL ( )
Value:

Definition at line 4320 of file LibMkKernel_mk.h.

◆ MkRefDecr

#define MkRefDecr ( ...)
Value:
MK_EXTERN void MkRefDecr_RT(MK_RT const mkrt, MK_OBJ obj) MK_RT_ATTR_HDL
decrement the reference-count

Definition at line 1596 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 4236 of file LibMkKernel_mk.h.

◆ MkRefDecr_M

#define MkRefDecr_M ( m)
Value:
do { MkRefDecr_RT(MK_RT_CALL MkObj(m)); m=NULL; } while (0)
MK_OBJ MkObj(MK_MNG mng)
cast a unknown-object into an MkObjectS pointer or NULL if not possible

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 4231 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 4233 of file LibMkKernel_mk.h.

◆ MkRefDecr_NULL

#define MkRefDecr_NULL ( ...)
Value:

Definition at line 1595 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 4220 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 4224 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 4226 of file LibMkKernel_mk.h.

◆ MkRefDecrWithoutSelf

#define MkRefDecrWithoutSelf ( ...)
Value:
MK_EXTERN MK_OBJ MkRefDecrWithoutSelf_RT(MK_RT const mkrt, MK_OBJ const obj) MK_RT_ATTR_HDL
ATOMIC operation -> unlink self with reference-count.

Definition at line 1580 of file kernel_overload_mk.h.

◆ MkRefDecrWithoutSelf_NULL

#define MkRefDecrWithoutSelf_NULL ( ...)
Value:

Definition at line 1579 of file kernel_overload_mk.h.

◆ MkRefGet_1X

#define MkRefGet_1X ( x)
Value:
MK_ATTR_HDL MK_I32 MkRefGet(MK_OBJ const obj)
get the reference-count

Definition at line 4285 of file LibMkKernel_mk.h.

◆ MkRefIncr_1M

#define MkRefIncr_1M ( m)
Value:
void MkRefIncr(MK_OBJ obj)
increment the reference-count

Definition at line 4186 of file LibMkKernel_mk.h.

◆ MkRefIncr_1X

#define MkRefIncr_1X ( x)
Value:

Definition at line 4185 of file LibMkKernel_mk.h.

◆ MkRefIncr_FX

#define MkRefIncr_FX ( x)
Value:

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 4201 of file LibMkKernel_mk.h.

◆ MkRefIncrSelf_2X

#define MkRefIncrSelf_2X ( x,
s )
Value:
MK_ATTR_HDL void MkRefIncrSelf(MK_OBJ const obj, MK_PTR const self, MK_PTR const env)
ATOMIC operation -> link self with reference-count.

Definition at line 4253 of file LibMkKernel_mk.h.

◆ MkRefIsLocked_1X

#define MkRefIsLocked_1X ( x)
Value:
MK_ATTR_HDL bool MkRefIsLocked(MK_OBJ const obj)
check if object is locked

Definition at line 4304 of file LibMkKernel_mk.h.

◆ MkRefLOCK

#define MkRefLOCK   999999

unchangeable reference

Definition at line 4176 of file LibMkKernel_mk.h.

◆ MkRefLock_1X

#define MkRefLock_1X ( x)
Value:
MK_ATTR_HDL MK_I32 MkRefLock(MK_OBJ const obj)
lock the object

Definition at line 4294 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 4307 of file LibMkKernel_mk.h.

4307#define MkRefSet(target,source) ({ \
4308 if (target != source) { \
4309 typeof(target) targetSave=target; \
4310 target = source;\
4311 MkRefDecr_X(targetSave);\
4312 MkRefIncr_1X(target);\
4313 } \
4314 target;\
4315})

◆ MkSelfCreate

#define MkSelfCreate ( ...)
Value:
MK_EXTERN MK_PTR MkSelfCreate_RT(MK_RT const mkrt, MK_OBJ const obj, MK_PTR const env) MK_RT_ATTR_HDL
create the MkObjectS::self value

Definition at line 1598 of file kernel_overload_mk.h.

◆ MkSelfCreate_2X

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

Definition at line 4406 of file LibMkKernel_mk.h.

◆ MkSelfCreate_NULL

#define MkSelfCreate_NULL ( ...)
Value:

Definition at line 1597 of file kernel_overload_mk.h.

◆ MkSelfDelete

#define MkSelfDelete ( ...)
Value:
MK_EXTERN bool MkSelfDelete_RT(MK_RT const mkrt, MK_OBJ const obj) MK_RT_ATTR_HDL
delete the MkObjectS::self value

Definition at line 1600 of file kernel_overload_mk.h.

◆ MkSelfDelete_1X

#define MkSelfDelete_1X ( x)
Value:

Definition at line 4422 of file LibMkKernel_mk.h.

◆ MkSelfDelete_NULL

#define MkSelfDelete_NULL ( ...)
Value:

Definition at line 1599 of file kernel_overload_mk.h.

◆ MkSelfDeleteForce

#define MkSelfDeleteForce ( ...)
Value:
MK_EXTERN bool MkSelfDeleteForce_RT(MK_RT const mkrt, MK_OBJ obj) MK_RT_ATTR_HDL
force delete an instance, last step in instance-destructor

Definition at line 1602 of file kernel_overload_mk.h.

◆ MkSelfDeleteForce_1X

#define MkSelfDeleteForce_1X ( x)
Value:

Definition at line 4446 of file LibMkKernel_mk.h.

◆ MkSelfDeleteForce_NULL

#define MkSelfDeleteForce_NULL ( ...)
Value:

Definition at line 1601 of file kernel_overload_mk.h.

◆ MkSelfGet_1X

#define MkSelfGet_1X ( x)
Value:
MK_PTR MkSelfGet(MK_OBJ const obj)
get the MkObjectS::self value

Definition at line 4356 of file LibMkKernel_mk.h.

◆ MkSelfNew

#define MkSelfNew ( ...)
Value:
mk_attr_hot enum MkErrorE MkSelfNew_RT(MK_RT const mkrt, MK_OBJ obj, MK_PTR *self_out, MK_PTR const env)
return the self pointer for a given obj …

Definition at line 1588 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 4389 of file LibMkKernel_mk.h.

◆ MkSelfNew_C

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

Definition at line 1590 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 1589 of file kernel_overload_mk.h.

◆ MkSelfNew_NULL

#define MkSelfNew_NULL ( ...)
Value:

Definition at line 1587 of file kernel_overload_mk.h.

◆ MkSelfSet_3X

#define MkSelfSet_3X ( x,
self,
env )
Value:
MkSelfSet(MkOBJ(x),self,env)
void MkSelfSet(MK_OBJ const obj, MK_PTR const self, MK_PTR const env)
set the MkObjectS::self value

Definition at line 4346 of file LibMkKernel_mk.h.

◆ MkSelfUnlink

#define MkSelfUnlink ( ...)
Value:
MK_EXTERN void MkSelfUnlink_RT(MK_RT const mkrt, MK_OBJ obj) MK_RT_ATTR_HDL
Run the MkTypeS::selfUnlink slot from the instance...

Definition at line 1604 of file kernel_overload_mk.h.

◆ MkSelfUnlink_1X

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

Definition at line 4470 of file LibMkKernel_mk.h.

◆ MkSelfUnlink_NULL

#define MkSelfUnlink_NULL ( ...)
Value:

Definition at line 1603 of file kernel_overload_mk.h.

Typedef Documentation

◆ MkSelfDecrF

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

Definition at line 4334 of file LibMkKernel_mk.h.

◆ MkSelfIncrF

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

Definition at line 4333 of file LibMkKernel_mk.h.

Function Documentation

◆ MkObjCopy_RT()

MK_EXTERN MK_OBJ MkObjCopy_RT ( MK_RT const 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
MkObjDup_RT MkObjReset_RT

◆ MkObjReset_RT()

MK_EXTERN void MkObjReset_RT ( MK_RT const mkrt,
MK_OBJ const obj )

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

See also
MkObjDup_RT MkObjMerge_RT

◆ MkRefCidN_RT()

return the reference-count-recursion-level

◆ MkRefDecr_RT()

MK_EXTERN void MkRefDecr_RT ( MK_RT const 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_EXTERN MK_OBJ MkRefDecrWithoutSelf_RT ( MK_RT const 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 libmkkernel 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

◆ MkRefGet()

MK_ATTR_HDL MK_I32 MkRefGet ( MK_OBJ const obj)
inline

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 4280 of file LibMkKernel_mk.h.

4280 {
4281 MK_ATTR_HDL_CHECK(obj);
4282 return (*obj).refCount;
4283}
#define MK_ATTR_HDL_CHECK(x)
+ Here is the caller graph for this function:

◆ MkRefGetP()

MK_EXTERN MK_I32 MkRefGetP ( MK_OBJ const obj)

Non-inline replacement for MkRefGet

◆ MkRefIncr()

void MkRefIncr ( MK_OBJ obj)
inline

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 4181 of file LibMkKernel_mk.h.

4181 {
4182 if (obj) ++(*obj).refCount;
4183}

◆ MkRefIncrP()

MK_EXTERN void MkRefIncrP ( MK_OBJ obj)

Non-inline replacement for MkRefIncr

◆ MkRefIncrSelf()

MK_ATTR_HDL void MkRefIncrSelf ( MK_OBJ const obj,
MK_PTR const self,
MK_PTR const env )
inline

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 libmkkernel pointer.
[in]envstorage for an application specific environment pointer. (java: JNIEnv*)
See also
MkRefIncr MkSelfSet MkRefDecrWithoutSelf

Definition at line 4246 of file LibMkKernel_mk.h.

4246 {
4247 MK_ATTR_HDL_CHECK(obj);
4248 obj->refCount++;
4249 obj->self = self;
4250 obj->env = env;
4251}

◆ MkRefIncrSelfP()

MK_EXTERN void MkRefIncrSelfP ( MK_OBJ const obj,
MK_PTR const self,
MK_PTR const env )

Non-inline replacement for MkRefIncrSelf

◆ MkRefIsLocked()

MK_ATTR_HDL bool MkRefIsLocked ( MK_OBJ const obj)
inline

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 4300 of file LibMkKernel_mk.h.

4300 {
4301 MK_ATTR_HDL_CHECK(obj);
4302 return (*obj).refCount >= MkRefLOCK;
4303}
#define MkRefLOCK
unchangeable reference

◆ MkRefIsLockedP()

MK_EXTERN MK_BOOL MkRefIsLockedP ( MK_OBJ const obj)

Non-inline replacement for MkRefIsLocked

◆ MkRefLock()

MK_ATTR_HDL MK_I32 MkRefLock ( MK_OBJ const obj)
inline

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 4290 of file LibMkKernel_mk.h.

4290 {
4291 MK_ATTR_HDL_CHECK(obj);
4292 return (*obj).refCount=MkRefLOCK;
4293}

◆ MkRefLockP()

MK_EXTERN MK_I32 MkRefLockP ( MK_OBJ const obj)

Non-inline replacement for MkRefLock

◆ MkSelfCreate_RT()

MK_EXTERN MK_PTR MkSelfCreate_RT ( MK_RT const 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

◆ MkSelfDelete_RT()

MK_EXTERN bool MkSelfDelete_RT ( MK_RT const 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()

MK_EXTERN bool MkSelfDeleteForce_RT ( MK_RT const 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
MK_YES if instance is global or was already deleted and MK_NO if local

◆ MkSelfGet()

MK_PTR MkSelfGet ( MK_OBJ const obj)
inline

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 4351 of file LibMkKernel_mk.h.

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

◆ MkSelfGetP()

MK_EXTERN MK_PTR MkSelfGetP ( MK_OBJ const obj)

Non-inline replacement for MkSelfGet

◆ MkSelfNew_RT()

enum MkErrorE MkSelfNew_RT ( MK_RT const mkrt,
MK_OBJ obj,
MK_PTR * self_out,
MK_PTR const env )
inline

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 MK_YES the self is returned and if MK_NO 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 libmkkernel 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 12511 of file LibMkKernel_mk.h.

12516 {
12517 if (obj == NULL) {
12518 *self_out = NULL;
12519 return MK_OK;
12520 }
12521 MkRtSetup_ON_RT(obj);
12522
12523 enum MkErrorE ret = MK_OK;
12524 MK_PTR self = MkSelfGet(obj);
12525 if (self != NULL) {
12526 if (MkRefGet(obj) <= 0) {
12527 MkErrorSetV_2M(obj, "RefCount Error: object '%s' has 'self' but 'refCout <= 0", obj->type->type_name);
12528 goto error;
12529 } else {
12530 ret = MK_CONTINUE;
12531 if (MK_RT_REF.MkSelfIncrOnCacheB && MK_RT_REF.fSelfIncr) (*MK_RT_REF.fSelfIncr)(MK_RT_CALL self, env);
12532 goto end;
12533 }
12534 }
12535 self = MkSelfCreate(obj, env);
12536 if (self == NULL) {
12537 MkErrorSetV_2M(obj, "Error: '%s->SelfCreate' return a NULL pointer", obj->type->type_name);
12538 goto error;
12539 }
12540end:
12541 *self_out = self;
12542 return ret;
12543error:
12544 *self_out = NULL;
12545 return MK_ERROR;
12546}
#define MkErrorSetV_2M(err, printfmt,...)
MkErrorE
collection for the different error-codes …
@ MK_ERROR
(persistent) raise an error-event, the calling-fucntion is interrupted.
@ MK_CONTINUE
(transient) raise an continue-event, the calling-function must handle this.
@ MK_OK
(persistent) everything is OK.
MK_PTRB * MK_PTR
generic pointer data-type
#define MkRtSetup_ON_RT(o)
#define MK_RT_REF
MK_TYP type
link to the object type
MK_STRB type_name[MkTypeS_name_size]
public type name like MkBufferC

◆ MkSelfNewP()

MK_EXTERN enum MkErrorE MkSelfNewP ( MK_RT const mkrt,
MK_OBJ obj,
MK_PTR * self_out,
MK_PTR const env )

Non-inline replacement for MkSelfNew

◆ MkSelfSet()

void MkSelfSet ( MK_OBJ const obj,
MK_PTR const self,
MK_PTR const env )
inline

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 4340 of file LibMkKernel_mk.h.

4340 {
4342 obj->env = env;
4343 obj->self = (obj->type->noSelf ? NULL : self);
4344} MK_ATTR_HDL ;
#define MK_ATTR_HDL
#define MK_RT_ATTR_HDL_CHECK(x)

◆ MkSelfSetP()

MK_EXTERN void MkSelfSetP ( MK_OBJ const obj,
MK_PTR const self,
MK_PTR const env )

Non-inline replacement for MkSelfSet

◆ MkSelfUnlink_RT()

MK_EXTERN void MkSelfUnlink_RT ( MK_RT const mkrt,
MK_OBJ obj )

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

An instance has an MQ-part and an 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

Variable Documentation

◆ MK_ATTR_HDL

MK_ATTR_HDL

Definition at line 4344 of file LibMkKernel_mk.h.