libmkkernel 9.0
Loading...
Searching...
No Matches
Modules | Data Structures
MkBufferC_C_API

The MkBufferC object known as buf or buffer is used to create and manage dynamic, generic, mixed typed data. … More...

+ Collaboration diagram for MkBufferC_C_API:

Modules

 MkBuffer64C
 The ABSTRACT-CLASS used to store a native-type-data-item defined by PRIMITIVE TYPE
 
 MkBuffer256C
 The ABSTRACT-CLASS used to store a native-type-data-item defined by PRIMITIVE TYPE
 
 MkBuffer1024C
 The ABSTRACT-CLASS used to store a native-type-data-item defined by PRIMITIVE TYPE
 
 MkBufferC_TOR_C_API
 various functions to create, initialize and destroy a MkBufferC
 
 MkBufferC_Get_C_API
 various functions to get buffer-data
 
 MkBufferC_Set_C_API
 various functions to set buffer-data
 
 MkBufferC_Info_C_API
 various functions to get information out of buffer-data
 
 MkBufferC_Access_C_API
 various functions to access buffer-data
 
 MkBufferC_Misc_C_API
 various functions to work on buffer-data
 
 MkBufferC_Introspection_C_API
 Get information from the MkTypeS.
 
 MkBufferC_Cast_C_API
 cast from defined and undefined instance to MkBufferC
 
 MkKernel_String_C_API
 Function used to convert a string into a native type… .
 

Data Structures

struct  MkBufferS
 The ABSTRACT-CLASS used to store a native-type-data-item defined by PRIMITIVE TYPEMore...
 

MkBufferC


typedef struct MkBufferSMK_BUF
 class-shortcut for struct MkBufferS *, all shortcut using the XX_YYY syntax (only for public API) …
 
typedef const struct MkBufferSMK_BUFN
 class-shortcut for const struct MkBufferS *, all const shortcut using the XX_YYYC syntax (only for public API) …
 
typedef struct MkBufferS MK_BUFR
 reference-shortcut for struct MkBufferS, all shortcut using the XX_YYYR syntax (only for public API) …
 

MkBufferC type definition

typedef struct MkBufferS MkBufferCR
 instance-struct-reference same as struct MkBufferS, useable in a class-macro as: class##R
 
typedef const struct MkBufferS MkBufferCNR
 const instance-struct-reference same as const struct MkBufferS, useable in a class-macro as: class##R
 
#define MkBufferC_T   (&MK_RT_REF._MkBufferC_T)
 instance-type as specific-instance-type, useable in a class-macro as: class##_T
 
#define MkBufferC_TT   (MkTYP(MkBufferC_T))
 instance-type as common-instance-type, useable in a class-macro as: class##_TT
 
#define MkBufferST   MkBufferC_T
 instance-type as specific-instance-type
 
#define MkBufferSTT   (MkTYP(MkBufferST))
 instance-type as common-instance-type (cast from MkBufferST into MkTypeS) …
 
#define MkBufferC_type   MK_BUF
 same as MkBufferS but useable in a class-macro as: class##_type
 
#define MkBufferCT_X(instance)   ( (struct MkDefTypeS *) (MkOBJ_R(instance).type) )
 cast from an instance into the specific-instance-type
 
#define MkBufferCTT_X(instance)   (MkOBJ_R(instance).type)
 cast from an instance into the common-instance-type
 
#define MkBufferCT_TT(typ)   ( (struct MkDefTypeS *) (typ) )
 cast from an common-instance-type into an specific-instance-type
 
#define MkBufferC_NS   MK
 map class to namespace …
 
#define MkBufferCTT   MkBufferCTT
 instance-type as common-instance-type for MkBufferC in the target-programming-language (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO)
 
#define MkBufferCT   ( (struct MkDefTypeS *) MkBufferCTT )
 instance-type as specific-instance-type for MkBufferC in the target-programming-language (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO)
 

MkBufferC signature check

bool MkBufCheck (MK_MNGN mng)
 check MkBufferS%->Mk{ObjectS::signature} …
 
#define MkBufferC_Check(mng)   MkBufCheck(mng)
 

MkBufferC signature define

#define MkBufferC_SIGNATURE   (MkObjectC_SIGNATURE ^ (1u<<10))
 
#define MkBufferC_MASK   (((1u<<22)-1)<<10)
 

MkBufferC cast to superclass

#define MkBufferC_X2buf(x)   (x)
 
#define MkBufferC_X2obj(x)   MkOBJ(x)
 

MkBuf2TTfast

get a native PRIMITIVE TYPE from a MkBufferC

Attention
these function is only required in an non-alignment environment …
#define MkBuf2XXXfast(buf)   (*(buf)->storage.first.A)
 
#define MkBuf2BOLfast(buf)   MkBuf2XXXfast(buf).O
 
#define MkBuf2BYTfast(buf)   MkBuf2XXXfast(buf).Y
 
#define MkBuf2SRTfast(buf)   MkBuf2XXXfast(buf).S
 
#define MkBuf2INTfast(buf)   MkBuf2XXXfast(buf).I
 
#define MkBuf2WIDfast(buf)   MkBuf2XXXfast(buf).W
 
#define MkBuf2FLTfast(buf)   MkBuf2XXXfast(buf).F
 
#define MkBuf2DBLfast(buf)   MkBuf2XXXfast(buf).D
 

MkBuf2TT

get a native PRIMITIVE TYPE from a non-aligned MkBufferC

the alligned would be: ((*buf->storage.first.A).?)

#define MkBuf2XXX(xxx, len, buf)   ({MK_##xxx __tmp; memcpy(&__tmp,buf->storage.first.B,len); __tmp;})
 
#define MkBuf2BOL(buf)   MkBuf2XXX(BOL,1,buf)
 
#define MkBuf2BYT(buf)   MkBuf2XXX(BYT,1,buf)
 
#define MkBuf2SRT(buf)   MkBuf2XXX(SRT,2,buf)
 
#define MkBuf2INT(buf)   MkBuf2XXX(INT,4,buf)
 
#define MkBuf2WID(buf)   MkBuf2XXX(WID,8,buf)
 
#define MkBuf2FLT(buf)   MkBuf2XXX(FLT,4,buf)
 
#define MkBuf2DBL(buf)   MkBuf2XXX(DBL,8,buf)
 
#define MkBuf2Ptr(len, ptr, buf)   memcpy((void*)ptr,buf->storage.first.B,len)
 
#define MkBuf2BOL_P(ptr, buf)   MkBuf2Ptr(1,ptr,buf)
 
#define MkBuf2BYT_P(ptr, buf)   MkBuf2Ptr(1,ptr,buf)
 
#define MkBuf2SRT_P(ptr, buf)   MkBuf2Ptr(2,ptr,buf)
 
#define MkBuf2INT_P(ptr, buf)   MkBuf2Ptr(4,ptr,buf)
 
#define MkBuf2WID_P(ptr, buf)   MkBuf2Ptr(8,ptr,buf)
 
#define MkBuf2FLT_P(ptr, buf)   MkBuf2Ptr(4,ptr,buf)
 
#define MkBuf2DBL_P(ptr, buf)   MkBuf2Ptr(8,ptr,buf)
 
#define MkBuf2Ptr_A(l, a, b)   memcpy(a.B##l,b->storage.first.B,l)
 
#define MkBuf2BOL_A(ato, buf)   MkBuf2Ptr_A(1,ato,buf)
 
#define MkBuf2BYT_A(ato, buf)   MkBuf2Ptr_A(1,ato,buf)
 
#define MkBuf2SRT_A(ato, buf)   MkBuf2Ptr_A(2,ato,buf)
 
#define MkBuf2INT_A(ato, buf)   MkBuf2Ptr_A(4,ato,buf)
 
#define MkBuf2WID_A(ato, buf)   MkBuf2Ptr_A(8,ato,buf)
 
#define MkBuf2FLT_A(ato, buf)   MkBuf2Ptr_A(4,ato,buf)
 
#define MkBuf2DBL_A(ato, buf)   MkBuf2Ptr_A(8,ato,buf)
 

Detailed Description

The MkBufferC object known as buf or buffer is used to create and manage dynamic, generic, mixed typed data. …

The MkBufferC is used to store PRIMITIVE TYPE data. If libmkkernel is working on data… libmkkernel is working on an MkBufferC object or on a list of MkBufferC objects called MkBufferListC.

MkBufferS CLASS

The ABSTRACT-CLASS used to store a native-type-data-item defined by PRIMITIVE TYPE

C-Kernel-Details

The ABSTRACT-CLASS MkBufferS is used to store MkTypeE data in an MkBufferS::storage

A new MkBufferS is always preallocated with the predefined ILS-storage (MkBufferS::ils_data), but can switch to a MALLOC-storage if the storage requirements of the user exceed the predefined MkBufferS::ilsS::size.

‍A MkBufferS never run out of storage.

The basic goal of the ILS-storage technology is to minimize the usage of MALLOC, this mean that the MkBufferS::ilsS::size should be large enought to be sufficient for the user needs.

The following conditions must always be met for the ILS memory:

The ABSTRACT-CLASS MkBufferS is missing the ILS-storage, the FINAL-CLASSES are:

MkBuffer64C, MkBuffer256C and MkBuffer1024C

See also
MkBufferListC, MkBufferStreamC

MkBufferS CTOR / DTOR

command synonmym
(constructor) MK_BUF MkBufferCreate(MK_TYP type, MK_NUM size) no
void MkBufferDelete(MK_BUF buf) no

Example from server.c read a buffer-object and convert single-char-type-identifer to string.

static enum MkErrorE
Ot_BUF2 ( MQ_CALLBACK_SERVICE_CALL_ARGS )
{
  MK_BUF buf;
  int i;
  char str[2] = {'\0', '\0'};
  MqSendSTART_E (mqctx);
  for (i=0; i<3; i++) {
    MqReadU_E (mqctx, &buf);
    str[0] = MkBufferGetType1(buf);
    MqSendC_E (mqctx, str);
    MqSendU_E (mqctx, buf);
  }
  return MqSendRETURN(mqctx);
error:
  return MkErrorStack_1X(mqctx);
}
See also
BufferGetType1 BufferGetType2 BufferGetType3

Macro Definition Documentation

◆ MkBuf2BOL

#define MkBuf2BOL (   buf)    MkBuf2XXX(BOL,1,buf)

Definition at line 6611 of file kernel_mk.h.

◆ MkBuf2BOL_A

#define MkBuf2BOL_A (   ato,
  buf 
)    MkBuf2Ptr_A(1,ato,buf)

Definition at line 6629 of file kernel_mk.h.

◆ MkBuf2BOL_P

#define MkBuf2BOL_P (   ptr,
  buf 
)    MkBuf2Ptr(1,ptr,buf)

Definition at line 6620 of file kernel_mk.h.

◆ MkBuf2BOLfast

#define MkBuf2BOLfast (   buf)    MkBuf2XXXfast(buf).O

Definition at line 6594 of file kernel_mk.h.

◆ MkBuf2BYT

#define MkBuf2BYT (   buf)    MkBuf2XXX(BYT,1,buf)

Definition at line 6612 of file kernel_mk.h.

◆ MkBuf2BYT_A

#define MkBuf2BYT_A (   ato,
  buf 
)    MkBuf2Ptr_A(1,ato,buf)

Definition at line 6630 of file kernel_mk.h.

◆ MkBuf2BYT_P

#define MkBuf2BYT_P (   ptr,
  buf 
)    MkBuf2Ptr(1,ptr,buf)

Definition at line 6621 of file kernel_mk.h.

◆ MkBuf2BYTfast

#define MkBuf2BYTfast (   buf)    MkBuf2XXXfast(buf).Y

Definition at line 6595 of file kernel_mk.h.

◆ MkBuf2DBL

#define MkBuf2DBL (   buf)    MkBuf2XXX(DBL,8,buf)

Definition at line 6617 of file kernel_mk.h.

◆ MkBuf2DBL_A

#define MkBuf2DBL_A (   ato,
  buf 
)    MkBuf2Ptr_A(8,ato,buf)

Definition at line 6635 of file kernel_mk.h.

◆ MkBuf2DBL_P

#define MkBuf2DBL_P (   ptr,
  buf 
)    MkBuf2Ptr(8,ptr,buf)

Definition at line 6626 of file kernel_mk.h.

◆ MkBuf2DBLfast

#define MkBuf2DBLfast (   buf)    MkBuf2XXXfast(buf).D

Definition at line 6600 of file kernel_mk.h.

◆ MkBuf2FLT

#define MkBuf2FLT (   buf)    MkBuf2XXX(FLT,4,buf)

Definition at line 6616 of file kernel_mk.h.

◆ MkBuf2FLT_A

#define MkBuf2FLT_A (   ato,
  buf 
)    MkBuf2Ptr_A(4,ato,buf)

Definition at line 6634 of file kernel_mk.h.

◆ MkBuf2FLT_P

#define MkBuf2FLT_P (   ptr,
  buf 
)    MkBuf2Ptr(4,ptr,buf)

Definition at line 6625 of file kernel_mk.h.

◆ MkBuf2FLTfast

#define MkBuf2FLTfast (   buf)    MkBuf2XXXfast(buf).F

Definition at line 6599 of file kernel_mk.h.

◆ MkBuf2INT

#define MkBuf2INT (   buf)    MkBuf2XXX(INT,4,buf)

Definition at line 6614 of file kernel_mk.h.

◆ MkBuf2INT_A

#define MkBuf2INT_A (   ato,
  buf 
)    MkBuf2Ptr_A(4,ato,buf)

Definition at line 6632 of file kernel_mk.h.

◆ MkBuf2INT_P

#define MkBuf2INT_P (   ptr,
  buf 
)    MkBuf2Ptr(4,ptr,buf)

Definition at line 6623 of file kernel_mk.h.

◆ MkBuf2INTfast

#define MkBuf2INTfast (   buf)    MkBuf2XXXfast(buf).I

Definition at line 6597 of file kernel_mk.h.

◆ MkBuf2Ptr

#define MkBuf2Ptr (   len,
  ptr,
  buf 
)    memcpy((void*)ptr,buf->storage.first.B,len)

Definition at line 6619 of file kernel_mk.h.

◆ MkBuf2Ptr_A

#define MkBuf2Ptr_A (   l,
  a,
 
)    memcpy(a.B##l,b->storage.first.B,l)

Definition at line 6628 of file kernel_mk.h.

◆ MkBuf2SRT

#define MkBuf2SRT (   buf)    MkBuf2XXX(SRT,2,buf)

Definition at line 6613 of file kernel_mk.h.

◆ MkBuf2SRT_A

#define MkBuf2SRT_A (   ato,
  buf 
)    MkBuf2Ptr_A(2,ato,buf)

Definition at line 6631 of file kernel_mk.h.

◆ MkBuf2SRT_P

#define MkBuf2SRT_P (   ptr,
  buf 
)    MkBuf2Ptr(2,ptr,buf)

Definition at line 6622 of file kernel_mk.h.

◆ MkBuf2SRTfast

#define MkBuf2SRTfast (   buf)    MkBuf2XXXfast(buf).S

Definition at line 6596 of file kernel_mk.h.

◆ MkBuf2WID

#define MkBuf2WID (   buf)    MkBuf2XXX(WID,8,buf)

Definition at line 6615 of file kernel_mk.h.

◆ MkBuf2WID_A

#define MkBuf2WID_A (   ato,
  buf 
)    MkBuf2Ptr_A(8,ato,buf)

Definition at line 6633 of file kernel_mk.h.

◆ MkBuf2WID_P

#define MkBuf2WID_P (   ptr,
  buf 
)    MkBuf2Ptr(8,ptr,buf)

Definition at line 6624 of file kernel_mk.h.

◆ MkBuf2WIDfast

#define MkBuf2WIDfast (   buf)    MkBuf2XXXfast(buf).W

Definition at line 6598 of file kernel_mk.h.

◆ MkBuf2XXX

#define MkBuf2XXX (   xxx,
  len,
  buf 
)    ({MK_##xxx __tmp; memcpy(&__tmp,buf->storage.first.B,len); __tmp;})

Definition at line 6609 of file kernel_mk.h.

◆ MkBuf2XXXfast

#define MkBuf2XXXfast (   buf)    (*(buf)->storage.first.A)

Definition at line 6592 of file kernel_mk.h.

◆ MkBufferC_Check

#define MkBufferC_Check (   mng)    MkBufCheck(mng)

Definition at line 6291 of file kernel_mk.h.

◆ MkBufferC_MASK

#define MkBufferC_MASK   (((1u<<22)-1)<<10)

Definition at line 6228 of file kernel_mk.h.

◆ MkBufferC_NS

#define MkBufferC_NS   MK

map class to namespace …

Definition at line 6267 of file kernel_mk.h.

◆ MkBufferC_SIGNATURE

#define MkBufferC_SIGNATURE   (MkObjectC_SIGNATURE ^ (1u<<10))

Definition at line 6227 of file kernel_mk.h.

◆ MkBufferC_T

#define MkBufferC_T   (&MK_RT_REF._MkBufferC_T)

instance-type as specific-instance-type, useable in a class-macro as: class##_T

Definition at line 6251 of file kernel_mk.h.

◆ MkBufferC_TT

#define MkBufferC_TT   (MkTYP(MkBufferC_T))

instance-type as common-instance-type, useable in a class-macro as: class##_TT

Definition at line 6253 of file kernel_mk.h.

◆ MkBufferC_type

#define MkBufferC_type   MK_BUF

same as MkBufferS but useable in a class-macro as: class##_type

Definition at line 6259 of file kernel_mk.h.

◆ MkBufferC_X2buf

#define MkBufferC_X2buf (   x)    (x)

Definition at line 6236 of file kernel_mk.h.

◆ MkBufferC_X2obj

#define MkBufferC_X2obj (   x)    MkOBJ(x)

Definition at line 6237 of file kernel_mk.h.

◆ MkBufferCT

#define MkBufferCT   ( (struct MkDefTypeS *) MkBufferCTT )

instance-type as specific-instance-type for MkBufferC in the target-programming-language (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO)

Definition at line 6271 of file kernel_mk.h.

◆ MkBufferCT_TT

#define MkBufferCT_TT (   typ)    ( (struct MkDefTypeS *) (typ) )

cast from an common-instance-type into an specific-instance-type

Definition at line 6265 of file kernel_mk.h.

◆ MkBufferCT_X

#define MkBufferCT_X (   instance)    ( (struct MkDefTypeS *) (MkOBJ_R(instance).type) )

cast from an instance into the specific-instance-type

Definition at line 6261 of file kernel_mk.h.

◆ MkBufferCTT

#define MkBufferCTT   MkBufferCTT

instance-type as common-instance-type for MkBufferC in the target-programming-language (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO)

Definition at line 6269 of file kernel_mk.h.

◆ MkBufferCTT_X

#define MkBufferCTT_X (   instance)    (MkOBJ_R(instance).type)

cast from an instance into the common-instance-type

Definition at line 6263 of file kernel_mk.h.

◆ MkBufferST

#define MkBufferST   MkBufferC_T

instance-type as specific-instance-type

Definition at line 6255 of file kernel_mk.h.

◆ MkBufferSTT

#define MkBufferSTT   (MkTYP(MkBufferST))

instance-type as common-instance-type (cast from MkBufferST into MkTypeS) …

Definition at line 6257 of file kernel_mk.h.

Typedef Documentation

◆ MK_BUF

typedef struct MkBufferS* MK_BUF

class-shortcut for struct MkBufferS *, all shortcut using the XX_YYY syntax (only for public API) …

Definition at line 2925 of file kernel_mk.h.

◆ MK_BUFN

typedef const struct MkBufferS* MK_BUFN

class-shortcut for const struct MkBufferS *, all const shortcut using the XX_YYYC syntax (only for public API) …

Definition at line 2928 of file kernel_mk.h.

◆ MK_BUFR

typedef struct MkBufferS MK_BUFR

reference-shortcut for struct MkBufferS, all shortcut using the XX_YYYR syntax (only for public API) …

Definition at line 2931 of file kernel_mk.h.

◆ MkBufferCNR

typedef const struct MkBufferS MkBufferCNR

const instance-struct-reference same as const struct MkBufferS, useable in a class-macro as: class##R

Definition at line 6249 of file kernel_mk.h.

◆ MkBufferCR

typedef struct MkBufferS MkBufferCR

instance-struct-reference same as struct MkBufferS, useable in a class-macro as: class##R

Definition at line 6247 of file kernel_mk.h.

Function Documentation

◆ MkBufCheck()

bool MkBufCheck ( MK_MNGN  mng)
inline

check MkBufferS%->Mk{ObjectS::signature} …

Returns
TRUE on valid buf and FALSE an invalid buf

Definition at line 6286 of file kernel_mk.h.

+ Here is the caller graph for this function: