theLink 10.0
Loading...
Searching...
No Matches
MqContextC_ReadApi_RB_API

MqContextC - extract data from an incoming read-data-packageMore...

+ Collaboration diagram for MqContextC_ReadApi_RB_API:

Topics

 MqContextC_ReadApi_Atom_RB_API
 MqContextC - read a single-data-item outof a read-data-package
 
 MqContextC_ReadApi_Block_RB_API
 MqContextC - read a block-of-data outof a read-data-package
 
 MqContextC_ReadApi_Misc_RB_API
 MqContextC - various functions to work on a read-data-package
 

Functions

OT_ProcRet rbmqmsgque_MqContextC_ReadNEXT (MqContextC_ARGS)
  Ruby: obj ctx.ReadNEXT() C-API
get the next argument as native object …
 
OT_ProcRet rbmqmsgque_MqContextC_ReadLIST (MqContextC_ARGS)
  Ruby: [list...] ctx.ReadLIST() C-API
get all arguments as native list …
 

Detailed Description

MqContextC - extract data from an incoming read-data-package

A data-package is read in two different scenarios:

Reading data is a passive-task and the opposite of sending data, which is an active-task. Passive means that the reading process is triggered by an incoming-data-package and not by the software workflow or by the user.
There is a read function and some help functions for each basic type defined in MkBufferC .

Read-Safe
Each service-call has a private read-data-package. This means that during a service-call that is in progress, another service-call can be served without damaging the read-data-package of the current service-call.
Type-Safe
A data-item in a read-data-package is type safe, this mean that every read of a data-item have to match the data-type of the previous write. One exception is available, the cast from and to the string data-type (TYPE=C) is allowed.

Example from server.rb read-safety: Make a nested service-call

  def CSV1

    # read the input-data from the CSV1-service-call
    # client → server
    inI = ReadI32() + 1

    # call the CSV2-service at the client, wait 10sec for timeout
    # server → client → server
    retI = Send("Wt", 10, "CSV2:I@I", inI) + 1

    # answer the CSV1-service-call with the result from the CSV2-service-call
    # server → client
    Send("R", "I", retI)
  end

Function Documentation

◆ rbmqmsgque_MqContextC_ReadLIST()

OT_ProcRet rbmqmsgque_MqContextC_ReadLIST ( MqContextC_ARGS )

Ruby: [list...] ctx.ReadLIST() C-API
get all arguments as native list …

Definition at line 17 of file MqContextC_ReadLIST_lng.h.

17 {
23 MK_BUF buf = NULL;
24 while (MqReadItemExists(hdl)) {
25 MqReadBUF (hdl, &buf);
26 switch (buf->var.type) {
27 case MK_I8T: { RET = OT_TMP_I8_OBJ(MkBuf2I8(buf)); break; }
28 case MK_BOLT: { RET = OT_TMP_BOL_OBJ(MkBuf2BOL(buf)); break; }
29 case MK_I16T: { RET = OT_TMP_I16_OBJ(MkBuf2I16(buf)); break; }
30 case MK_I32T: { RET = OT_TMP_I32_OBJ(MkBuf2I32(buf)); break; }
31 case MK_FLTT: { RET = OT_TMP_FLT_OBJ(MkBuf2FLT(buf)); break; }
32 case MK_I64T: { RET = OT_TMP_I64_OBJ(MkBuf2I64(buf)); break; }
33 case MK_DBLT: { RET = OT_TMP_DBL_OBJ(MkBuf2DBL(buf)); break; }
34 case MK_BINT: { RET = OT_TMP_BIN_OBJ(buf->storage.first.B,buf->var.cursize); break; }
35 case MK_STRT: { RET = OT_TMP_STR_OBJ(buf->storage.first.C); break; }
36 case MK_LSTT: {
38 MkErrorC_Check(hdl,MkBufferGetBFL (buf, &bfl));
39 OT_MK_CALL_0(bfl,MkBufferListC,ToList,RET);
40 MkRefDecr_X(bfl);
41 break;
42 }
43/*
44 case MQ_ROUT:
45 case MQ_LTRT: {
46 OT_ERROR_TYPE("unable to convert an 'internal' object into a 'public' object");
47 RET = OT_LNG_NULL;
48 }
49*/
50 }
51 if (RET == OT_LNG_NULL) goto error;
53 }
54 goto end;
55 error:
57 end:
59}
#define OT_MK_CALL_0(obj, cls, meth, ret)
#define OT_SETUP_NOARG(d)
#define OT_TMP_DBL_OBJ(val)
#define OT_retObj_SET_Error
#define OT_retObj_SET_List
#define OT_TMP_I16_OBJ(val)
#define OT_OBJ_T
#define OT_TMP_I32_OBJ(val)
#define OT_TMP_I64_OBJ(val)
#define OT_retObj_RETURN
#define OT_TMP_BIN_OBJ(val, len)
#define OT_retObj_APPEND(var)
#define OT_TMP_STR_OBJ(val)
#define OT_TMP_I8_OBJ(val)
#define OT_LNG_NULL
#define OT_TMP_BOL_OBJ(val)
#define OT_CHECK_NOARGS
#define MkErrorC_Check(mng, PROC)
#define OT_TMP_FLT_OBJ(val)
#define OT_SETUP_hdl
#define ReadLIST_doc
#define MkBuf2I64(buf)
#define MkBuf2BOL(buf)
#define MkBuf2DBL(buf)
#define MkBuf2I8(buf)
#define MkBuf2I16(buf)
#define MkBuf2FLT(buf)
#define MkBuf2I32(buf)
#define MkBufferGetBFL(...)
#define MkBufferListCreate(...)
MK_I8T
MK_I64T
MK_FLTT
MK_BINT
MK_I16T
MK_BOLT
MK_DBLT
MK_I32T
MK_STRT
MK_LSTT
#define MkRefDecr_X(x)
#define MqReadBUF(...)
bool MqReadItemExists(MQ_CTX const ctx)
check if an item exists in the read-data-package …
goto error
Definition high_lng.h:251
union MkBufferU first
struct MkBufferS::@5 storage
struct MkBufferS::@4 var
MK_NUM cursize
enum MkTypeE type
MK_STRN C
MK_BIN B

◆ rbmqmsgque_MqContextC_ReadNEXT()

OT_ProcRet rbmqmsgque_MqContextC_ReadNEXT ( MqContextC_ARGS )

Ruby: obj ctx.ReadNEXT() C-API
get the next argument as native object …

Method definition

Definition at line 18 of file MqContextC_ReadNEXT_lng.h.

18 {
23 MK_BUF buf = NULL;
24 MqReadBUF_E(hdl, &buf);
25 switch (buf->var.type) {
26 case MK_I8T: { RET = OT_TMP_I8_OBJ(MkBuf2I8(buf)); break; }
27 case MK_BOLT: { RET = OT_TMP_BOL_OBJ(MkBuf2BOL(buf)); break; }
28 case MK_I16T: { RET = OT_TMP_I16_OBJ(MkBuf2I16(buf)); break; }
29 case MK_I32T: { RET = OT_TMP_I32_OBJ(MkBuf2I32(buf)); break; }
30 case MK_FLTT: { RET = OT_TMP_FLT_OBJ(MkBuf2FLT(buf)); break; }
31 case MK_I64T: { RET = OT_TMP_I64_OBJ(MkBuf2I64(buf)); break; }
32 case MK_DBLT: { RET = OT_TMP_DBL_OBJ(MkBuf2DBL(buf)); break; }
33 case MK_BINT: { RET = OT_TMP_BIN_OBJ(buf->storage.first.B,buf->var.cursize); break; }
34 case MK_STRT: { RET = OT_TMP_STR_OBJ(buf->storage.first.C); break; }
35 case MK_LSTT: {
37 MkErrorC_Check(hdl,MkBufferGetBFL (buf, &bfl));
38 OT_MK_CALL_0(bfl,MkBufferListC,ToList,RET);
39 MkRefDecr_X(bfl);
40 break;
41 }
42/*
43 case MQ_ROUT:
44 case MQ_LTRT: {
45 OT_ERROR_TYPE("unable to convert an 'internal' object into a 'public' object");
46 RET = OT_LNG_NULL;
47 }
48*/
49 }
50 if (RET == OT_LNG_NULL) goto error;
51 OT_retObj_SET(RET);
52 goto end;
53 error:
55 end:
57}
#define OT_retObj_SET(val)
#define ReadNEXT_doc
#define MqReadBUF_E(...)