theLink 10.0 NHI1 - theKernel - theLink - theConfig - theSq3Lite - theCompiler - theBrain - theGuard
c - tcl - cs - py - rb - jv - cc
Loading...
Searching...
No Matches
MqFactoryC_Misc_C_API

MqFactoryC - various functions to work on a factoryMore...

+ Collaboration diagram for MqFactoryC_Misc_C_API:

Functions

MQ_FCT MqFactoryDefault (MQ_FCT const fct)
 set the default-attribute to the factory
 
MQ_FCT MqFactoryInitial (MQ_FCT const fct)
 set the initial-attribut to fct
 
MK_STRN MqFactoryDefaultIdent (void)
 return the factory-identifier of the default MqFactoryC
 
MK_STRN MqFactoryInitialIdent (void)
 return the factory-identifier of the initial MqFactoryC
 
enum MkErrorE MqFactoryNew_RT (MK_RT mkrt, MQ_FCT const fct, MQ_CTX const tmpl, MQ_CTX *const val_out)
 create a new MqContextC from a MqFactoryC
 
void MqFactoryLogAll_RT (MK_RT mkrt, MK_STRN const callfunc)
 log all "factories" to stderr
 

MqFactoryLog

void MqFactoryLog_RT (MK_RT mkrt, MQ_FCTN const fct, MK_OBJN fmtobj, MK_DBG const debug, MK_STRN const callfunc, MK_I32 const lvl)
 log the MqFactoryC
 
#define MqFactoryLog_2M(fct, m)
 

MqFactoryC - MqFactoryC_Misc_C_API - overload

#define MqFactoryNew_NULL(...)
 
#define MqFactoryNew(...)
 
#define MqFactoryNew_2(fct, val_out)
 
#define MqFactoryNew_E(...)
 
#define MqFactoryNew_C(...)
 
#define MqFactoryNew_e(...)
 
#define MqFactoryLog_NULL(...)
 
#define MqFactoryLog(...)
 
#define MqFactoryLog_4(fct, fmtobj, debug, callfunc)
 
#define MqFactoryLog_3(fct, fmtobj, debug)
 
#define MqFactoryLog_2(fct, fmtobj)
 
#define MqFactoryLog_1(fct)
 
#define MqFactoryLogAll_NULL(...)
 
#define MqFactoryLogAll(...)
 
#define MqFactoryLogAll_0()
 

Detailed Description

MqFactoryC - various functions to work on a factory

Macro Definition Documentation

◆ MqFactoryLog

#define MqFactoryLog ( ...)
Value:
#define MK_RT_CALL
void MqFactoryLog_RT(MK_RT mkrt, MQ_FCTN const fct, MK_OBJN fmtobj, MK_DBG const debug, MK_STRN const callfunc, MK_I32 const lvl)
log the MqFactoryC …

Definition at line 1018 of file msgque_overload_mq.h.

◆ MqFactoryLog_1

#define MqFactoryLog_1 ( fct)
Value:
MqFactoryLog(fct,NULL,0,__func__,0)
#define MqFactoryLog(...)

Definition at line 1022 of file msgque_overload_mq.h.

◆ MqFactoryLog_2

#define MqFactoryLog_2 ( fct,
fmtobj )
Value:
MqFactoryLog(fct,fmtobj,0,__func__,0)

Definition at line 1021 of file msgque_overload_mq.h.

◆ MqFactoryLog_2M

#define MqFactoryLog_2M ( fct,
m )
Value:
static MK_OBJ MkObj(MK_MNG mng)
#define MqFactoryLog_2(fct, fmtobj)

Definition at line 3694 of file LibMqMsgque_mq.h.

◆ MqFactoryLog_3

#define MqFactoryLog_3 ( fct,
fmtobj,
debug )
Value:
MqFactoryLog(fct,fmtobj,debug,__func__,0)

Definition at line 1020 of file msgque_overload_mq.h.

◆ MqFactoryLog_4

#define MqFactoryLog_4 ( fct,
fmtobj,
debug,
callfunc )
Value:
MqFactoryLog(fct,fmtobj,debug,callfunc,0)

Definition at line 1019 of file msgque_overload_mq.h.

◆ MqFactoryLog_NULL

#define MqFactoryLog_NULL ( ...)
Value:
#define MK_RT_CALL_NULL

Definition at line 1017 of file msgque_overload_mq.h.

◆ MqFactoryLogAll

#define MqFactoryLogAll ( ...)
Value:
void MqFactoryLogAll_RT(MK_RT mkrt, MK_STRN const callfunc)
log all "factories" to stderr

Definition at line 1026 of file msgque_overload_mq.h.

◆ MqFactoryLogAll_0

#define MqFactoryLogAll_0 ( )
Value:
MqFactoryLogAll(__func__)
#define MqFactoryLogAll(...)

Definition at line 1027 of file msgque_overload_mq.h.

◆ MqFactoryLogAll_NULL

#define MqFactoryLogAll_NULL ( ...)
Value:

Definition at line 1025 of file msgque_overload_mq.h.

◆ MqFactoryNew

#define MqFactoryNew ( ...)
Value:
enum MkErrorE MqFactoryNew_RT(MK_RT mkrt, MQ_FCT const fct, MQ_CTX const tmpl, MQ_CTX *const val_out)
create a new MqContextC from a MqFactoryC …

Definition at line 1010 of file msgque_overload_mq.h.

◆ MqFactoryNew_2

#define MqFactoryNew_2 ( fct,
val_out )
Value:
MqFactoryNew(fct,NULL,val_out)
#define MqFactoryNew(...)

Definition at line 1011 of file msgque_overload_mq.h.

◆ MqFactoryNew_C

#define MqFactoryNew_C ( ...)
Value:
if (MkErrorCheckI(MqFactoryNew(__VA_ARGS__)))

Definition at line 1013 of file msgque_overload_mq.h.

◆ MqFactoryNew_E

#define MqFactoryNew_E ( ...)
Value:
MkErrorCheck(MqFactoryNew(__VA_ARGS__))

Definition at line 1012 of file msgque_overload_mq.h.

◆ MqFactoryNew_e

#define MqFactoryNew_e ( ...)
Value:
MK_EMBEDDED(MQ_CTX,MqFactoryNew,__VA_ARGS__)
PUBLIC data structure for the pymqmsgque-specific-data

Definition at line 1014 of file msgque_overload_mq.h.

◆ MqFactoryNew_NULL

#define MqFactoryNew_NULL ( ...)
Value:

Definition at line 1009 of file msgque_overload_mq.h.

Function Documentation

◆ MqFactoryDefault()

MQ_FCT MqFactoryDefault ( MQ_FCT const fct)

set the default-attribute to the factory

The default-factory is used to create an MqFactoryC if MqFactoryGetCalled was not able to find a specific factory object. This is designed for a scenario with multiple factories included into a single binary and the first commandline parameter after the executable name… (position 0=executable, position 1=factory-selector)… is not related to a factory-ident… added with MqFactoryAdd.

Parameters
[in]fctthe new default MqFactoryC
Returns
the input fct

Example: from example/py/server.cs

static void Main(string[] argv) {
var largv = new MkBufferListC(argv);
MqFactoryCT<Server>.Add("server").Default();
MqFactoryCT<Client>.Add("client");
// "ctx" get the "Default" factory "server" ... or ... the factory "client" ...
// if string "client" is on the FIRST position in "argv"
MqContextC ctx = MqFactoryCT<MqContextC>.GetCalled(largv).New();
try {
ctx.LinkCreate(largv);
ctx.LogC("this is the log test\n",1,"test");
ctx.ProcessEvent(MqWaitOnEventE.FOREVER);
} catch (Exception ex) {
ctx.ErrorCatch (ex);
} finally {
ctx.Exit();
}
}
+ Here is the caller graph for this function:

◆ MqFactoryDefaultIdent()

MK_STRN MqFactoryDefaultIdent ( void )

return the factory-identifier of the default MqFactoryC

+ Here is the caller graph for this function:

◆ MqFactoryInitial()

MQ_FCT MqFactoryInitial ( MQ_FCT const fct)

set the initial-attribut to fct

The factory with "Initial"-attribute is always used for an object that should only be created with the MqContextC base class, but for which no other factory has been specified.
Use this attribute with care because you are firmly linking a factory. In a programming language with class-support, such as C++ or C#, this class is used for every new MqContextC object.
Where "Reflection" is available, this attribute has less meaning since the class is primarily determined from the parent object by means of "Reflection".
The "Initial" attribute is otherwise used for the "Loopback" and the "Filter" capability.

Example from Filter4.py set Initial attribute to a Factory

  MqFactoryC.Add(Filter4, "transFilter").Initial()
  # "srv" get the "Initial" factory
  srv = Filter4()
  try:
    srv.LinkCreate(sys.argv)
    srv.ProcessEvent(MqWaitOnEventE.FOREVER)
  except Exception as ex:
    srv.ErrorCatch(ex);
  finally:
    srv.Exit()
Parameters
[in]fctthe new initial MqFactoryC
Returns
the input fct
+ Here is the caller graph for this function:

◆ MqFactoryInitialIdent()

MK_STRN MqFactoryInitialIdent ( void )

return the factory-identifier of the initial MqFactoryC

+ Here is the caller graph for this function:

◆ MqFactoryLog_RT()

void MqFactoryLog_RT ( MK_RT mkrt,
MQ_FCTN const fct,
MK_OBJN fmtobj,
MK_DBG const debug,
MK_STRN const callfunc,
MK_I32 const lvl )

log the MqFactoryC

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]fctthe MqFactoryS instance to work on
[in]fmtobjmanaged object used to format the log-message (default=None → use default-format)
[in]debugthe debug level from MkRuntimeS::debug, use 0 <= debug <= 9 (default=0)
[in]callfunca user-defined postfix to identify the calling function or the environment (default=name-of-function)
[in]lvla user-defined prefix starting with "" for lvl=0 and increase with " " for lvl+1 (default=0)
See also
MqFactoryC

◆ MqFactoryLogAll_RT()

void MqFactoryLogAll_RT ( MK_RT mkrt,
MK_STRN const callfunc )

log all "factories" to stderr

Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]callfunca user-defined postfix to identify the calling function or the environment (default=name-of-function)

◆ MqFactoryNew_RT()

enum MkErrorE MqFactoryNew_RT ( MK_RT mkrt,
MQ_FCT const fct,
MQ_CTX const tmpl,
MQ_CTX *const val_out )

create a new MqContextC from a MqFactoryC

this create only the initial-server-object… all other server-objects will be created on behalf of the client-request.

Example from MyServer.py create a new server context

import sys
from pymqmsgque import *

# package-item
class MyServer(MqContextC):

  # factory startup
  def __init__(self, tmpl=None):
    self.ConfigSetServerSetup(self.ServerSetup)
    super().__init__(tmpl)

  # service to serve all incoming requests for token "HLWO"
  def MyFirstService(self):
    self.SendSTART()
    self.SendSTR(self.ReadSTR() + " World")
    self.SendRETURN()

  # define a service as link between the token "HLWO" and the callback "MyFirstService"
  def ServerSetup(self):
    self.ServiceCreate("HLWO",self.MyFirstService)

# package-main
if __name__ == "__main__":

  # create the "MyServer" factory… and the object
  srv = MqFactoryC.Add(MyServer).New()

  try:
    srv.LinkCreate(sys.argv)
    srv.ProcessEvent(MqWaitOnEventE.FOREVER)
  except Exception as ex:
    srv.ErrorCatch(ex)
  finally:
    srv.Exit()
Parameters
[in]mkrtthe MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only)
[in]fcta MqFactoryC used to create a MqContextC
[in]tmpl(C-API only) template for context intialization
[out]val_outthe new context object as return or None on error
Returns
the new MqContextC or NULL on error
Attention
(C-API only)
the programmer have-to check the return value on None pointer
(non C-API only)
this is no hard constructor because the factory create the object and the self pointer is already available. ObjNew is used to extract the self pointer from the object