MqContextC - User friendly replacement for the MqContextC_SendApi_C_API and the MqContextC_ReadApi_C_API … More...
Functions | |
MQ_EXTERN enum MkErrorE | MqSend_RT (MK_RT const mkrt, MQ_CTX const ctx, MK_STRN cstr,...) |
user friendly replacement for the MqContextC_SendApi_C_API … | |
MQ_EXTERN enum MkErrorE | MqSendVL2_RT (MK_RT const mkrt, MQ_CTX const ctx, MK_STRN cstr, va_list var_list) |
A version of MqSend with va_list support … | |
size of internal buffer to store strings for \e MqSend | |
#define | MQ_SEND_TRANSACTION_TOKEN_SIZE 10 |
#define | MQ_SEND_TOKEN_SIGNATURE_SIZE 50 |
type cast \e short to \e long | |
#define | MqHigh_O BOL |
#define | MqHigh_Y I8 |
#define | MqHigh_S I16 |
#define | MqHigh_I I32 |
#define | MqHigh_W I64 |
#define | MqHigh_H HDL |
#define | MqHigh_F FLT |
#define | MqHigh_D DBL |
#define | MqHigh_C STR |
#define | MqHigh_B BIN |
#define | MqHigh_U BUF |
#define | MqHigh_L BFL |
#define | MqHigh_A BAC |
MqContextC - MqContextC_HighApi_High_C_API - overload | |
#define | MqSend_NULL(...) |
#define | MqSend(...) |
#define | MqSend_E(...) |
#define | MqSend_C(...) |
#define | MqSendVL2_NULL(...) |
#define | MqSendVL2(...) |
#define | MqSendVL2_E(...) |
#define | MqSendVL2_C(...) |
MqContextC - User friendly replacement for the MqContextC_SendApi_C_API and the MqContextC_ReadApi_C_API …
User Friendly mean, replacing many lines of code by a single line of code.
The basic idea is, to use a format-signature to identify the additional command-line-arguments (args…).
The pseudo syntax is:
The following parts from the MqContextC_SendApi_C_API will be replaced by the MqContextC_HighApi_C_API
API Function | Usage |
---|---|
MqSendSTART | -> start a service call or a answer |
SendATOM | -> write a single argument into the data-package |
SendEND | -> send the service-call to the receiver |
ReadATOM | -> read a single argument from the data-package |
SendRETURN | -> answer a service call |
The replacement is defined by two parts, a High_CALL_SIGNATURE and a High_TOKEN_SIGNATURE. Both parts are strings and descripe a type or an action of a vararg argument.
Example: a typical code replacement in C looks like
and replaces the following commands...
The Call-Signature is a string of call-signature-char (CFC) starting with "E", "W", "C", "S" or "R" followed optional with "t"
CFC | Required | Reference | call-args | Default | Usage |
---|---|---|---|---|---|
E | yes | once | no | yes | MqSendEND |
W | yes | once | no | no | MqSendEND_AND_WAIT |
C | yes | once | function or service | no | MqSendEND_AND_CALLBACK |
S | yes | once | function or service | no | MqSendEND_AND_SUB |
T | yes | once | service-ident | no | MqSendEND_AND_TRANSACTION |
R | yes | once | no | no | MqSendRETURN |
t | no | W,S,T | seconds | MK_TIMEOUT_USER | set the TIMEOUT |
"service-ident : send-signature @ read-signature"
and is used to identify the target-service and the required arguments.
[:] and the send-signature.ASC | MkTypeE | Usage | Number of arguments required |
---|---|---|---|
"Y" | MK_I8 | MkBufferAtomU.I8 | 1 |
"O" | MK_BOL | MkBufferAtomU.BOL | 1 |
"S" | MK_I16 | MkBufferAtomU.I16 | 1 |
"I" | MK_I32 | MkBufferAtomU.I32 | 1 |
"F" | MK_FLT | MkBufferAtomU.FLT | 1 |
"W" | MK_I64 | MkBufferAtomU.I64 | 1 |
"D" | MK_DBL | MkBufferAtomU.DBL | 1 |
"G" | MK_LONG | 32bit=I, 64bit=W | 1 |
"B" | MK_BIN | MkBufferU.B | 1 -> MkBinaryR reference |
"C" | MK_STR | MkBufferU.C | 1 |
"U" | MK_BUF | MkBufferC . | 1 -> typeless Buffer able to hold every kind of data |
"L" | MK_BFL | MkBufferListC . | 1 -> list of MkBufferC . |
"." | MK_BUF | MkBufferC . | 1 -> READ ONLY - like 'U' but return the Buffer-Value and not the MkBufferC . |
"*" | MK_BFL | MkBufferListC . | 1 -> READ ONLY - like 'L' but collect ALL remaining data as ONE MkBufferListC . |
"[" | MqSendL_START | 0 -> Start of List | |
"]" | MqSendL_END | 0 -> End of List | |
"(" | MqSendT_START | 0 -> Start of Transaction Object, only as FIRST parameter | |
")" | MqSendT_END | 0 -> End of Transaction Object, only ONE supported | |
":" | END of SERVICE-IDENT | * -> next SEND_SIGNATURE | |
"@" | END of SEND-SIGN. | * -> next READ-SIGNATURE |
Example from server.c
→ in a service-call send the server-configuratien back to the client
static enum MkErrorE Ot_CNFG ( MQ_SERVICE_CALL_ARGS ) { MqSendSTART_E (mqctx); MqSendBOL_E (mqctx,MqConfigGetIsServer(mqctx)); MqSendBOL_E (mqctx,MqLinkIsParent(mqctx)); MqSendBOL_E (mqctx,MqSlaveIs(mqctx)); MqSendBOL_E (mqctx,MqConfigGetIsString(mqctx)); MqSendBOL_E (mqctx,MkRuntimeGetIsSilent()); MqSendBOL_E (mqctx,MqLinkIsConnected(mqctx)); MqSendSTR_E (mqctx,MqConfigGetName(mqctx)); MqSendI32_E (mqctx,MkRuntimeGetDebug()); MqSendI32_E (mqctx,(MK_I32)MqLinkGetCtxId(mqctx)); MqSendSTR_E (mqctx,MqServiceTokenGet(mqctx)); error: return MqSendRETURN (mqctx); }
#define MQ_SEND_TOKEN_SIGNATURE_SIZE 50 |
Definition at line 7957 of file LibMqMsgque_mq.h.
#define MQ_SEND_TRANSACTION_TOKEN_SIZE 10 |
Definition at line 7956 of file LibMqMsgque_mq.h.
#define MqHigh_A BAC |
Definition at line 7974 of file LibMqMsgque_mq.h.
#define MqHigh_B BIN |
Definition at line 7971 of file LibMqMsgque_mq.h.
#define MqHigh_C STR |
Definition at line 7970 of file LibMqMsgque_mq.h.
#define MqHigh_D DBL |
Definition at line 7969 of file LibMqMsgque_mq.h.
#define MqHigh_F FLT |
Definition at line 7968 of file LibMqMsgque_mq.h.
#define MqHigh_H HDL |
Definition at line 7967 of file LibMqMsgque_mq.h.
#define MqHigh_I I32 |
Definition at line 7965 of file LibMqMsgque_mq.h.
#define MqHigh_L BFL |
Definition at line 7973 of file LibMqMsgque_mq.h.
#define MqHigh_O BOL |
Definition at line 7962 of file LibMqMsgque_mq.h.
#define MqHigh_S I16 |
Definition at line 7964 of file LibMqMsgque_mq.h.
#define MqHigh_U BUF |
Definition at line 7972 of file LibMqMsgque_mq.h.
#define MqHigh_W I64 |
Definition at line 7966 of file LibMqMsgque_mq.h.
#define MqHigh_Y I8 |
Definition at line 7963 of file LibMqMsgque_mq.h.
#define MqSend | ( | ... | ) |
Definition at line 202 of file msgque_overload_mq.h.
#define MqSend_C | ( | ... | ) |
Definition at line 204 of file msgque_overload_mq.h.
#define MqSend_E | ( | ... | ) |
Definition at line 203 of file msgque_overload_mq.h.
#define MqSend_NULL | ( | ... | ) |
Definition at line 201 of file msgque_overload_mq.h.
#define MqSendVL2 | ( | ... | ) |
Definition at line 206 of file msgque_overload_mq.h.
#define MqSendVL2_C | ( | ... | ) |
Definition at line 208 of file msgque_overload_mq.h.
#define MqSendVL2_E | ( | ... | ) |
Definition at line 207 of file msgque_overload_mq.h.
#define MqSendVL2_NULL | ( | ... | ) |
Definition at line 205 of file msgque_overload_mq.h.
user friendly replacement for the MqContextC_SendApi_C_API …
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | ctx | the MqContextS instance to work on |
[in] | cstr | the High_CALL_SIGNATURE |
MQ_EXTERN enum MkErrorE MqSendVL2_RT | ( | MK_RT const | mkrt, |
MQ_CTX const | ctx, | ||
MK_STRN | cstr, | ||
va_list | var_list ) |
A version of MqSend with va_list support …
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | ctx | the MqContextS instance to work on |
[in] | cstr | the doc_mq_c_High_CALL_SIGNATURE |
[in] | var_list | a variable argument list object |