MqFactoryC - various functions to work on a factory … More...
Functions | |
MQ_FCT | libmqmsgque::MqFactoryDefault_RT (MK_RT mkrt, MQ_FCT const fct) |
set the default-attribute to the factory … | |
MQ_FCT | libmqmsgque::MqFactoryInitial_RT (MK_RT mkrt, MQ_FCT const fct) |
set the initial-attribut to fct … | |
MK_STRN | libmqmsgque::MqFactoryDefaultIdent_RT (MK_RT mkrt) |
return the factory-identifier of the default MqFactoryC | |
MK_STRN | libmqmsgque::MqFactoryInitialIdent_RT (MK_RT mkrt) |
return the factory-identifier of the initial MqFactoryC | |
enum MkErrorE | libmqmsgque::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 | libmqmsgque::MqFactoryLogAll_RT (MK_RT mkrt, MK_STRN const callfunc) |
log all "factories" to stderr | |
MqFactoryLog | |
void | libmqmsgque::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 | MqFactoryDefault_NULL(...) |
#define | MqFactoryDefault(...) |
#define | MqFactoryInitial_NULL(...) |
#define | MqFactoryInitial(...) |
#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 | MqFactoryDefaultIdent_NULL() |
#define | MqFactoryDefaultIdent() |
#define | MqFactoryInitialIdent_NULL() |
#define | MqFactoryInitialIdent() |
#define | MqFactoryLogAll_NULL(...) |
#define | MqFactoryLogAll(...) |
#define | MqFactoryLogAll_0() |
MqFactoryC - various functions to work on a factory …
#define MqFactoryDefault | ( | ... | ) |
Definition at line 1012 of file msgque_overload_mq.h.
#define MqFactoryDefault_NULL | ( | ... | ) |
Definition at line 1011 of file msgque_overload_mq.h.
#define MqFactoryDefaultIdent | ( | ) |
Definition at line 1034 of file msgque_overload_mq.h.
#define MqFactoryDefaultIdent_NULL | ( | ) |
Definition at line 1033 of file msgque_overload_mq.h.
#define MqFactoryInitial | ( | ... | ) |
Definition at line 1014 of file msgque_overload_mq.h.
#define MqFactoryInitial_NULL | ( | ... | ) |
Definition at line 1013 of file msgque_overload_mq.h.
#define MqFactoryInitialIdent | ( | ) |
Definition at line 1036 of file msgque_overload_mq.h.
#define MqFactoryInitialIdent_NULL | ( | ) |
Definition at line 1035 of file msgque_overload_mq.h.
#define MqFactoryLog | ( | ... | ) |
Definition at line 1026 of file msgque_overload_mq.h.
#define MqFactoryLog_1 | ( | fct | ) |
Definition at line 1030 of file msgque_overload_mq.h.
#define MqFactoryLog_2 | ( | fct, | |
fmtobj ) |
Definition at line 1029 of file msgque_overload_mq.h.
#define MqFactoryLog_2M | ( | fct, | |
m ) |
Definition at line 3746 of file LibMqMsgque_mq.h.
#define MqFactoryLog_3 | ( | fct, | |
fmtobj, | |||
debug ) |
Definition at line 1028 of file msgque_overload_mq.h.
#define MqFactoryLog_4 | ( | fct, | |
fmtobj, | |||
debug, | |||
callfunc ) |
Definition at line 1027 of file msgque_overload_mq.h.
#define MqFactoryLog_NULL | ( | ... | ) |
Definition at line 1025 of file msgque_overload_mq.h.
#define MqFactoryLogAll | ( | ... | ) |
Definition at line 1038 of file msgque_overload_mq.h.
#define MqFactoryLogAll_0 | ( | ) |
Definition at line 1039 of file msgque_overload_mq.h.
#define MqFactoryLogAll_NULL | ( | ... | ) |
Definition at line 1037 of file msgque_overload_mq.h.
#define MqFactoryNew | ( | ... | ) |
Definition at line 1018 of file msgque_overload_mq.h.
#define MqFactoryNew_2 | ( | fct, | |
val_out ) |
Definition at line 1019 of file msgque_overload_mq.h.
#define MqFactoryNew_C | ( | ... | ) |
Definition at line 1021 of file msgque_overload_mq.h.
#define MqFactoryNew_E | ( | ... | ) |
Definition at line 1020 of file msgque_overload_mq.h.
#define MqFactoryNew_e | ( | ... | ) |
Definition at line 1022 of file msgque_overload_mq.h.
#define MqFactoryNew_NULL | ( | ... | ) |
Definition at line 1017 of file msgque_overload_mq.h.
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.
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | fct | the new default MqFactoryC |
Example: from example//server.cs
return the factory-identifier of the default MqFactoryC
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.cc
→ set Initial attribute to a Factory
int MK_CDECL main (int argc, MK_STRN argv[]) { MqMsgque::CcMqSetup(); MqFactoryCT<Filter4>::Add("Filter4")->Initial(); Filter4 filter; try { filter.Init(); filter.LinkCreate (MkBufferListC {argc, argv}); filter.ProcessEvent (MQ_WAIT_FOREVER); } catch (const exception& e) { filter.ErrorCatch(e); } return filter.Exit(); }
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | fct | the new initial MqFactoryC |
return the factory-identifier of the initial MqFactoryC
void libmqmsgque::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 …
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | fct | the MqFactoryS instance to work on |
[in] | fmtobj | managed object used to format the log-message (default=MK_NULL → use default-format) |
[in] | debug | the debug level from MkRuntimeS::debug, use 0 <= debug <= 9 (default=0 ) |
[in] | callfunc | a user-defined postfix to identify the calling-function or the environment (default = name-of-function, MK_NULL = resolve-own-name) |
[in] | lvl | a user-defined prefix starting with "" for lvl=0 and increase with " " for lvl+1 (default=0 ) |
log all "factories" to stderr
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | callfunc | a user-defined postfix to identify the calling-function or the environment (default = name-of-function, MK_NULL = resolve-own-name) |
enum MkErrorE libmqmsgque::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.cc
→ create a new server context
#include "LibMqMsgque_cc.hh" using namespace ccmkkernel; using namespace ccmqmsgque; // package-item class MyServer : public MqContextC, public MqServerSetupIF { friend class MqFactoryCT<MyServer>; private: // define the factory constructor MyServer(MK_TYP const typ, MqContextC* tmpl=NULL) : MqContextC(typ,tmpl) {}; private: // service to serve all incoming requests for token "HLWO" void MyFirstService () { SendSTART(); SendV("%s World", ReadSTR()); SendRETURN(); } // define a service as link between the token "HLWO" and the callback "MyFirstService" void ServerSetup() { ServiceCreate("HLWO", MqServiceICB(&MyServer::MyFirstService)); } }; // package-main int MK_CDECL main(int argc, MK_STRN argv[]) { MqMsgque::CcMqSetup(); // setup commandline arguments for later use MkBufferListC largs = {argc, argv}; // create "MyServer" factory… and make it to the default. MqFactoryCT<MyServer>::Add("MyServer")->Default(); // inspect commandline-argument for the "factory" to choose… and create a object auto srv = MqFactoryCT<MqContextC>::GetCalled(largs)->New(); // start listen for incoming call's try { srv->LinkCreate(largs); srv->ProcessEvent (MQ_WAIT_FOREVER); } catch (const std::exception& e) { srv->ErrorCatch(e); } return srv->Exit(); }
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | fct | a MqFactoryC used to create a MqContextC |
[in] | tmpl | (C-API only) template for context intialization |
[out] | val_out | the new context object as return or MK_NULL on error |
MK_NULL
pointer