Loading...
Searching...
No Matches
MqContextC_TOR_C_API

MqContextC - various functions to create, initialize and destroy a contextMore...

+ Collaboration diagram for MqContextC_TOR_C_API:

Functions

MQ_EXTERN void libmqmsgque::MqContextInit_RT (MK_RT const mkrt, MQ_CTX const ctx, MK_TYP type, MQ_CTX const tmpl)
 initialize the MqContextC object related data but do not create the object self
 
MQ_EXTERN void libmqmsgque::MqContextFree_RT (MK_RT const mkrt, MQ_CTX const ctx)
 free the MqContextC object related data but do not free the toplevel object self …
 
MQ_EXTERN MQ_CTX libmqmsgque::MqContextCreate_RT (MK_RT const mkrt, MK_TYP type, MQ_CTX const tmpl)
 create and initialize the MqContextC ...
 
MQ_EXTERN MQ_CTX libmqmsgque::MqContextSetup_RT (MK_RT const mkrt, MK_TYP type, MQ_CTX const tmpl, MQ_CTX *ctx_out)
 

MqContextDelete

MQ_EXTERN void libmqmsgque::MqContextDelete_RT (MK_RT const mkrt, MQ_CTX ctx)
 Destructor - delete a MqContextC instance …
 

MqContextC - MqContextC_TOR_C_API - overload

#define MqContextCreate_NULL(...)
 
#define MqContextCreate(...)
 
#define MqContextCreate_1(tmpl)
 
#define MqContextCreate_0()
 
#define MqContextSetup_NULL(...)
 
#define MqContextSetup(...)
 
#define MqContextSetup_2(tmpl, ctx_out)
 
#define MqContextSetup_1(ctx_out)
 
#define MqContextDelete(x)
 
#define MqContextFree_NULL(...)
 
#define MqContextFree(...)
 
#define MqContextInit_NULL(...)
 
#define MqContextInit(...)
 

Detailed Description

MqContextC - various functions to create, initialize and destroy a context

Macro Definition Documentation

◆ MqContextCreate

#define MqContextCreate ( ...)
Value:
MqContextCreate_RT(MK_RT_CALL __VA_ARGS__)
#define MK_RT_CALL

Definition at line 859 of file msgque_overload_mq.h.

◆ MqContextCreate_0

#define MqContextCreate_0 ( )
Value:
MqContextCreate(NULL,NULL)
#define MqContextCreate(...)

Definition at line 861 of file msgque_overload_mq.h.

◆ MqContextCreate_1

#define MqContextCreate_1 ( tmpl)
Value:
MqContextCreate(NULL,tmpl)

Definition at line 860 of file msgque_overload_mq.h.

◆ MqContextCreate_NULL

#define MqContextCreate_NULL ( ...)
Value:
MqContextCreate_RT(MK_RT_CALL_NULL __VA_ARGS__)
#define MK_RT_CALL_NULL

Definition at line 858 of file msgque_overload_mq.h.

◆ MqContextDelete

#define MqContextDelete ( x)
Value:
MkObjectDeleteToNull(MqContextDelete_RT,x)
#define MkObjectDeleteToNull(fct, x)

Definition at line 868 of file msgque_overload_mq.h.

◆ MqContextFree

#define MqContextFree ( ...)
Value:
MqContextFree_RT(MK_RT_CALL __VA_ARGS__)

Definition at line 872 of file msgque_overload_mq.h.

◆ MqContextFree_NULL

#define MqContextFree_NULL ( ...)
Value:
MqContextFree_RT(MK_RT_CALL_NULL __VA_ARGS__)

Definition at line 871 of file msgque_overload_mq.h.

◆ MqContextInit

#define MqContextInit ( ...)
Value:
MqContextInit_RT(MK_RT_CALL __VA_ARGS__)

Definition at line 874 of file msgque_overload_mq.h.

◆ MqContextInit_NULL

#define MqContextInit_NULL ( ...)
Value:
MqContextInit_RT(MK_RT_CALL_NULL __VA_ARGS__)

Definition at line 873 of file msgque_overload_mq.h.

◆ MqContextSetup

#define MqContextSetup ( ...)
Value:
MqContextSetup_RT(MK_RT_CALL __VA_ARGS__)

Definition at line 863 of file msgque_overload_mq.h.

◆ MqContextSetup_1

#define MqContextSetup_1 ( ctx_out)
Value:
MqContextSetup(NULL,NULL,ctx_out)
#define MqContextSetup(...)

Definition at line 865 of file msgque_overload_mq.h.

◆ MqContextSetup_2

#define MqContextSetup_2 ( tmpl,
ctx_out )
Value:
MqContextSetup(NULL,tmpl,ctx_out)

Definition at line 864 of file msgque_overload_mq.h.

◆ MqContextSetup_NULL

#define MqContextSetup_NULL ( ...)
Value:
MqContextSetup_RT(MK_RT_CALL_NULL __VA_ARGS__)

Definition at line 862 of file msgque_overload_mq.h.

Function Documentation

◆ MqContextCreate_RT()

MQ_EXTERN MQ_CTX libmqmsgque::MqContextCreate_RT ( MK_RT const mkrt,
MK_TYP type,
MQ_CTX const tmpl )

create and initialize the MqContextC ...

This function is used to create a single new context… primary on the client. to create multiple new context on a server… a MqFactoryC is used.

The new instance belongs to the caller and may have to be released if necessary. A manual release using ContextDelete is always possible, but the instance can no longer be used afterwards.

Example from MyClient.cc create a context using the static ccmqmsgque CTOR

#include <iostream>
#include "LibMqMsgque_cc.hh"

using namespace ccmqmsgque;

int MK_CDECL main(int argc, MK_STRN argv[]) {
  MqMsgque::Setup();
  MqContextC c;
  try {
    MkBufferListC args = {argc, argv};

    c.ConfigSetName("MyClient");
    c.LinkCreate(args);
    c.SendSTART();
    c.SendSTR("Hello");
    c.SendEND_AND_WAIT("HLWO");
    std::cout << c.ReadSTR() << std::endl;

  } catch (const std::exception& e) {
    c.ErrorCatch(e);
  }
  c.Exit();
}
Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]typetype type of the object like MqContextC_T or a new type created with MkTypeDup2. (default: MK_NULL, reuse the MkTypeSTT from tmpl or use MqContextC_T if tmpl = MK_NULL)
[in]tmplan other context-data-structure used as template to initialize the configuration data. This template is used for a child to get the configuration data from the parent. (default: MK_NULL, create an initial context)
Returns
The newly created MqContextC instance, the instance is owned by the caller
See also
MqContextDelete, MqExit

◆ MqContextDelete_RT()

MQ_EXTERN void libmqmsgque::MqContextDelete_RT ( MK_RT const mkrt,
MQ_CTX ctx )

Destructor - delete a MqContextC instance …

Shutdown the client-server-link, free the memory and set the ctx to MK_NULL. The context can not be reused.

Example from MyClient2.cc delete a application-context using the ccmqmsgque DTOR

#include <iostream>
using namespace ccmqmsgque;
int MK_CDECL main(int argc, MK_STRN argv[]) {
MqMsgque::Setup();
// create a context using the default CTOR
try {
MkBufferListC args = {argc, argv};
c.ConfigSetName("MyClient");
c.LinkCreate(&args);
c.SendSTART();
c.SendSTR("Hello");
c.SendEND_AND_WAIT("HLWO");
std::cout << c.ReadSTR() << std::endl;
} catch (const std::exception& e) {
c.ErrorCatch(e);
}
// delete context using the DTOR method "Dispose"
// ATTENTION: use "Delete" create an "double-free-error" because "c" will be freed by C++
c.Dispose();
}
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
See also
MqContextCreate

◆ MqContextFree_RT()

MQ_EXTERN void libmqmsgque::MqContextFree_RT ( MK_RT const mkrt,
MQ_CTX const ctx )

free the MqContextC object related data but do not free the toplevel object self …

Shutdown the client-server-link and free the related memory. The toplevel object is still alive to give an existing Garbage-Collection the control when to delete the object. The context can not be reused.

◆ MqContextInit_RT()

MQ_EXTERN void libmqmsgque::MqContextInit_RT ( MK_RT const mkrt,
MQ_CTX const ctx,
MK_TYP type,
MQ_CTX const tmpl )

initialize the MqContextC object related data but do not create the object self

◆ MqContextSetup_RT()

MQ_EXTERN MQ_CTX libmqmsgque::MqContextSetup_RT ( MK_RT const mkrt,
MK_TYP type,
MQ_CTX const tmpl,
MQ_CTX * ctx_out )

same as MqContextCreate but use an already-existing instance of ctx_out

If *ctx_out is not null than MqContextSetup assume an allready-existing storage and ctx_out is only initialized.

Example
perfserver.c with factory support