theLink 10.0
Loading...
Searching...
No Matches
MqCall_cc.cc
Go to the documentation of this file.
1
9/* LABEL-NO */
10
11#define META_FILE_NAME "MqCall_cc.cc"
12
13/*****************************************************************************/
14/* */
15/* context */
16/* */
17/*****************************************************************************/
18
19#include <iostream>
20#include <exception>
21#include <typeinfo>
22
23#include "private_cc.hh"
24
25namespace ccmqmsgque {
26
29 MQ_CTX const context,
30 MqServiceCallbackC* const copy,
31 MqContextC *self
32 ) {
34 MK_CBP ret = NULL;
35 switch (copy->type) {
36 case PC_MqEventIF: {
37 auto val = dynamic_cast<MqEventIF*const>(tgt);
38 ret = new MqServiceCallbackC(PC_MqEventIF, val, self);
39 if (!val) context->setup.Event.fCall = NULL;
40 break;
41 }
42 case PC_MqBgErrorIF: {
43 auto val = dynamic_cast<MqBgErrorIF*const>(tgt);
44 ret = new MqServiceCallbackC(PC_MqBgErrorIF, val, self);
45 if (!val) context->setup.BgError.fCall = NULL;
46 break;
47 }
48 case PC_MqServerSetupIF: {
49 auto val = dynamic_cast<MqServerSetupIF*const>(tgt);
50 ret = new MqServiceCallbackC(PC_MqBgErrorIF, val, self);
51 if (!val) context->setup.ServerSetup.fCall = NULL;
52 break;
53 }
55 auto val = dynamic_cast<MqServerCleanupIF*const>(tgt);
56 ret = new MqServiceCallbackC(PC_MqBgErrorIF, val, self);
57 if (!val) context->setup.ServerCleanup.fCall = NULL;
58 break;
59 }
60 default:
61 XE(context)
62 break;
63 }
64 return ret;
65 }
66
68 {
69 delete static_cast<MqServiceCallbackC*>(*dataP);
70 *dataP = NULL;
71 }
72
74 {
75 *dataP = MqServiceCallbackC::Create(MK_RT_CALL mqctx, static_cast<struct MqServiceCallbackC *> (*dataP));
76 }
77
79 {
81
82 MqServiceCallbackC * const pdata = static_cast<struct MqServiceCallbackC * const> (__data__);
84 try {
85
86 switch (pdata->type) {
87 case PC_MqTokenICB:
88 (self->*pdata->call.Callback)();
89 break;
90 case PC_MqTokenCCB:
91 (*pdata->call.StaticCallback)(self);
92 break;
93 case PC_MqServiceIF:
94 (pdata->call.Service->Service)(self);
95 break;
96 case PC_MqEventIF:
97 (pdata->call.Event->Event)();
98 break;
99 case PC_MqBgErrorIF:
100 (pdata->call.BgError->BgError)();
101 break;
103 (pdata->call.ServerSetup->ServerSetup)();
104 break;
106 (pdata->call.ServerCleanup->ServerCleanup)();
107 break;
108 }
109
110 } catch (const MkExceptionC& ex) {
111 MkExceptionC::Catch(mqctx,ex);
112 } catch (const std::exception& ex) {
113 MkExceptionC::Catch(mqctx,ex);
114 } catch (...) {
115 // http://groups.google.com/group/comp.programming.threads/browse_thread/thread/652bcf186fbbf697/f63757846514e5e5
116 throw;
117 }
118
119 // everything is OK
120 return MkErrorStack_0E_Check();
121 }
122
123} // END - namespace "ccmqmsgque"
124
implements the ccmqmsgque API object: ConfigSetBgError
virtual void BgError()=0
PUBLIC data structure for the ccmqmsgque-specific-data → C-API: libmqmsgque::MqContextS
implements the ccmqmsgque API object: ConfigSetEvent
virtual void Event()=0
implements the ccmqmsgque API object: ConfigSetServerCleanup
virtual void ServerCleanup()=0
implements the ccmqmsgque API object: ConfigSetServerSetup
virtual void ServerSetup()=0
virtual void Service(MqContextC *const ctx)=0
#define MkErrorStack_0E_Check()
static MK_ERR Catch(MK_MNGN const expobj, std::exception const *exception, MK_STRN const callfunc=__builtin_FUNCTION())
MK_PTRB * MK_CBP
#define MK_RT_CALL
#define MK_RT_ARGS
static MqContextC * MqContextC_GetSelf(MQ_CTX hdl)
#define MQ_SERVICE_CALL_CHECK
#define MQ_SERVICE_FREE_ARGS
the libmqmsgque::MqDataFreeF arguments with default names
#define MQ_SERVICE_CALL_ARGS
the libmqmsgque::MqTokenF arguments with default names
#define MQ_SERVICE_COPY_ARGS
the libmqmsgque::MqDataFreeF arguments with default names
namespace for the CcMqMsgque "C++"-API
infrastructur to use the ccmqmsgque specific callback …
Definition MqCall_cc.hh:18
MqServiceCallbackC(enum MqServiceCallbackE type, union MqServiceCallbackU call, MqContextC *self)
Definition MqCall_cc.hh:52
static MK_CBP Create(MK_RT mkrt, MqContextC::MqTokenICB const callback, MqContextC *self=NULL)
Definition MqCall_cc.hh:57
static enum MkErrorE Call(MQ_SERVICE_CALL_ARGS)
Definition MqCall_cc.cc:78
enum ccmqmsgque::MqServiceCallbackC::MqServiceCallbackE type
static void Copy(MQ_SERVICE_COPY_ARGS)
Definition MqCall_cc.cc:73
static void Free(MQ_SERVICE_FREE_ARGS)
Definition MqCall_cc.cc:67
union ccmqmsgque::MqServiceCallbackC::MqServiceCallbackU call
PUBLIC data structure for the ccmqmsgque-specific-data