theLink 10.0
Loading...
Searching...
No Matches
MqFactoryC_cc.hh
Go to the documentation of this file.
1
9/* LABEL-INIT */
10
11#pragma once
12
13namespace ccmqmsgque {
14
17 typedef struct {
21
24 class MqFactoryC : public MkObjectC {
25
26 friend class MqMsgque;
27 template <class T> friend class MqFactoryCT;
28
29/* LABEL-START */
30
33
34 public:
35 static thread_local MqFactoryC MK_NULL_REF;
36
37 private:
38
40 return (hdl != NULL ? static_cast<MqFactoryC*>((*MqFactoryC_X2obj(hdl)).self) : &MK_NULL_REF);
41 }
42
43 #ifdef MqFactoryC_selfCreate_overload
44 static MK_PTR MqFactoryC_selfCreate (MK_RT_ARGS MK_OBJ obj, MK_PTR const env);
45 #else
47 return new MqFactoryC(obj);
48 }
49 #endif
50
52 delete static_cast<MqFactoryC*>(self);
53 }
54
56 MqFactoryC* selfO = static_cast<MqFactoryC*>(self);
57 selfO->atomUnlink();
58 }
59
61
62
66
67#ifndef META_IS_MkObjectC
68 MqFactoryC (MK_OBJ obj) : MkObjectC(obj) {};
69#endif
70
71 public:
72
73#ifndef META_IS_MkObjectC
75#endif
76
81
83 MQ_FCT getFCT() const {
84 MQ_FCT ret = reinterpret_cast<MQ_FCT>(hdl);
85 if (unlikely(ret == NULL)) InstHdlIsNullError();
86 return ret;
87 };
88
91 return reinterpret_cast<MQ_FCT>(hdl);
92 };
93
95 MQ_FCTN getFCTN() const {
96 MQ_FCTN ret = reinterpret_cast<MQ_FCTN>(hdl);
97 if (unlikely(ret == NULL)) InstHdlIsNullError();
98 return ret;
99 };
100
103 return reinterpret_cast<MQ_FCTN>(hdl);
104 };
105
107 static MQ_FCT getFCT(MqFactoryC* clsHdl) {
108 MQ_FCT ret = clsHdl ? reinterpret_cast<MQ_FCT>(clsHdl->hdl) : NULL;
109 if (unlikely(ret == NULL)) ClassHdlIsNullError(MqFactoryC);
110 return ret;
111 };
112
115 return clsHdl ? reinterpret_cast<MQ_FCT>(clsHdl->hdl) : NULL;
116 };
117
119 static MQ_FCTN getFCTN(const MqFactoryC* clsHdl) {
120 MQ_FCTN ret = clsHdl ? reinterpret_cast<MQ_FCTN>(clsHdl->hdl) : NULL;
121 if (unlikely(ret == NULL)) ClassHdlIsNullError(MqFactoryC);
122 return ret;
123 };
124
126 static MQ_FCTN getFCTN__null_allow(const MqFactoryC* clsHdl) {
127 return clsHdl ? reinterpret_cast<MQ_FCTN>(clsHdl->hdl) : NULL;
128 };
129
131 static MQ_FCT getFCT(const MqFactoryC& clsHdl) {
132 return clsHdl.getFCT();
133 };
134
136 static MQ_FCT getFCT__null_allow(const MqFactoryC& clsHdl) {
137 return clsHdl.getFCT__null_allow();
138 };
139
141 static MQ_FCTN getFCTN(const MqFactoryC& clsHdl) {
142 return clsHdl.getFCTN();
143 };
144
146 static MQ_FCTN getFCTN__null_allow(const MqFactoryC& clsHdl) {
147 return clsHdl.getFCTN__null_allow();
148 };
149
151 bool Check() const {
152 return (hdl && MqFctCheck(hdl));
153 };
154
155/* LABEL-END */
156
157 private:
158
160
161 // BEGIN-MqFactoryC - created by 'cc_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
162
166
167 public:
168
169 // doc-key: MqFactoryC,MqFactoryC-Class-Export,sc_,public
170
172 static MqFactoryC* HandleResolve (MK_HDL netHdl);
173
174 // doc-key: MqFactoryC,MqFactoryC-Class-Export,om_,public
175
176 // skip class-overload: MK_HDL HandleGet ()
177
179 // MqFactoryC_Class_CC_API
180
184
185 public:
186
187 // doc-key: MqFactoryC,MqFactoryC-Class-Introspection,oc_,public
188
190 MqFactoryC* Next ();
191
193 MqFactoryC* Prev ();
194
195 // doc-key: MqFactoryC,MqFactoryC-Class-Introspection,sc_,public
196
198 static MqFactoryC* Instances ();
199
201 // MqFactoryC_Class_CC_API
202
206
207 public:
208
209 // doc-key: MqFactoryC,MqFactoryC-Class-Misc,sc_,public
210
212 static MqFactoryC* GetNull ();
213
215 // MqFactoryC_Class_CC_API
216
220
221 public:
222
223 // doc-key: MqFactoryC,MqFactoryC-Get,sc_,public
224
226 static MqFactoryC* Get (MK_STRN ident = "");
227
229 static MqFactoryC* GetCalled (MK_STRN ident = "");
230
232 static MqFactoryC* GetCalled (const MkBufferListC* largs);
233
235 static MqFactoryC* GetCalled (const MkBufferListC& largs);
236
237 // doc-key: MqFactoryC,MqFactoryC-Get,om_,public
238
240 MK_STRN GetOriginalIdent () const;
241
243 // MqFactoryC_Get_CC_API
244
248
249 public:
250
251 // doc-key: MqFactoryC,MqFactoryC-Misc,oc_,public
252
255
258
259 // doc-key: MqFactoryC,MqFactoryC-Misc,oco,public
260
262 virtual MqContextC* New ();
263
264 // doc-key: MqFactoryC,MqFactoryC-Misc,om_,public
265
266 // skip class-overload: void Log (const MkObjectC* fmtobj = NULL, MK_DBG debug = 0, MK_STRN callfunc = __builtin_FUNCTION(), MK_I32 lvl = 0) const
267
268 // skip class-overload: void Log (const MkObjectC& fmtobj, MK_DBG debug = 0, MK_STRN callfunc = __builtin_FUNCTION(), MK_I32 lvl = 0) const
269
270 // doc-key: MqFactoryC,MqFactoryC-Misc,sm_,public
271
273 static MK_STRN DefaultIdent ();
274
276 static MK_STRN InitialIdent ();
277
279 static void LogAll (MK_STRN callfunc = __builtin_FUNCTION());
280
282 // MqFactoryC_Misc_CC_API
283
287
288 public:
289
290 // doc-key: MqFactoryC,MqFactoryC-TOR,oCx,public
291
293 MqFactoryC* Dup2 (MK_STRN ident) const;
294
296 MqFactoryC* Dup2 (const std::string& ident) const;
297
299 // MqFactoryC_TOR_CC_API
300
301 // END-MqFactoryC - created by 'cc_MqS.tcl -i NHI1_HOME/theLink/c/gen/c_mqmsgque.meta' - DO NOT change
302
304 };
305
308
310 template <class T>
311 class MqFactoryCT : public MqFactoryC {
312
313 friend class MqStaticC;
314
315 private:
317
318//MkSysPrintStackTrace(libmqmsgque::MK_ERROR_PRINT, __func__);
319//self->LogObj();
320
321 // [self_example]
323 static MK_OBJ ObjectSelfCreate (MK_RT_ARGS MK_TYP const type, MK_PTR const tmpl, MK_PTR const lnk) {
324 T* self = NULL;
325 try {
326
327//printV("type=%p, tmpl=%p", type, tmpl)
328//MkRuntimeC::Debug();
329
330 // !! attention !! if the constructor has a BUG the destructor is called and the "c++ obj" becomes unusable
331 self = new T(type, static_cast<MqContextC*>(tmpl));
332 if (self) self->Init();
333 } catch (const std::exception& ex) {
334//MkRuntimeC::Debug();
335 MkErrorC::DEFAULT()->Catch(ex)->Stack();
336 }
337//self->DbgLogC();
338 return self?self->hdl:NULL;
339 }
340
341 static void ObjectSelfDelete (MK_RT_ARGS MK_PTR selfP, MK_PTR env) {
342 T* self = static_cast<T*>(selfP);
343//self->DbgLogC();
344 delete self;
345 }
346
348 return new MqFactoryCT<T>(obj);
349 }
350
351 static void FactorySelfDelete (MK_RT_ARGS MK_PTR selfptr, MK_PTR env) {
352 delete static_cast<MqFactoryCT<T>*>(selfptr);
353 }
354 // [self_example]
355
357
361
362 public:
363
365 static MqFactoryCT<T>* Add(MK_STRN ident) {
369 ));
370 if (ret == NULL) {
371 if (MkErrorCheckE_NULL()) {
373 } else {
374 throw MkConstructorNullExceptionC(ident);
375 }
376 }
377 return ret;
378 }
379
384
386 inline T* New() {
387 return static_cast<T*>(MqFactoryC::New());
388 }
389
391 return (MQ_CTXT)getFCT()->fct_ctor.data;
392 }
393 };
394
396
397}
PUBLIC data structure for the ccmqmsgque-specific-data → C-API: libmqmsgque::MqContextS
template wrapper for libmqmsgque::MqFactoryS
T * New()
C++: MqContextC* fct.New() → C-API create a new MqContextC from a MqFactoryC …
static MK_OBJ ObjectSelfCreate(MK_RT_ARGS MK_TYP const type, MK_PTR const tmpl, MK_PTR const lnk)
self-constructer : called if a new instance is required …
static MqFactoryCT< T > * Add(MK_STRN ident)
Add a new MqFactoryC identified by factory-identifier and defined by factory-constructor … → C-API...
static MqFactoryCT< T > * MqFactoryCT_ObjNew(MK_RT_ARGS MQ_FCT fct)
static void FactorySelfDelete(MK_RT_ARGS MK_PTR selfptr, MK_PTR env)
static MqFactoryCT< T > * Get(MK_STRN ident="")
static void ObjectSelfDelete(MK_RT_ARGS MK_PTR selfP, MK_PTR env)
static MK_PTR FactorySelfCreate(MK_RT_ARGS MK_OBJ obj, MK_PTR dmy)
data used to define a factory → C-API: libmqmsgque::MqFactoryS
MqMsgque PACKAGE - the package is the toplevel structure of the ccmqmsgque …
static constructor for ccmqmsgque …
MkErrorC * Catch(std::exception *exception=NULL, MK_STRN callfunc=__builtin_FUNCTION())
MkErrorE Stack(MK_STRN callfunc=__builtin_FUNCTION(), MK_STRN callfile=__builtin_FILE(), MK_I32 callline=__builtin_LINE())
void Raise() const
static MkErrorC * DEFAULT()
#define MK_ERROR_FORMAT
#define unlikely(x)
int32_t MK_HDL
int32_t MK_NUM
MK_PTRB * MK_PTR
const MK_STRB * MK_STRN
static MK_PTR atomObjCreate(MK_RT_ARGS MK_OBJ obj)
void atomInit(MK_OBJ obj)
static MK_PTR atomObjNew(MK_RT_ARGS MK_OBJ obj)
#define MkOBJ(x)
#define MK_RT_CALL
#define MK_RT_ARGS
#define MK_RT_NULL
#define MkRtSetup_NULL
static MQ_FCTN getFCTN(const MqFactoryC *clsHdl)
(const) return LibMsgqueObject from current MqFactoryC pointer
static MQ_FCT getFCT(MqFactoryC *clsHdl)
return LibMsgqueObject from current MqFactoryC pointer
static MQ_FCTN getFCTN__null_allow(const MqFactoryC *clsHdl)
(const) return LibMsgqueObject from current MqFactoryC pointer
bool Check() const
check if pointer is still valid
static void MqFactoryC_selfUnlink(MK_RT_ARGS MK_PTR self, MK_PTR env)
static MK_PTR MqFactoryC_selfCreate(MK_RT_ARGS MK_OBJ obj, MK_PTR const env)
MQ_FCTN getFCTN() const
(const) return the LibMsgqueObject from current MqFactoryC instance
void MqFactoryC_Init(MQ_FCT hdl)
static void MqFactoryC_selfDelete(MK_RT_ARGS MK_PTR self, MK_PTR env)
static MQ_FCTN getFCTN(const MqFactoryC &clsHdl)
(const) return LibMsgqueObject from current MqFactoryC reference
static MqFactoryC * MqFactoryC_GetSelf(MQ_FCT hdl)
MQ_FCT getFCT() const
return the LibMsgqueObject from current MqFactoryC instance
static MqFactoryC * MqFactoryC_ObjNew(MK_RT_ARGS MQ_FCT hdl)
return MqFactoryC from LibMsgqueObject
static MQ_FCTN getFCTN__null_allow(const MqFactoryC &clsHdl)
(const) return LibMsgqueObject from current MqFactoryC reference
static MQ_FCT getFCT(const MqFactoryC &clsHdl)
return LibMsgqueObject from current MqFactoryC reference
static thread_local MqFactoryC MK_NULL_REF
static MqFactoryC * MqFactoryC_ObjCreate(MK_RT_ARGS MQ_FCT hdl)
static MQ_FCT getFCT__null_allow(const MqFactoryC &clsHdl)
return LibMsgqueObject from current MqFactoryC reference
MQ_FCTN getFCTN__null_allow() const
(const) return the LibMsgqueObject from current MqFactoryC instance
MQ_FCT getFCT__null_allow() const
return the LibMsgqueObject from current MqFactoryC instance
static MQ_FCT getFCT__null_allow(MqFactoryC *clsHdl)
return LibMsgqueObject from current MqFactoryC pointer
MqFactoryC * Next()
C++: MqFactoryC* fct.Next() → C-API get next instance from linked-list of MqFactoryS type
static MqFactoryC * Instances()
C++: [static] MqFactoryC* MqFactoryC::Instances() → C-API get head-instance from linked-list of ...
static MqFactoryC * HandleResolve(MK_HDL netHdl)
C++: [static] MqFactoryC* MqFactoryC::HandleResolve(MK_HDL netHdl) → C-API Handle-Resolve-Slot -...
static MqFactoryC * GetNull()
C++: [static] MqFactoryC* MqFactoryC::GetNull() → C-API Null-Slot - return a MqFactoryC typed NU...
MqFactoryC * Prev()
C++: MqFactoryC* fct.Prev() → C-API get previous instance from linked-list of MqFactoryS type
#define MqFactoryC_X2obj(x)
static bool MqFctCheck(MK_MNGN mng)
check MqFactoryS -> libmkkernel::MkObjectS::signature …
MK_STRN GetOriginalIdent() const
C++: MK_STRN fct.GetOriginalIdent() → C-API helper function to return MqFactoryS::originalIdent
static MqFactoryC * Get(MK_STRN ident="")
C++: [static] MqFactoryC* MqFactoryC::Get(MK_STRN ident = "") → C-API return the MqFactoryC
static MqFactoryC * GetCalled(MK_STRN ident="")
C++: [static] MqFactoryC* MqFactoryC::GetCalled(MK_STRN ident = "") → C-API returns the MqFactor...
#define MqFactoryGet(...)
static void LogAll(MK_STRN callfunc=__builtin_FUNCTION())
C++: [static] MqFactoryC::LogAll(MK_STRN callfunc = __builtin_FUNCTION()) → C-API log all "facto...
virtual MqContextC * New()
C++: MqContextC* fct.New() → C-API create a new MqContextC from a MqFactoryC …
static MK_STRN DefaultIdent()
C++: [static] MK_STRN MqFactoryC::DefaultIdent() → C-API return the factory-identifier of the de...
MqFactoryC * Default()
C++: MqFactoryC* fct.Default() → C-API set the default-attribute to the factory …
static MK_STRN InitialIdent()
C++: [static] MK_STRN MqFactoryC::InitialIdent() → C-API return the factory-identifier of the in...
MqFactoryC * Initial()
C++: MqFactoryC* fct.Initial() → C-API set the initial-attribut to fct …
MqFactoryC * Dup2(MK_STRN ident) const
C++: [constructor] MqFactoryC* fct.Dup2(MK_STRN ident) → C-API create a duplicate of the singlet...
#define MqFactoryTypeAdd(...)
namespace for the CcMqMsgque "C++"-API
data used to define a factory → C-API: libmqmsgque::MqFactoryS
MK_PTR data
additional data pointer for the fCall
data used to define a factory
struct MqFactoryCTorS fct_ctor
instance constructor interface
MqTypeCtxS - the instance-base for the MqContextC …