Loading...
Searching...
No Matches
MqContextC_HighApi_C_API

MqContextC - User friendly replacement for the MqContextC_SendApi_C_API and the MqContextC_ReadApi_C_APIMore...

+ Collaboration diagram for MqContextC_HighApi_C_API:

Functions

MQ_EXTERN enum MkErrorE libmqmsgque::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 libmqmsgque::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(...)
 

Detailed Description

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:

MqSend( "CALL-SIGNATUR",call-args …,"TOKEN-SIGNATURE",send-args …,read-args …);
CALL-SIGNATUR = "[E|W|C|S|T|R|t|r]" or ?call-args?
E = MqSendEND ?t-arg = 0?
S = MqSendEND_AND_SUB, c-arg, ?t-arg = MK_TIMEOUT_DEFAULT?
t = expect timeout value as t-arg in call-arg
r = switch 'rpc-flag' on to enable 'rpc' style parsing of the TOKEN-SIGNATURE
call-args = ?c-arg?, ?i-arg?, ?t-arg?
?c-arg? = callback ... function, service
?i-arg? = ident ...... MQ_TOK service-identifer to receive the result
?t-arg? = timeout .... MK_TIME_T in seconds
TOKEN-SIGNATUR = "service-ident:send-signature@read-signature"
service-ident = MQ_TOK service identifier to call a remote service
send-signature = ?(…)? or multiple [Y|O|S|I|F|W|D|G|C|B|U|L] or […]
?(…)? = only as FIRST arg, only for MqSendEND_AND_TRANSACTION
read-signature = multiple [Y|O|S|I|F|W|D|G|C|B|U|L] or . or * or […]
time_t MK_TIME_T
#define MqSend(...)
#define MqReadI64(...)
#define MqReadSTR(...)
#define MqReadI16(...)
#define MqReadDBL(...)
#define MqReadBFL(...)
#define MqReadBUF(...)
#define MqReadLONG(...)
#define MqReadI8(...)
#define MqReadBIN(...)
#define MqReadFLT(...)
#define MqReadALL(...)
#define MqReadBOL(...)
#define MqReadI32(...)
#define MqReadL_START(...)
#define MqReadL_END(...)
#define MqSendBIN(...)
#define MqSendLONG(...)
#define MqSendI8(...)
#define MqSendBOL(...)
#define MqSendI64(...)
#define MqSendI32(...)
#define MqSendBFL(...)
#define MqSendI16(...)
#define MqSendSTR(...)
#define MqSendFLT(...)
#define MqSendDBL(...)
#define MqSendBUF(...)
#define MqSendEND_AND_TRANSACTION(...)
#define MqSendEND_AND_CALLBACK(...)
#define MqSendEND_AND_SUB(...)
#define MqSendEND_AND_WAIT(...)
#define MqSendEND(...)
#define MqSendL_START(...)
#define MqSendT_END(...)
#define MqSendL_END(...)
#define MqSendT_START(...)
#define MqSendRETURN(...)
MK_STRN MQ_TOK
MqContextC - a char[4+1] or hex[8+1] string used to unique identify a service …

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

MkErrorCheck( MqSend( ctx, "Wt", 15, "SUBI:IDC@D", 5, 6.3, "HALLO", &doubleVal ) );

and replaces the following commands...

MkErrorCheck( MqSendSTART( ctx ) );
MkErrorCheck( MqSendI32( ctx, 5 ) );
MkErrorCheck( MqSendDBL( ctx, 6.3 ) );
MkErrorCheck( MqSendSTR( ctx, "HALLO" ) );
MkErrorCheck( MqSendEND_AND_WAIT( ctx, "SUBI", 15 ) );
MkErrorCheck( MqReadDBL( ctx, &doubleVal ) );
#define MqSendSTART(...)

High_CALL_SIGNATURE

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 libmkkernel::MK_TIMEOUT_USER set the TIMEOUT

High_TOKEN_SIGNATURE

  1. The token-signature has the usage "service-ident : send-signature @ read-signature" and is used to identify the target-service and the required arguments.
  2. The service-ident is identified by the libmqmsgque::MQ_TOK item followed by a [:] and the send-signature.
  3. The send-signature has one type-identifer for every send-argument. The send-argument is identified by a arg-signature-char (ASC) and is defined in MkTypeE.
  4. The MkTypeE is used in the MkBufferU and descripe the type of a vararg argument or action.
ASC MkTypeE Usage Number of arguments required
"Y" libmkkernel::MK_I8 MkBufferAtomU.I8 1
"O" libmkkernel::MK_BOL MkBufferAtomU.BOL 1
"S" libmkkernel::MK_I16 MkBufferAtomU.I16 1
"I" libmkkernel::MK_I32 MkBufferAtomU.I32 1
"F" libmkkernel::MK_FLT MkBufferAtomU.FLT 1
"W" libmkkernel::MK_I64 MkBufferAtomU.I64 1
"D" libmkkernel::MK_DBL MkBufferAtomU.DBL 1
"G" libmkkernel::MK_LONG 32bit=I, 64bit=W 1
"B" libmkkernel::MK_BIN MkBufferU.B 1 -> MkBinaryR reference
"C" libmkkernel::MK_STR MkBufferU.C 1
"U" libmkkernel::MK_BUF MkBufferC . 1 -> typeless Buffer able to hold every kind of data
"L" libmkkernel::MK_BFL MkBufferListC . 1 -> list of MkBufferC .
"." libmkkernel::MK_BUF MkBufferC . 1 -> READ ONLY - like 'U' but return the Buffer-Value and not the MkBufferC .
"*" libmkkernel::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.cc in a service-call send the server-configuratien back to the client

      void CNFG () {
	SendSTART();
	SendBOL(ConfigGetIsServer());
	SendBOL(LinkIsParent());
	SendBOL(SlaveIs());
	SendBOL(ConfigGetIsString());
	SendBOL(MkRuntimeC::GetIsSilent());
	SendBOL(LinkIsConnected());
	SendSTR(ConfigGetName());
	SendI32(MkRuntimeC::GetDebug());
	SendI32(LinkGetCtxId());
	SendSTR(ServiceTokenGet());
	SendRETURN();
      }

Macro Definition Documentation

◆ MQ_SEND_TOKEN_SIGNATURE_SIZE

#define MQ_SEND_TOKEN_SIGNATURE_SIZE   50

Definition at line 7957 of file LibMqMsgque_mq.h.

◆ MQ_SEND_TRANSACTION_TOKEN_SIZE

#define MQ_SEND_TRANSACTION_TOKEN_SIZE   10

Definition at line 7956 of file LibMqMsgque_mq.h.

◆ MqHigh_A

#define MqHigh_A   BAC

Definition at line 7974 of file LibMqMsgque_mq.h.

◆ MqHigh_B

#define MqHigh_B   BIN

Definition at line 7971 of file LibMqMsgque_mq.h.

◆ MqHigh_C

#define MqHigh_C   STR

Definition at line 7970 of file LibMqMsgque_mq.h.

◆ MqHigh_D

#define MqHigh_D   DBL

Definition at line 7969 of file LibMqMsgque_mq.h.

◆ MqHigh_F

#define MqHigh_F   FLT

Definition at line 7968 of file LibMqMsgque_mq.h.

◆ MqHigh_H

#define MqHigh_H   HDL

Definition at line 7967 of file LibMqMsgque_mq.h.

◆ MqHigh_I

#define MqHigh_I   I32

Definition at line 7965 of file LibMqMsgque_mq.h.

◆ MqHigh_L

#define MqHigh_L   BFL

Definition at line 7973 of file LibMqMsgque_mq.h.

◆ MqHigh_O

#define MqHigh_O   BOL

Definition at line 7962 of file LibMqMsgque_mq.h.

◆ MqHigh_S

#define MqHigh_S   I16

Definition at line 7964 of file LibMqMsgque_mq.h.

◆ MqHigh_U

#define MqHigh_U   BUF

Definition at line 7972 of file LibMqMsgque_mq.h.

◆ MqHigh_W

#define MqHigh_W   I64

Definition at line 7966 of file LibMqMsgque_mq.h.

◆ MqHigh_Y

#define MqHigh_Y   I8

Definition at line 7963 of file LibMqMsgque_mq.h.

◆ MqSend

#define MqSend ( ...)
Value:
MqSend_RT(MK_RT_CALL __VA_ARGS__)
#define MK_RT_CALL

Definition at line 202 of file msgque_overload_mq.h.

◆ MqSend_C

#define MqSend_C ( ...)
Value:
if (MkErrorCheckI(MqSend(__VA_ARGS__)))

Definition at line 204 of file msgque_overload_mq.h.

◆ MqSend_E

#define MqSend_E ( ...)
Value:
MkErrorCheck(MqSend(__VA_ARGS__))

Definition at line 203 of file msgque_overload_mq.h.

◆ MqSend_NULL

#define MqSend_NULL ( ...)
Value:
MqSend_RT(MK_RT_CALL_NULL __VA_ARGS__)
#define MK_RT_CALL_NULL

Definition at line 201 of file msgque_overload_mq.h.

◆ MqSendVL2

#define MqSendVL2 ( ...)
Value:
MqSendVL2_RT(MK_RT_CALL __VA_ARGS__)

Definition at line 206 of file msgque_overload_mq.h.

◆ MqSendVL2_C

#define MqSendVL2_C ( ...)
Value:
if (MkErrorCheckI(MqSendVL2(__VA_ARGS__)))
#define MqSendVL2(...)

Definition at line 208 of file msgque_overload_mq.h.

◆ MqSendVL2_E

#define MqSendVL2_E ( ...)
Value:
MkErrorCheck(MqSendVL2(__VA_ARGS__))

Definition at line 207 of file msgque_overload_mq.h.

◆ MqSendVL2_NULL

#define MqSendVL2_NULL ( ...)
Value:
MqSendVL2_RT(MK_RT_CALL_NULL __VA_ARGS__)

Definition at line 205 of file msgque_overload_mq.h.

Function Documentation

◆ MqSend_RT()

MQ_EXTERN enum MkErrorE libmqmsgque::MqSend_RT ( MK_RT const mkrt,
MQ_CTX const ctx,
MK_STRN cstr,
... )

user friendly replacement for the MqContextC_SendApi_C_API

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]ctxthe MqContextS instance to work on
[in]cstrthe High_CALL_SIGNATURE
Exceptions
MkExceptionC→ The default-exception from the Programming-Language-Micro-Kernel (PLMK)
See also
MqSendVL2

◆ MqSendVL2_RT()

MQ_EXTERN enum MkErrorE libmqmsgque::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 …

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]ctxthe MqContextS instance to work on
[in]cstrthe doc_mq_cc_High_CALL_SIGNATURE
[in]var_lista variable argument list object
See also
MqSend
+ Here is the caller graph for this function: