theLink 10.0
Loading...
Searching...
No Matches
MqHigh_cc.cc
Go to the documentation of this file.
1
9/* LABEL-NO */
10
11#define META_FILE_NAME "MqHigh_cc.cc"
12
13#include "private_cc.hh"
14#include "MqCall_cc.hh"
15//#include <iostream>
16
17namespace ccmqmsgque {
18
20 MK_STRN cstr,
21 MqTokenF const fCall,
22 MK_PTR data,
23 MqDataFreeF fFree,
24 va_list ap
25 ) {
26 MK_PTR va_val = NULL;
27 MQ_CTX mqctx = getCTX();
28 MkRtSetup_XN(mqctx);
29
30#define META_CONTEXT_S mqctx
31
32#define highSELF "Send"
33
34#define highSKIP skip
35 MK_I32 skip = 3;
36#define highSKIP_SHIFT 0
37#define highSIZE 4
38
39#define highSIZE_AVAILABLE 0
40#define highREAD_RETURN_LIST 1
41#define highREAD_HAS_REFERENCE 1
42
43#define highINITcstr
44#define highCMD "%s('%s', ..., '%s', ...)"
45#define highFARGS(f) f,data,fFree
46
47#define highRETURN
48#define highRETok goto end
49
50#define highERRORnative /* c++ has long-jump */
51#define highRETerror MkExceptionC::Raise(mqctx);
52
53#define highTIME(t) t = va_arg(ap, MK_I32)
54#define highCALL(f) /* not used */
55#define highTRAN(str) strncpy(str,va_arg(ap, MK_STRN),MQ_SEND_TRANSACTION_TOKEN_SIZE)
56#define highTOKEN(str) do { \
57 MK_STRN tstr = va_arg(ap, MK_STRN); \
58 /* problem, C++ use 'va_args' and this does NOT provide any length-check */ \
59 /* Send("R") is valid but 'high' read token and get "random" data */ \
60 /* workaround 'isalnum' just check for useable character */ \
61 if (!isprint(*tstr)) goto call; /* A-Z0-9%.. */ \
62 strncpy(str,tstr,MQ_SEND_TOKEN_SIGNATURE_SIZE); \
63} while (0)
64
65#define high_N_BOL int
66#define high_N_I8 int
67#define high_N_I16 int
68#define high_N_I32 MK_I32
69#define high_N_I64 MK_I64
70#define high_N_HDL MK_HDL
71#define high_N_FLT double
72#define high_N_DBL MK_DBL
73#define high_N_STR MK_STRN
74#define high_N_BIN MK_BNP
75#define high_N_BUF MkBufferC*
76#define high_N_BFL MkBufferListC*
77
78#define high_T_BIN MK_BNP
79#define high_T_BUF MkBufferC*
80#define high_T_BFL MkBufferListC*
81#define high_T_A MkBufferListC*
82
83#define highSend(T) Send##T((high_T_##T)va_arg(ap, high_N_##T)); break
84
85#define highSend_I8 highSend(I8)
86#define highSend_BOL highSend(BOL)
87#define highSend_I16 highSend(I16)
88#define highSend_I32 highSend(I32)
89#define highSend_I64 highSend(I64)
90#define highSend_HDL highSend(HDL)
91#define highSend_FLT highSend(FLT)
92#define highSend_DBL highSend(DBL)
93#define highSend_STR highSend(STR)
94#define highSend_BUF highSend(BUF)
95#define highSend_BFL highSend(BFL)
96#define highSend_BIN highSend(BIN)
97
98#define highREADprepare
99#define highREADinit va_val = (highSKIP < highSIZE ? va_arg(ap, MK_PTR*) : NULL); \
100 if (va_val == NULL) highSKIP = highSIZE;
101
102#define ReadA ReadALL
103
104#define highReadRef(T) *(high_T_##T*)va_val = Read##T(); break;
105
106#define highReadRef_I8 highReadRef(I8)
107#define highReadRef_BOL highReadRef(BOL)
108#define highReadRef_I16 highReadRef(I16)
109#define highReadRef_I32 highReadRef(I32)
110#define highReadRef_I64 highReadRef(I64)
111#define highReadRef_HDL highReadRef(H)
112#define highReadRef_FLT highReadRef(FLT)
113#define highReadRef_DBL highReadRef(DBL)
114#define highReadRef_STR highReadRef(STR)
115#define highReadRef_BUF highReadRef(BUF)
116#define highReadRef_BFL highReadRef(BFL)
117#define highReadRef_ARGS highReadRef(A)
118#define highReadRef_BIN highReadRef(BIN)
119
120// **************************************************************************************************
121#define compile_as_cc_method
122#include "tmpl/high_lng.h"
123#undef compile_as_cc_method
124
125end:
127// **************************************************************************************************
128
129 }
130
132 MkBufferListC* ret;
133 va_list va;
134 va_start(va, cstr);
135 try {
136 ret = SendVA(cstr, NULL, NULL, NULL, va);
137 } catch (...) {
138 va_end(va);
139 throw;
140 }
141 va_end(va);
142 return ret;
143 }
144
145 MkBufferListC* MqContextC::Send (const std::string& str, ...) {
146 MkBufferListC* ret;
147 va_list va;
148 va_start(va, str);
149 try {
150 ret = SendVA(str.c_str(), NULL, NULL, NULL, va);
151 } catch (...) {
152 va_end(va);
153 throw;
154 }
155 va_end(va);
156 return ret;
157 }
158
159#define sendCB(cbt) \
160 MkBufferListC* MqContextC::Send (MK_STRN cstr, cbt const callback, ...) { \
161 MkRtSetup_O(hdl); \
162 MkBufferListC* ret; \
163 va_list va; \
164 va_start(va, callback); \
165 try { \
166 ret = SendVA(cstr, MqServiceCallbackC::Call, \
167 MqServiceCallbackC::Create(MK_RT_CALL callback), MqServiceCallbackC::Free, va); \
168 } catch (...) { \
169 va_end(va); \
170 throw; \
171 } \
172 va_end(va); \
173 return ret; \
174 } \
175 MkBufferListC* MqContextC::Send (const std::string& str, cbt const callback, ...) { \
176 MkRtSetup_O(hdl); \
177 MkBufferListC* ret; \
178 va_list va; \
179 va_start(va, callback); \
180 try { \
181 ret = SendVA(str.c_str(), MqServiceCallbackC::Call, \
182 MqServiceCallbackC::Create(MK_RT_CALL callback), MqServiceCallbackC::Free, va); \
183 } catch (...) { \
184 va_end(va); \
185 throw; \
186 } \
187 va_end(va); \
188 return ret; \
189 }
190
191 sendCB(MqTokenICB)
192 sendCB(MqTokenCCB)
194
195} // END - namespace "ccmqmsgque"
tag: nhi1-release-250425
#define sendCB(cbt)
Definition MqHigh_cc.cc:159
MkBufferListC(MK_BFL hdl)
static MkBufferListC * MkBufferListC_ObjNew(MK_RT_ARGS MK_BFL hdl)
signed int MK_I32
MK_PTRB * MK_PTR
const MK_STRB * MK_STRN
#define MkRtSetup_XN(x)
#define MK_RT_CALL
MQ_CTX getCTX() const
return the LibMsgqueObject from current MqContextC instance
struct MqContextS * MQ_CTX
class-shortcut for struct MqContextS *, all shortcut using the XX_YYY syntax (only for public API) …
enum MkErrorE(* MqTokenF)(MQ_SERVICE_CALL_ARGS)
prototype for an object method function …
void(* MqDataFreeF)(MQ_SERVICE_FREE_ARGS)
prototype for a free additional token data function …
MkBufferListC * Send(MK_STRN cstr,...)
C++: ctx.Send(MK_STRN cstr, ... ) → C-API user friendly replacement for the MqContextC_SendApi_...
Definition MqHigh_cc.cc:131
MkBufferListC * SendVA(MK_STRN cstr, MqTokenF const fCall, MK_PTR data, MqDataFreeF fFree, va_list ap)
namespace for the CcMqMsgque "C++"-API
MqServiceIF MqServiceIF