theLink 10.0
Loading...
Searching...
No Matches
MqCall.cs
Go to the documentation of this file.
1
9/* LABEL-NO */
10
11/*****************************************************************************/
12/* */
13/* misc */
14/* */
15/*****************************************************************************/
16
17using System;
18using System.Runtime.InteropServices;
19using csmkkernel;
20//using Mk = csmkkernel.MkKernel;
21
22namespace csmqmsgque {
23
25 public interface MqServerSetupIF {
27 }
28
30 public interface MqServerCleanupIF {
32 }
33
35 public interface MqBgErrorIF {
36 void BgError();
37 }
38
40 public interface MqEventIF {
41 void Event();
42 }
43
45 public interface MqServiceIF {
47 }
48
49 public partial class MqContextC
50 {
51
53 public delegate void MqServiceICB();
54
56 public delegate void MqServiceCCB(MqContextC ctx);
57
58 // callback struc
59 internal struct MqCall {
60 public MqServiceICB callICB;
61 public MqServiceCCB callCCB;
62 public MqServiceIF callIF;
63
64 public MqCall(IntPtr rt, MqServiceICB val) {
65 callICB = val;
66 callCCB = null;
67 callIF = null;
68 }
69
70 public MqCall(IntPtr rt, MqServiceIF val) {
71 callICB = null;
72 callCCB = null;
73 callIF = val;
74 }
75
76 public MqCall(IntPtr rt, MqServiceCCB val) {
77 callICB = null;
78 callCCB = val;
79 callIF = null;
80 }
81 }
82
83 private static MkErrorE ServiceCall (IntPtr mkrt, IntPtr hdl, IntPtr data)
84 {
85//printBool(MqS.MqObjCheck(hdl),"check:hdl");
86 if (data == IntPtr.Zero) return MkErrorE.OK;
87 MqCall dataC = (MqCall)GCHandle.FromIntPtr(data).Target;
88
89 // call the function
90 try {
91 if (dataC.callICB != null) {
92 dataC.callICB();
93 } else {
94 MqContextC self = MqContextC_ObjNewOrNull(hdl);
95 if (self == null) return MkErrorE.OK;
96
97 if (dataC.callCCB != null) {
98 dataC.callCCB(self);
99 } else {
100 dataC.callIF.Service(self);
101 }
102 }
103 } catch (Exception ex) {
104 MkErrorC.DEFAULT().ErrorCatch (ex);
105 }
106
107 // everything is OK
109/*
110 var code = Mk.CsRuntimeErrorGetCode(mkrt);
111 printVal(code,"code");
112 return code;
113*/
114 }
115
116 private static void ServiceFree (IntPtr mkrt, IntPtr hdl, ref IntPtr data) {
117 GCHandle.FromIntPtr(data).Free();
118 data = IntPtr.Zero;
119 }
120
121 } // END - class "MqContextC"
122} // END - namespace "csmqmsgque"
123
static unsafe MkErrorE CsRuntimeErrorGetCode(IntPtr mkrt)
MqContextC - the class known as ctx or context is the application-handle of the application-server an...
Definition MqHigh.cs:22
delegate void MqServiceICB()
implements the csmqmsgque API object: public version from MqTokenF as method
delegate void MqServiceCCB(MqContextC ctx)
implements the csmqmsgque API object: public version from MqTokenF as static
static MqContextC MqContextC_ObjNewOrNull(IntPtr hdl)
Definition MqContextC.cs:78
static MkErrorC DEFAULT()
MkErrorE
set the MqSetupS.BgError → C-API: ConfigSetBgError
Definition MqCall.cs:35
set the MqSetupS.Event → C-API: ConfigSetEvent
Definition MqCall.cs:40
set the MqSetupS.ServerCleanup → C-API: ConfigSetServerCleanup
Definition MqCall.cs:30
set the MqSetupS.ServerSetup → C-API: ConfigSetServerSetup
Definition MqCall.cs:25
create a link between a service-token and a service-callback … → C-API: ServiceCreate
Definition MqCall.cs:45
void Service(MqContextC ctx)