theKernel 10.0
Loading...
Searching...
No Matches
MkObjectC.cs
Go to the documentation of this file.
1
9/* LABEL-INIT */
10
11#define META_IS_OBJECT
12
13/* LABEL-START */
14
15using System;
16using System.Reflection;
17using System.Runtime.InteropServices;
18using System.Runtime.CompilerServices;
19using System.Collections.Generic;
20using System.Threading;
21
22namespace csmkkernel {
23
27#if META_IS_OBJECT
28 public partial class MkObjectC
29#else
30 public partial class MkObjectC : MkObjectC
31#endif
32 {
33 private readonly static ConstructorInfo ctor = getCtor(typeof(MkObjectC));
34 private readonly static ThreadLocal<MkObjectC> MK_NULL = new ThreadLocal<MkObjectC>(() => {
35 return (MkObjectC) atomSelfNull(ctor);
36 });
37
38 public static MkObjectC MkObjectC_ObjNew (IntPtr hdl) {
39 return hdl != IntPtr.Zero ? (MkObjectC) atomObjNew(typeof(MkObjectC), ctor, hdl) : MK_NULL.Value;
40 }
41
42 private static MkObjectC MkObjectC_ObjCreate (IntPtr hdl) {
43 return hdl != IntPtr.Zero ? (MkObjectC) atomObjCreate(typeof(MkObjectC), ctor, hdl) : MK_NULL.Value;
44 }
45
46 private static IntPtr MkObjectC_SelfCreate (IntPtr mkrt, IntPtr obj, IntPtr env) {
47 return atomSelfCreate(ctor, obj, env);
48 }
49
50 private static void MkObjectC_SelfUnlink (IntPtr mkrt, IntPtr self, IntPtr env) {
51 atomSelfUnlink(self, env);
52 }
53
54 internal static void SetupThreadOBJ (IntPtr mkrt) {
55 Mk.MkCsTypeUpdate(mkrt, MkCsTypeLookupE.OBJ, MkObjectC_SelfCreate, MkObjectC_SelfUnlink);
56 }
57
58 #if !META_STATIC_OVERWRITE
59
60 static MkObjectC() {
61 // M0("MkObjectC");
62 MkKernel.Setup();
63 SetupThreadOBJ(IntPtr.Zero);
64 }
65
66 #endif
67/* LABEL-END */
68
69 private IntPtr phdl = IntPtr.Zero;
70 protected IntPtr pmkrt = IntPtr.Zero;
71
72 // after "Dispose" the "hdl" becomes "unusable=NULL" but the object is still alive.
73 // goal is to raise an "Exception" on access to the "hdl" AFTER "Dispose"
74 // WITHOUT "Exception" the LibMqMsgque function will be called with a "NULL" pointer…
75 // and this will end the entire process.
76 public IntPtr hdl {
77 get {
78 if (phdl == IntPtr.Zero) throw new NullReferenceException($"'{this.GetType().Name}' hdl is NULL");
79 return phdl;
80 }
81 set {
82 phdl = value;
83 }
84 }
85
86 public IntPtr hdl_null_allow {
87 get {
88 return phdl;
89 }
90 set {
91 phdl = value;
92 }
93 }
94
95 protected IntPtr mkrt {
96 get {
97/*
98 if (pmkrt != Mk.MkRuntimeGet()) {
99 Console.Error.WriteLine($"runtime invalid: {pmkrt} != {Mk.MkRuntimeGet()}");
100 }
101*/
102 return pmkrt;
103 }
104 set {
105 pmkrt = value;
106 }
107 }
108
109 public static IntPtr getOBJ (string cls, MkObjectC obj) {
110 if (obj == null || obj.phdl == IntPtr.Zero) {
111 throw new NullReferenceException($"'{obj != null ? obj.GetType().Name : cls}' hdl is NULL");
112 }
113 return obj.phdl;
114 }
115
116 public static IntPtr getOBJ_null_allow (MkObjectC obj) {
117 if (obj == null) return IntPtr.Zero;
118 return obj.phdl;
119 }
120
121 internal protected MkObjectC (IntPtr obj) {
122 atomCreate(obj);
123 }
124
125 protected MkObjectC () {}
126
127 internal void atomCreate (IntPtr obj) {
128 if (obj == IntPtr.Zero) {
129 hdl = obj;
130 mkrt = Mk.MkRuntimeGet();
131 } else if (Mk.MkObjCheck(obj)) {
132 hdl = obj;
133 mkrt = Mk.MkRuntimeGetFromObj(obj);
134#if META_STRONG_REF
135 Mk.MkRefIncrSelf(obj, (IntPtr) GCHandle.Alloc(this), IntPtr.Zero);
136#else
137 Mk.MkRefIncrSelf(obj, (IntPtr) GCHandle.Alloc(this,GCHandleType.Weak), IntPtr.Zero);
138#endif
139 } else {
140 throw new MkSignatureExceptionC("MkObjectC");
141 }
142 }
143
144 // C# object is already dead
145 internal void atomDeleteSoft () {
146 //printStack("atomDelete");
147 //DbgSTACK();
148 IntPtr self = Mk.CsGetSelfPtr(Mk.MkObj(phdl));
149 if (self != IntPtr.Zero) {
150 var gch = GCHandle.FromIntPtr(self);
151 Mk.MkRefDecrWithoutSelf(mkrt,phdl);
152 gch.Free();
153 } else {
154 Mk.MkRefDecr(mkrt,phdl);
155 }
156 phdl = IntPtr.Zero;
157
158 // This object will be cleaned up by the Dispose method.
159 // Therefore, you should call GC.SupressFinalize to
160 // take this object off the finalization queue
161 // and prevent finalization code for this object
162 // from executing a second time.
163 GC.SuppressFinalize(this);
164 }
165
166 // C# object is still alive
167 internal void atomDeleteHard () {
168 //printStack("atomDelete");
169 //DbgSTACK();
170 IntPtr self = Mk.CsGetSelfPtr(Mk.MkObj(phdl));
171 if (self != IntPtr.Zero) {
172 var gch = GCHandle.FromIntPtr(self);
173 Mk.MkRefDecrWithUnlinkSelf(mkrt,phdl);
174 gch.Free();
175 } else {
176 Mk.MkRefDecr(mkrt,phdl);
177 }
178 phdl = IntPtr.Zero;
179
180 // This object will be cleaned up by the Dispose method.
181 // Therefore, you should call GC.SupressFinalize to
182 // take this object off the finalization queue
183 // and prevent finalization code for this object
184 // from executing a second time.
185 GC.SuppressFinalize(this);
186 }
187
188 // TODO: this is NOT the design standart because "MkSelfNew" is not used and also "selfCreate/selfDelete"
189 protected static object atomObjNew (Type type, ConstructorInfo ctor, IntPtr obj) {
190 IntPtr self = Mk.CsGetSelfPtr(obj);
191 if (self != IntPtr.Zero) {
192#if META_STRONG_REF
193 return GCHandle.FromIntPtr(self).Target;
194#else
195 object ret = GCHandle.FromIntPtr(self).Target;
196 if (ret != null) return ret;
197#endif
198 }
199 return ctor.Invoke(new Object[] {obj});
200 }
201
202 protected static object atomObjCreate (Type type, ConstructorInfo ctor, IntPtr obj) {
203//printTyp(obj, getCallerProc(3) + "-" + type.Name);
204 return ctor.Invoke(new Object[] {obj});
205 }
206
207 protected static IntPtr atomSelfCreate (ConstructorInfo ctor, IntPtr obj, IntPtr env) {
208//printTyp(obj, getCallerProc(3) + "-" + type.Name);
209 if (obj == IntPtr.Zero) {
210 return IntPtr.Zero;
211 } else {
212 ctor.Invoke(new Object[] {obj});
213 return Mk.CsGetSelfPtr(obj);
214 }
215 }
216
217 protected static object atomSelfNull (ConstructorInfo ctor) {
218//printTyp(obj, getCallerProc(3) + "-" + type.Name);
219 return ctor.Invoke(new Object[] {IntPtr.Zero});
220 }
221
222 protected static void atomSelfUnlink (IntPtr self, IntPtr env) {
223 var obj = (MkObjectC) GCHandle.FromIntPtr(self).Target;
224#if META_STRONG_REF
225 obj.hdl = IntPtr.Zero;
226#else
227 if (obj != null) obj.hdl = IntPtr.Zero;
228#endif
229 }
230
231/*
232HUGE problem that FINALIZE is called from other thread as the ORIGINAL thread created on…
233AND that left-over instances are FINALIZED !! after !! the starting thread (and the libmkkernel ressources)
234are already gone.
235
236-> don't have a finalize will propably create a memory leak.
237
238 ~MkObjectC () {
239//printTyp(hdl, "~MkObjectC");
240 Dispose(false);
241 }
242*/
243
244 protected static ConstructorInfo getCtor (Type type) {
245 Type[] types = new Type[1];
246 types[0] = typeof(IntPtr);
247 ConstructorInfo constr = type.GetConstructor(
248 BindingFlags.Instance | BindingFlags.NonPublic, null, CallingConventions.HasThis, types, null
249 );
250 if (constr == null) {
251 throw new Exception("internal constructor '" + type.Name + " (IntPtr)' not found.");
252 }
253 return constr;
254 }
255
257 protected static string Name (IntPtr mkrt, IntPtr obj) {
258 return Marshal.PtrToStringAnsi(Mk.MkObjectToName(mkrt,obj));
259 }
260
261 // PROTECTED
262
271 protected virtual void Dispose(bool disposing)
272 {
273//printStack("Dispose");
274
275 // Check to see if Dispose has already been called.
276 if(phdl != IntPtr.Zero)
277 //if(hdl != IntPtr.Zero)
278 {
279 // If disposing equals true, dispose all managed
280 // and unmanaged resources.
281 if(disposing)
282 {
283 // Dispose managed resources. (not used here)
284 }
285
286 // Call the appropriate methods to clean up
287 // unmanaged resources here.
288 // If disposing is false,
289 // only the following code is executed.
290
291 // Note disposing has been done.
292 // hint: MkRefDecr->FactoryDelete->Dispose => double-invoke
293 atomDeleteSoft();
294 }
295 }
296
297 // PUBLIC
298
299 public bool Check() {
300 return phdl != IntPtr.Zero;
301 }
302
303 // overload
304 private static IntPtr MkObjectErrorCatchTmpl (IntPtr mkrt, IntPtr hdl, Exception exception, IntPtr callfunc) {
305 return MkExceptionC.Catch(mkrt, hdl, exception, callfunc);
306 }
307
308 // overload
309 private string MkObjectToNameOfClassTmpl (IntPtr dummy) {
310 return this.GetType().Name;
311 }
312
313 private MkErrorE MkDbgDumpTmpl (IntPtr mkrt, IntPtr hdl, IntPtr message, IntPtr callfunc) {
314 return Mk.MkDbgDump(mkrt,hdl,message,callfunc);
315 }
316
318 public string ToNameOfClass () {
319 return GetType().Name;
320 }
321
322 } // END - class "MkObjectC"
323
324 // BEGIN-MkObjectC - created by 'cs_MqC.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
325
326 public partial class MkObjectC {
327
331
332 // doc-key: MkObjectC,MkObjectC-Class-Export,sc_
333
335 public static MkObjectC HandleResolve (Int32 netHdl) {
336 IntPtr __retVal__L = Mk.MkObjectHandleResolve(IntPtr.Zero, netHdl);
337 return MkObjectC.MkObjectC_ObjNew(__retVal__L);
338 }
339
340 // doc-key: MkObjectC,MkObjectC-Class-Export,om_
341
343 public void HandleDelete () {
344 Mk.MkObjectHandleDelete(mkrt, hdl);
345 }
346
348 public bool HandleExists () {
349 bool __retVal__L = Mk.MkObjectHandleExists(hdl_null_allow);
350 return __retVal__L;
351 }
352
354 public Int32 HandleGet () {
355 Int32 __retVal__L = Mk.MkObjectHandleGet(mkrt, hdl_null_allow);
356 return __retVal__L;
357 }
358
360 public Int32 HandleGetOfType () {
361 Int32 __retVal__L = Mk.MkObjectHandleGetOfType(hdl);
362 return __retVal__L;
363 }
364
366 public Int32 HandleGetOr0 () {
367 Int32 __retVal__L = Mk.MkObjectHandleGetOr0(hdl_null_allow);
368 return __retVal__L;
369 }
370
371 // doc-key: MkObjectC,MkObjectC-Class-Export,sm_
372
374 public static void HandleDeleteByNetHdl (Int32 netHdl) {
375 Mk.MkObjectHandleDeleteByNetHdl(IntPtr.Zero, netHdl);
376 }
377
379 // MkObjectC_Class_CS_API
380 }
381
382 public partial class MkObjectC {
383
387
388 // doc-key: MkObjectC,MkObjectC-Class-Introspection,oc_
389
391 public MkObjectC Next () {
392 IntPtr __retVal__L = Mk.MkObjectNext(hdl);
393 return MkObjectC.MkObjectC_ObjNew(__retVal__L);
394 }
395
397 public MkObjectC Prev () {
398 IntPtr __retVal__L = Mk.MkObjectPrev(hdl);
399 return MkObjectC.MkObjectC_ObjNew(__retVal__L);
400 }
401
402 // doc-key: MkObjectC,MkObjectC-Class-Introspection,sc_
403
405 public static MkObjectC Instances () {
406 IntPtr __retVal__L = Mk.MkObjectInstances(IntPtr.Zero);
407 return MkObjectC.MkObjectC_ObjNew(__retVal__L);
408 }
409
411 // MkObjectC_Class_CS_API
412 }
413
414 public partial class MkObjectC {
415
419
420 // doc-key: MkObjectC,MkObjectC-Class-Misc,sc_
421
423 public static MkObjectC GetNull () {
424 IntPtr __retVal__L = Mk.MkObjectGetNull();
425 return MkObjectC.MkObjectC_ObjNew(__retVal__L);
426 }
427
429 // MkObjectC_Class_CS_API
430 }
431
432 public partial class MkObjectC {
433
437
438 // doc-key: MkObjectC,MkObjectC-Dbg,om_
439
441 public void DbgDump (string message = "var", [CallerMemberName]string callfunc = null) {
442 IntPtr message_cstr = Marshal.StringToHGlobalAnsi(message);
443 IntPtr callfunc_cstr = Marshal.StringToHGlobalAnsi(callfunc);
444 MkErrorE errVal = MkDbgDumpTmpl(mkrt, hdl, message_cstr, callfunc_cstr);
445 Marshal.FreeHGlobal(message_cstr);
446 Marshal.FreeHGlobal(callfunc_cstr);
447 MkErrorC.Check(hdl, errVal);
448 }
449
451 public void DbgL (string message, int debug = 0, [CallerMemberName]string callfunc = null, int lvl = 0) {
452 if (debug > (int)(MkRuntimeC.DebugGet())) {return;}
453 IntPtr message_cstr = Marshal.StringToHGlobalAnsi(message);
454 IntPtr callfunc_cstr = Marshal.StringToHGlobalAnsi(callfunc);
455 Mk.MkDbgL(mkrt, hdl_null_allow, message_cstr, debug, callfunc_cstr, lvl);
456 Marshal.FreeHGlobal(message_cstr);
457 Marshal.FreeHGlobal(callfunc_cstr);
458 }
459
461 public void DbgLogC ([CallerMemberName]string callfunc = null) {
462 IntPtr callfunc_cstr = Marshal.StringToHGlobalAnsi(callfunc);
463 Mk.MkDbgLogC(mkrt, hdl, callfunc_cstr);
464 Marshal.FreeHGlobal(callfunc_cstr);
465 }
466
468 public void DbgO ([CallerMemberName]string callfunc = null) {
469 IntPtr callfunc_cstr = Marshal.StringToHGlobalAnsi(callfunc);
470 Mk.MkDbgO(mkrt, hdl, callfunc_cstr);
471 Marshal.FreeHGlobal(callfunc_cstr);
472 }
473
475 public void DbgSTACK (int skip = 0, int num = -1, [CallerMemberName]string callfunc = null) {
476 IntPtr callfunc_cstr = Marshal.StringToHGlobalAnsi(callfunc);
477 Mk.MkDbgSTACK(mkrt, hdl_null_allow, skip, num, callfunc_cstr);
478 Marshal.FreeHGlobal(callfunc_cstr);
479 }
480
481 // doc-key: MkObjectC,MkObjectC-Dbg,sm_
482
484 public static void DbgM (string message, int debug = 0, [CallerMemberName]string callfunc = null, int lvl = 0) {
485 if (debug > (int)(MkRuntimeC.DebugGet())) {return;}
486 IntPtr message_cstr = Marshal.StringToHGlobalAnsi(message);
487 IntPtr callfunc_cstr = Marshal.StringToHGlobalAnsi(callfunc);
488 Mk.MkDbgM(IntPtr.Zero, message_cstr, debug, callfunc_cstr, lvl);
489 Marshal.FreeHGlobal(message_cstr);
490 Marshal.FreeHGlobal(callfunc_cstr);
491 }
492
494 // MkObjectC_Dbg_CS_API
495 }
496
497 public partial class MkObjectC {
498
502
503 // doc-key: MkObjectC,MkObjectC-Log,om_
504
506 public void LogC (string message, int debug = 0, [CallerMemberName]string callfunc = null) {
507 if (debug > (int)(MkRuntimeC.DebugGet())) {return;}
508 IntPtr message_cstr = Marshal.StringToHGlobalAnsi(message);
509 IntPtr callfunc_cstr = Marshal.StringToHGlobalAnsi(callfunc);
510 Mk.MkLogC(mkrt, hdl_null_allow, message_cstr, debug, callfunc_cstr);
511 Marshal.FreeHGlobal(message_cstr);
512 Marshal.FreeHGlobal(callfunc_cstr);
513 }
514
516 public void LogHEX (string callfunc, byte[] data) {
517 IntPtr callfunc_cstr = Marshal.StringToHGlobalAnsi(callfunc);
518 var data_size = Marshal.SizeOf(data[0]) * data.Length;
519 var data_data = Marshal.AllocHGlobal(data_size);
520 Marshal.Copy(data,0,data_data,data_size);
521 Mk.MkBinaryR data_ref = Mk.MkBinaryCreate(data_size,data_data);
522 Mk.MkLogHEX(mkrt, hdl_null_allow, callfunc_cstr, data_ref);
523 Marshal.FreeHGlobal(callfunc_cstr);
524 }
525
527 public void Log (MkObjectC fmtobj = null, int debug = 0, [CallerMemberName]string callfunc = null, int lvl = 0) {
528 IntPtr fmtobj_hdl = MkObjectC.getOBJ_null_allow(fmtobj);
529 if (debug > (int)(MkRuntimeC.DebugGet())) {return;}
530 IntPtr callfunc_cstr = Marshal.StringToHGlobalAnsi(callfunc);
531 Mk.MkObjectLog(mkrt, hdl, fmtobj_hdl, debug, callfunc_cstr, lvl);
532 Marshal.FreeHGlobal(callfunc_cstr);
533 }
534
536 public void LogLong (MkObjectC fmtobj = null, int debug = 0, [CallerMemberName]string callfunc = null, int lvl = 0) {
537 IntPtr fmtobj_hdl = MkObjectC.getOBJ_null_allow(fmtobj);
538 if (debug > (int)(MkRuntimeC.DebugGet())) {return;}
539 IntPtr callfunc_cstr = Marshal.StringToHGlobalAnsi(callfunc);
540 Mk.MkObjectLogLong(mkrt, hdl, fmtobj_hdl, debug, callfunc_cstr, lvl);
541 Marshal.FreeHGlobal(callfunc_cstr);
542 }
543
545 public void LogShort (MkObjectC fmtobj = null, int debug = 0, [CallerMemberName]string callfunc = null, int lvl = 0) {
546 IntPtr fmtobj_hdl = MkObjectC.getOBJ_null_allow(fmtobj);
547 if (debug > (int)(MkRuntimeC.DebugGet())) {return;}
548 IntPtr callfunc_cstr = Marshal.StringToHGlobalAnsi(callfunc);
549 Mk.MkObjectLogShort(mkrt, hdl, fmtobj_hdl, debug, callfunc_cstr, lvl);
550 Marshal.FreeHGlobal(callfunc_cstr);
551 }
552
554 public void LogType (MkObjectC fmtobj = null, int debug = 0, [CallerMemberName]string callfunc = null, int lvl = 0) {
555 IntPtr fmtobj_hdl = MkObjectC.getOBJ_null_allow(fmtobj);
556 if (debug > (int)(MkRuntimeC.DebugGet())) {return;}
557 IntPtr callfunc_cstr = Marshal.StringToHGlobalAnsi(callfunc);
558 Mk.MkObjectLogType(mkrt, hdl, fmtobj_hdl, debug, callfunc_cstr, lvl);
559 Marshal.FreeHGlobal(callfunc_cstr);
560 }
561
563 // MkObjectC_Log_CS_API
564 }
565
566 public partial class MkObjectC {
567
571
572 // doc-key: MkObjectC,MkObjectC-Misc,oc_
573
575 public MkErrorC ErrorCatch (Exception exception = null, [CallerMemberName]string callfunc = null) {
576 IntPtr callfunc_cstr = Marshal.StringToHGlobalAnsi(callfunc);
577 IntPtr __retVal__L = MkObjectErrorCatchTmpl(mkrt, hdl, exception, callfunc_cstr);
578 Marshal.FreeHGlobal(callfunc_cstr);
579 return MkErrorC.MkErrorC_ObjNew(__retVal__L);
580 }
581
583 public MkErrorC ToError () {
584 IntPtr __retVal__L = Mk.MkObjectToError(mkrt, hdl);
585 return MkErrorC.MkErrorC_ObjNew(__retVal__L);
586 }
587
588 // doc-key: MkObjectC,MkObjectC-Misc,om_
589
591 public bool IsNull () {
592 bool __retVal__L = Mk.MkObjectIsNull(hdl_null_allow);
593 return __retVal__L;
594 }
595
597 public string ToName () {
598 IntPtr __retVal__L = Mk.MkObjectToName(mkrt, hdl_null_allow);
599 return Marshal.PtrToStringAnsi(__retVal__L);
600 }
601
604
606 public string ToNameOfType () {
607 IntPtr __retVal__L = Mk.MkObjectToNameOfType(mkrt, hdl);
608 return Marshal.PtrToStringAnsi(__retVal__L);
609 }
610
612 override public string ToString () {
613 IntPtr __retVal__L = Mk.MkObjectToString(mkrt, hdl_null_allow);
614 return Marshal.PtrToStringAnsi(__retVal__L);
615 }
616
618 // MkObjectC_Misc_CS_API
619 }
620
621 public partial class MkObjectC {
622
626
627 // doc-key: MkObjectC,MkObjectC-Obj,om_
628
630 public int RefGet () {
631 Int32 __retVal__L = Mk.MkRefGet(hdl);
632 return __retVal__L;
633 }
634
636 // MkObjectC_Obj_CS_API
637 }
638
639 public partial class MkObjectC {
640
644
645 // doc-key: MkObjectC,MkObjectC-Sys,om_
646
648 public void SysKill (int pid, int signal) {
649 MkErrorE errVal = Mk.MkSysKill(hdl_null_allow, pid, signal);
651 }
652
653 // doc-key: MkObjectC,MkObjectC-Sys,omo
654
656 public int SysGetPid () {
657 Int32 pid_out;
658 MkErrorE errVal = Mk.MkSysGetPid(hdl_null_allow, out pid_out);
660 return pid_out;
661 }
662
663 // doc-key: MkObjectC,MkObjectC-Sys,sm_
664
666 public static int SysHashI32 (string key, int length = -1) {
667 IntPtr key_cstr = Marshal.StringToHGlobalAnsi(key);
668 Int32 __retVal__L = Mk.MkSysHashI32(key_cstr, length);
669 Marshal.FreeHGlobal(key_cstr);
670 return __retVal__L;
671 }
672
674 public static string SysHashSTR (string key, int length = -1) {
675 IntPtr key_cstr = Marshal.StringToHGlobalAnsi(key);
676 IntPtr __retVal__L = Mk.MkSysHashSTR(key_cstr, length);
677 Marshal.FreeHGlobal(key_cstr);
678 return Marshal.PtrToStringAnsi(__retVal__L);
679 }
680
682 // MkObjectC_Sys_CS_API
683 }
684
685 public partial class MkObjectC {
686
690
691 // doc-key: MkObjectC,MkObjectC-TOR,od_
692
694 public void Dispose () {
695 // Do not make this method virtual. !!
696 // A derived class should not be able to override this method.
697 Dispose(true);
698
699 // This object will be cleaned up by the Dispose method.
700 // Therefore, you should call GC.SupressFinalize to
701 // take this object off the finalization queue
702 // and prevent finalization code for this object
703 // from executing a second time.
704 GC.SuppressFinalize(this);
705 }
706
707 // doc-key: MkObjectC,MkObjectC-TOR,oD_
708
710 public void Delete () {
711 // Do not make this method virtual. !!
712 // A derived class should not be able to override this method.
713 Dispose(true);
714
715 // This object will be cleaned up by the Dispose method.
716 // Therefore, you should call GC.SupressFinalize to
717 // take this object off the finalization queue
718 // and prevent finalization code for this object
719 // from executing a second time.
720 GC.SuppressFinalize(this);
721 }
722
723 // doc-key: MkObjectC,MkObjectC-TOR,sm_
724
726 public static void DeleteCallbackCleanup (string ident) {
727 IntPtr ident_cstr = Marshal.StringToHGlobalAnsi(ident);
728 Mk.MkObjectDeleteCallbackCleanup(IntPtr.Zero, ident_cstr);
729 Marshal.FreeHGlobal(ident_cstr);
730 }
731
733 public static void DeleteCallbackSetup (string ident, MkObjectDeleteSCB callback = null, string filter = null) {
734 MkObjectDeleteCallF fCall = ObjectDeleteCall;
735 IntPtr ident_cstr = Marshal.StringToHGlobalAnsi(ident);
736 IntPtr callback_ptr = callback == null ? IntPtr.Zero : (IntPtr)GCHandle.Alloc(new MkCall(callback));
737 if (callback_ptr == IntPtr.Zero) fCall = null;
738 IntPtr filter_cstr = Marshal.StringToHGlobalAnsi(filter);
739 MkErrorE errVal = Mk.MkObjectDeleteCallbackSetup(IntPtr.Zero, ident_cstr, fCall, callback_ptr, ObjectDeleteFree, filter_cstr);
740 Marshal.FreeHGlobal(ident_cstr);
741 Marshal.FreeHGlobal(filter_cstr);
742 if (errVal > MkErrorE.CONTINUE) MkErrorC.Check(errVal);
743 }
744
746 // MkObjectC_TOR_CS_API
747 }
748
749 // END-MkObjectC - created by 'cs_MqC.tcl -i NHI1_HOME/theKernel/c/gen/c_mkkernel.meta' - DO NOT change
750
751} // END - namespace "csmkkernel"
csmkkernel.MkKernel Mk
MkErrorC - the class known as err or error is used to create and manage an error message …
Definition MkErrorC.cs:498
static void Check(IntPtr ctx, MkErrorE err)
Definition MkErrorC.cs:74
static MkErrorC MkErrorC_ObjNew(IntPtr hdl)
Definition MkErrorC.cs:38
C-API: MkExceptionC_C_API - MkExceptionC - The default-exception of the Programming-Language-Micro-...
static IntPtr Catch(IntPtr mkrt, IntPtr expobj, Exception exception, IntPtr callfunc)
convert an Target-Programming-Language (TPL) exception into an MkErrorC …
MkObjectC - class known as obj or object is used as base-class type for a Programming-Language-Micro-...
static object atomObjNew(Type type, ConstructorInfo ctor, IntPtr obj)
Definition MkObjectC.cs:189
static IntPtr getOBJ_null_allow(MkObjectC obj)
Definition MkObjectC.cs:116
static object atomObjCreate(Type type, ConstructorInfo ctor, IntPtr obj)
Definition MkObjectC.cs:202
static void atomSelfUnlink(IntPtr self, IntPtr env)
Definition MkObjectC.cs:222
static string Name(IntPtr mkrt, IntPtr obj)
C#: string obj.ToName() → C-API Info-Slot - returns brief information about the obj as a string
Definition MkObjectC.cs:257
delegate void MkObjectDeleteSCB(string typeName, int typeHdl, int objHdl)
implements the csmkkernel API object: public version from MkObjectDeleteSCB as method
virtual void Dispose(bool disposing)
Support IDisposable.
Definition MkObjectC.cs:271
static object atomSelfNull(ConstructorInfo ctor)
Definition MkObjectC.cs:217
static IntPtr getOBJ(string cls, MkObjectC obj)
Definition MkObjectC.cs:109
static MkObjectC MkObjectC_ObjNew(IntPtr hdl)
Definition MkObjectC.cs:38
static ConstructorInfo getCtor(Type type)
Definition MkObjectC.cs:244
MkObjectC(IntPtr obj)
Definition MkObjectC.cs:121
static IntPtr atomSelfCreate(ConstructorInfo ctor, IntPtr obj, IntPtr env)
Definition MkObjectC.cs:207
MkRuntimeC - The class known as mkrt or runtime is the main csmkkernel application environment …
static Mk.MkBinaryR MkBinaryCreate(long size, IntPtr data)
static IntPtr MkRuntimeGet()
static Int32 MkObjectHandleGet(IntPtr mkrt, IntPtr obj)
static unsafe IntPtr CsGetSelfPtr(IntPtr hdl)
#define MK_NULL
The Programming-Language-Micro-Kernel (PLMK) NULL value as null in C# …
MkErrorE
collection for the different error-codes …
MkObjectC Prev()
C#: MkObjectC obj.Prev() → C-API get previous instance from linked-list of MkObjectS type
Definition MkObjectC.cs:397
static void HandleDeleteByNetHdl(Int32 netHdl)
C#: [static] MkObjectC.HandleDeleteByNetHdl(Int32 netHdl) → C-API Handle-Delete-Slot - delete a ...
Definition MkObjectC.cs:374
static MkObjectC GetNull()
C#: [static] MkObjectC MkObjectC.GetNull() → C-API Null-Slot - return a MkObjectC typed NULL ins...
Definition MkObjectC.cs:423
static MkObjectC Instances()
C#: [static] MkObjectC MkObjectC.Instances() → C-API get head-instance from linked-list of MkObj...
Definition MkObjectC.cs:405
MkObjectC Next()
C#: MkObjectC obj.Next() → C-API get next instance from linked-list of MkObjectS type
Definition MkObjectC.cs:391
static MkObjectC HandleResolve(Int32 netHdl)
C#: [static] MkObjectC MkObjectC.HandleResolve(Int32 netHdl) → C-API Handle-Resolve-Slot - retur...
Definition MkObjectC.cs:335
void HandleDelete()
C#: netObj.HandleDelete() → C-API Handle-Delete-Slot - delete a netObj from handle-storage …
Definition MkObjectC.cs:343
Int32 HandleGet()
C#: Int32 obj.HandleGet() → C-API Handle-Get-Slot - returns a export-hdl to the MkObjectC useab...
Definition MkObjectC.cs:354
bool HandleExists()
C#: bool obj.HandleExists() → C-API check if obj has already a handle defined…
Definition MkObjectC.cs:348
Int32 HandleGetOfType()
C#: Int32 obj.HandleGetOfType() → C-API Export-Slot - returns typeHdl of the obj .
Definition MkObjectC.cs:360
Int32 HandleGetOr0()
C#: Int32 obj.HandleGetOr0() → C-API return export-hdl or 0 in not created…
Definition MkObjectC.cs:366
void DbgL(string message, int debug=0, [CallerMemberName]string callfunc=null, int lvl=0)
C#: fmtobj.DbgL(string message, int debug = 0, [CallerMemberName]string callfunc = null,...
Definition MkObjectC.cs:451
void DbgSTACK(int skip=0, int num=-1, [CallerMemberName]string callfunc=null)
C#: fmtobj.DbgSTACK(int skip = 0, int num = -1, [CallerMemberName]string callfunc = null) → C-API ...
Definition MkObjectC.cs:475
void DbgDump(string message="var", [CallerMemberName]string callfunc=null)
C#: obj.DbgDump(string message = "var", [CallerMemberName]string callfunc = null) → C-API debug...
Definition MkObjectC.cs:441
static void DbgM(string message, int debug=0, [CallerMemberName]string callfunc=null, int lvl=0)
C#: [static] MkObjectC.DbgM(string message, int debug = 0, [CallerMemberName]string callfunc = null,...
Definition MkObjectC.cs:484
void DbgO([CallerMemberName]string callfunc=null)
C#: obj.DbgO([CallerMemberName]string callfunc = null) → C-API debug: write the object-details ...
Definition MkObjectC.cs:468
void DbgLogC([CallerMemberName]string callfunc=null)
C#: obj.DbgLogC([CallerMemberName]string callfunc = null) → C-API debug: write a short-obj-summ...
Definition MkObjectC.cs:461
void LogLong(MkObjectC fmtobj=null, int debug=0, [CallerMemberName]string callfunc=null, int lvl=0)
C#: obj.LogLong(MkObjectC fmtobj = null, int debug = 0, [CallerMemberName]string callfunc = null,...
Definition MkObjectC.cs:536
void LogC(string message, int debug=0, [CallerMemberName]string callfunc=null)
C#: fmtobj.LogC(string message, int debug = 0, [CallerMemberName]string callfunc = null) → C-API ...
Definition MkObjectC.cs:506
void LogHEX(string callfunc, byte[] data)
C#: fmtobj.LogHEX(string callfunc, byte[] data) → C-API log binaray data as HEX into the MkLogF...
Definition MkObjectC.cs:516
void LogType(MkObjectC fmtobj=null, int debug=0, [CallerMemberName]string callfunc=null, int lvl=0)
C#: obj.LogType(MkObjectC fmtobj = null, int debug = 0, [CallerMemberName]string callfunc = null,...
Definition MkObjectC.cs:554
void LogShort(MkObjectC fmtobj=null, int debug=0, [CallerMemberName]string callfunc=null, int lvl=0)
C#: obj.LogShort(MkObjectC fmtobj = null, int debug = 0, [CallerMemberName]string callfunc = null,...
Definition MkObjectC.cs:545
void Log(MkObjectC fmtobj=null, int debug=0, [CallerMemberName]string callfunc=null, int lvl=0)
C#: obj.Log(MkObjectC fmtobj = null, int debug = 0, [CallerMemberName]string callfunc = null,...
Definition MkObjectC.cs:527
MkErrorC ErrorCatch(Exception exception=null, [CallerMemberName]string callfunc=null)
C#: MkErrorC obj.ErrorCatch(Exception exception = null, [CallerMemberName]string callfunc = null) →...
Definition MkObjectC.cs:575
bool IsNull()
C#: bool obj.IsNull() → C-API ckeck if the object is null
Definition MkObjectC.cs:591
MkErrorC ToError()
C#: MkErrorC obj.ToError() → C-API Error-Slot - return an error-object pre initialized with obj...
Definition MkObjectC.cs:583
string ToNameOfType()
C#: string obj.ToNameOfType() → C-API Type-Slot - returns the LibMkKernel-Type-Name of the obj ...
Definition MkObjectC.cs:606
string ToName()
C#: string obj.ToName() → C-API Info-Slot - returns brief information about the obj as a string
Definition MkObjectC.cs:597
override string ToString()
C#: string inst.ToString() → C-API String-Slot - returns the string representation of the inst ...
Definition MkObjectC.cs:612
string ToNameOfClass()
C#: string obj.ToNameOfClass() → C-API Class-Slot - returns the C#-Class-Name of the obj as str...
Definition MkObjectC.cs:318
int RefGet()
MkRefGetP
Definition MkObjectC.cs:630
static int SysHashI32(string key, int length=-1)
MkSysHashI32
Definition MkObjectC.cs:666
int SysGetPid()
MkSysGetPid
Definition MkObjectC.cs:656
static string SysHashSTR(string key, int length=-1)
MkSysHashSTR
Definition MkObjectC.cs:674
void SysKill(int pid, int signal)
MkSysKill
Definition MkObjectC.cs:648
static void DeleteCallbackCleanup(string ident)
C#: [static] MkObjectC.DeleteCallbackCleanup(string ident) → C-API cleanup the DeleteCallback in...
Definition MkObjectC.cs:726
void Delete()
C#: [destructor] obj.Delete() → C-API Delete-Slot - delete an instance.
Definition MkObjectC.cs:710
void Dispose()
C#: [destructor] obj.Dispose() → C-API Dispose-Slot - untie the connection between the Native-C#...
Definition MkObjectC.cs:694
static void DeleteCallbackSetup(string ident, MkObjectDeleteSCB callback=null, string filter=null)
C#: [static] MkObjectC.DeleteCallbackSetup(string ident, MkObjectDeleteSCB callback = null,...
Definition MkObjectC.cs:733
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 …
static int DebugGet()
C#: [static] int MkRuntimeC.DebugGet() → C-API get the MkRuntimeS::debug value …
Definition MkRuntimeC.cs:48
MkErrorE
→ C-API: MkErrorE → C-API: MkErrorE