MqFactoryC - various functions to create, initialize and destroy a factory … More...
Macros | |
#define | MqFactoryAdd_1(fct) |
#define | MqFactoryAdd_2(fct, ident) |
Functions | |
MQ_EXTERN void | libmqmsgque::MqFactoryFree_RT (MK_RT const mkrt, MQ_FCT const fct) |
free internal factory memory and call libmqmsgque::MqFactoryDTorS::fFree + libmqmsgque::MqFactoryCTorS::fFree | |
MQ_EXTERN MQ_FCT | libmqmsgque::MqFactoryAdd_RT (MK_RT const mkrt, MK_OBJN const error, MqFactoryCTorF const createCallF, MK_CCP const constructor, MqFactoryDataFreeF const createDataFreeF, MqFactoryDataCopyF const createDataCopyF, MqFactoryDTorF const deleteCallF, MK_CCP const destructor, MqFactoryDataFreeF const deleteDataFreeF, MqFactoryDataCopyF const deleteDataCopyF, MK_STRN const ident) |
add a new MqFactoryC identified by factory-identifier and defined by factory-constructor … | |
MQ_EXTERN MQ_FCT | libmqmsgque::MqFactoryTypeAdd_RT (MK_RT const mkrt, MK_OBJN const error, MK_STRN const ident, MkSelfCreateF const fctCreate, MkSelfDeleteF const fctDelete, MkConstructorF const constructor, MkSelfDeleteF const selfDelete) |
add a new MqFactoryS-Object identified by a fctT | |
MQ_EXTERN MQ_FCT | libmqmsgque::MqFactoryDup2_RT (MK_RT const mkrt, MQ_FCTN const fct, MK_STRN const ident) |
create a duplicate of the singleton object MqFactoryC using a new factory-identifer | |
MqFactoryDelete | |
MQ_EXTERN void | libmqmsgque::MqFactoryDelete_RT (MK_RT const mkrt, MQ_FCT fct) |
Destructor - delete a MqFactoryC instance … | |
MqFactoryC - MqFactoryC_TOR_C_API - overload | |
#define | MqFactoryDup2_NULL(...) |
#define | MqFactoryDup2(...) |
#define | MqFactoryAdd_NULL(...) |
#define | MqFactoryAdd(...) |
#define | MqFactoryTypeAdd_NULL(...) |
#define | MqFactoryTypeAdd(...) |
#define | MqFactoryDelete(x) |
#define | MqFactoryFree_NULL(...) |
#define | MqFactoryFree(...) |
MqFactoryC - various functions to create, initialize and destroy a factory …
#define MqFactoryAdd | ( | ... | ) |
Definition at line 1042 of file msgque_overload_mq.h.
#define MqFactoryAdd_1 | ( | fct | ) |
Definition at line 3484 of file LibMqMsgque_mq.h.
#define MqFactoryAdd_2 | ( | fct, | |
ident ) |
Definition at line 3485 of file LibMqMsgque_mq.h.
#define MqFactoryAdd_NULL | ( | ... | ) |
Definition at line 1041 of file msgque_overload_mq.h.
#define MqFactoryDelete | ( | x | ) |
Definition at line 1047 of file msgque_overload_mq.h.
#define MqFactoryDup2 | ( | ... | ) |
Definition at line 1038 of file msgque_overload_mq.h.
#define MqFactoryDup2_NULL | ( | ... | ) |
Definition at line 1037 of file msgque_overload_mq.h.
#define MqFactoryFree | ( | ... | ) |
Definition at line 1051 of file msgque_overload_mq.h.
#define MqFactoryFree_NULL | ( | ... | ) |
Definition at line 1050 of file msgque_overload_mq.h.
#define MqFactoryTypeAdd | ( | ... | ) |
Definition at line 1044 of file msgque_overload_mq.h.
#define MqFactoryTypeAdd_NULL | ( | ... | ) |
Definition at line 1043 of file msgque_overload_mq.h.
MQ_EXTERN MQ_FCT libmqmsgque::MqFactoryAdd_RT | ( | MK_RT const | mkrt, |
MK_OBJN const | error, | ||
MqFactoryCTorF const | createCallF, | ||
MK_CCP const | constructor, | ||
MqFactoryDataFreeF const | createDataFreeF, | ||
MqFactoryDataCopyF const | createDataCopyF, | ||
MqFactoryDTorF const | deleteCallF, | ||
MK_CCP const | destructor, | ||
MqFactoryDataFreeF const | deleteDataFreeF, | ||
MqFactoryDataCopyF const | deleteDataCopyF, | ||
MK_STRN const | ident ) |
add a new MqFactoryC identified by factory-identifier and defined by factory-constructor …
The factory is required to get all ccmqmsgque features.
The constructor have to be a C++ [class] with superclass [MqContextC] …
new
function.MyServer
with public name "MyServer"
as a factory-class Example from Filter5.cc
→ create a new context using factory F1; F2 or F3 read from the commandline
int MK_CDECL main (int argc, MK_STRN argv[]) { MqMsgque::Setup(); // create buffer-list of the application arguments auto largs = MkBufferListC {argc, argv}; // init libmqmsgque global applications starter MqInitSetArg0VA(argv[0],NULL); // add factories MqFactoryCT<F1>::Add("F1"); MqFactoryCT<F2>::Add("F2"); MqFactoryCT<F3>::Add("F3"); // call factory using the !second! application argument, // first argument is the executable self MqContextC *filter = MqFactoryCT<MqContextC>::GetCalled(&largs)->New(); try { // configure and start the server filter->LinkCreate (largs); // start event-loop and wait forever filter->ProcessEvent (MQ_WAIT_FOREVER); } catch (const exception& e) { // set the libmqmsgque error form the c++ error filter->ErrorCatch(e); } filter->Exit(); }
[in] | mkrt | the MkRuntimeS instance to work on - the runtime argument, used by MK_RT_CALL (C-only) |
[in] | error | (C-API) flag to signal how to report an error. valid values are: MK_ERROR_PANIC, MK_ERROR_PRINT, MK_ERROR_IGNORE or an other MqContextC |
[in] | ident | the factory-identifier, if MK_NULL or EMPTY the class-name is used. The ident is the public identifier (name) of the factory and is used in logging-output (MqLog...) , name-resolution (MqFactoryGet...) and an first parameter in the executable-call: myserver ident ... . |
[in] | createCallF | (C-API) object constructor function |
[in] | constructor | object (class) constructor data |
[in] | createDataFreeF | (C-API) object constructor data free function |
[in] | createDataCopyF | (C-API) object copy-constructor data free function |
[in] | deleteCallF | (C-API) object destructor function |
[in] | destructor | object (class) destructor data |
[in] | deleteDataFreeF | (C-API) object destructor data free function |
[in] | deleteDataCopyF | (C-API) object copy-constructor data free function |
MK_NULL
on errorDestructor - delete a MqFactoryC instance …
The factory-delete is more a pseudo-delete because a factory is always in-duty:
MQ_EXTERN MQ_FCT libmqmsgque::MqFactoryDup2_RT | ( | MK_RT const | mkrt, |
MQ_FCTN const | fct, | ||
MK_STRN const | ident ) |
create a duplicate of the singleton object MqFactoryC using a new factory-identifer
free internal factory memory and call libmqmsgque::MqFactoryDTorS::fFree + libmqmsgque::MqFactoryCTorS::fFree
MQ_EXTERN MQ_FCT libmqmsgque::MqFactoryTypeAdd_RT | ( | MK_RT const | mkrt, |
MK_OBJN const | error, | ||
MK_STRN const | ident, | ||
MkSelfCreateF const | fctCreate, | ||
MkSelfDeleteF const | fctDelete, | ||
MkConstructorF const | constructor, | ||
MkSelfDeleteF const | selfDelete ) |
add a new MqFactoryS-Object identified by a fctT
This factory is used for template based factories like in C++.
MqFactoryCT<Server>::Add("server")->Default();
A template create for every new class Server a new factory object. Both, the new Server and the new factory require own functions for self create.Example from MqFactoryC_cc.hh
→ create the self constructor/destructor