Loading...
Searching...
No Matches
MqContextC_High_CC_API

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

+ Collaboration diagram for MqContextC_High_CC_API:

Functions

void ccmqmsgque::MqContextC::SendVL2 (MK_STRN cstr, va_list var_list)
  C++: ctx.SendVL2(MK_STRN cstr, va_list var_list) C-API
A version of MqSend with va_list support …
 
void ccmqmsgque::MqContextC::SendVL2 (const std::string &cstr, va_list var_list)
  C++: ctx.SendVL2(MK_STRN cstr, va_list var_list) C-API
A version of MqSend with va_list support …
 

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();
      }

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 […]

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 ) );

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();
      }

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 […]

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 ) );

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();
      }

Function Documentation

◆ SendVL2() [1/2]

void ccmqmsgque::MqContextC::SendVL2 ( const std::string & cstr,
va_list var_list )
inline

C++: ctx.SendVL2(MK_STRN cstr, va_list var_list) C-API
A version of MqSend with va_list support …

Definition at line 810 of file MqContextC_inline_cc.hh.

810 {
811 MK_UNUSED auto ctx = getCTX(MK_NULL_NO);
812 MkRtSetup_X(ctx);
813 const MK_STRN cstr_hdl = cstr.c_str();
814 enum MkErrorE errVal = MqSendVL2(ctx, cstr_hdl, var_list);
815 MkErrorC_Check(ctx, errVal);
816 }
#define MK_NULL_NO
#define MK_UNUSED
const MK_STRB * MK_STRN
#define MkRtSetup_X(x)
MQ_CTX getCTX(bool nullB=MK_NULL_NO) const
return the LibMsgqueObject from current MqContextC instance
#define MqSendVL2(...)

◆ SendVL2() [2/2]

void ccmqmsgque::MqContextC::SendVL2 ( MK_STRN cstr,
va_list var_list )
inline

C++: ctx.SendVL2(MK_STRN cstr, va_list var_list) C-API
A version of MqSend with va_list support …

Definition at line 802 of file MqContextC_inline_cc.hh.

802 {
803 MK_UNUSED auto ctx = getCTX(MK_NULL_NO);
804 MkRtSetup_X(ctx);
805 enum MkErrorE errVal = MqSendVL2(ctx, cstr, var_list);
806 MkErrorC_Check(ctx, errVal);
807 }