Go to the documentation of this file.
4 #define LX__QUOTE(str) #str
7 #define LX_NODE_HEADER() \
9 static void lx_field_init(); \
12 static const Core::LxFieldData** getFieldDataPtr(void); \
13 virtual const Core::LxFieldData* getFieldData(void) const; \
14 virtual const Core::LxFieldData* getParentFieldData(void) const; \
17 static const Core::LxFieldData** parentFieldData; \
18 static Core::LxFieldData* fieldData; \
19 static unsigned int classinstances; \
20 static bool lxFieldIsInit;
22 #define LX_NODE_ABSTRACT_SOURCE(_class_) \
24 unsigned int ::_class_::classinstances = 0; \
25 const Core::LxFieldData** ::_class_::parentFieldData = (const Core::LxFieldData**)0xdeadbeefLL; \
26 Core::LxFieldData* ::_class_::fieldData = nullptr; \
27 bool ::_class_::lxFieldIsInit = false; \
29 const Core::LxFieldData** _class_::getFieldDataPtr(void) { return const_cast<const Core::LxFieldData**>(&::_class_::fieldData); } \
31 const Core::LxFieldData* _class_::getFieldData(void) const { return ::_class_::fieldData; } \
33 const Core::LxFieldData* _class_::getParentFieldData(void) const { return *(::_class_::parentFieldData); }
35 #define LX_INIT(_class_, _parentclass_) \
36 void _class_::lx_field_init() \
38 ::_class_::parentFieldData = ::_parentclass_::getFieldDataPtr(); \
39 ::_class_::lxFieldIsInit = true; \
42 #define LX_INIT_NO_PARENT(_class_) \
43 void _class_::lx_field_init() \
45 _class_::parentFieldData = 0; \
46 _class_::lxFieldIsInit = true; \
49 #define LX_NODE_SOURCE(_class_, _parentclass_) \
50 LX_NODE_ABSTRACT_SOURCE(_class_) \
51 LX_INIT(_class_, _parentclass_)
53 #define LX_NODE_SOURCE_NO_PARENT(_class_) \
54 LX_NODE_ABSTRACT_SOURCE(_class_) \
55 LX_INIT_NO_PARENT(_class_)
58 #define LX_NODE_CONSTRUCTOR(_class_) \
61 ::_class_::classinstances++; \
65 assert(::_class_::lxFieldIsInit && "\nClass not init!\n"); \
66 assert((::_class_::parentFieldData != (const Core::LxFieldData**)0xdeadbeefLL) && "\nParent-Class not init\n"); \
67 if (!::_class_::fieldData) \
69 ::_class_::fieldData = new Core::LxFieldData(::_class_::parentFieldData ? *::_class_::parentFieldData : nullptr); \
75 Core::PropertyContainer::isValid(); \
78 Core::PostInitClass __postInit__(this)
81 #define LX_PRIVATE_COMMON_INIT_CODE(_class_, _parentclass_) \
85 _class_::parentFieldData = _parentclass_::getFieldDataPtr(); \
88 #define LX_NODE_INIT_CLASS_NO_PARENT(_class_) \
91 _class_::parentFieldData = 0; \
92 _class_::lxFieldIsInit = true; \
96 #define LX_NODE_INIT_CLASS(_class_, _parentclass_) \
99 LX_PRIVATE_COMMON_INIT_CODE(_class_, _parentclass_); \
100 _class_::lxFieldIsInit = true; \
103 #define LX_NODE_ADD_FIELD(_field_, _defaultval_) \
106 fieldData->addField(this, LX__QUOTE(_field_), &this->_field_); \
111 #define CONCATSTR(a, b) a##b
113 #define BUILDCLASS(CLASS, NAME, CTR, CTR2) \
114 class CONCATSTR(NAME, CTR) \
117 CONCATSTR(NAME, CTR)() { CLASS::setIfcNameAndID(LX__QUOTE(NAME), LxIfc4::NAME); } \
119 static CONCATSTR(NAME, CTR) CONCATSTR(NAME, CTR2);
123 #define DECLARE_OBJECT_FACTORY_IFC(_factoryName_, _class_, _ifc4Class_, _ifc3Class_)
127 #define DECLARE_OBJECT_FACTORY_IFC(_factoryName_, _class_, _ifc4Class_, _ifc3Class_) \
128 class _factoryName_ : public Core::ObjectFactory \
131 virtual Core::DocObject* createByFactory(Core::CoreDocument* doc) \
133 auto o = new _class_; \
134 o->setDocument(doc); \
135 o->setIfc3EntityType(LxIfc3::_ifc3Class_); \
136 o->setIfc4EntityType(LxIfc4::_ifc4Class_); \
140 BUILDCLASS(_class_, _ifc4Class_, __COUNTER__, __COUNTER__)
145 #define DECLARE_OBJECT_FACTORY_IFC(_factoryName_, _class_, _ifc4Class_, _ifc3Class_) \
146 class _factoryName_ : public Core::ObjectFactory \
149 virtual Core::DocObject* createByFactory(Core::CoreDocument* doc) \
151 auto o = new _class_; \
152 o->setDocument(doc); \
164 #define DECLARE_OBJECT_FACTORY(_factoryName_, _class_, _ifcClass_)
165 #define DECLARE_OBJECT_FACTORY_NOIFC(_factoryName_, _class_)
169 #define DECLARE_OBJECT_FACTORY(_factoryName_, _class_, _ifcClass_) \
170 class _factoryName_ : public Core::ObjectFactory \
173 virtual Core::DocObject* createByFactory(Core::CoreDocument* doc) \
175 auto o = new _class_; \
176 o->setDocument(doc); \
177 o->setIfc3EntityType(LxIfc3::_ifcClass_); \
178 o->setIfc4EntityType(LxIfc4::_ifcClass_); \
182 BUILDCLASS(_class_, _ifcClass_, __COUNTER__, __COUNTER__)
186 #define DECLARE_OBJECT_FACTORY_NOIFC(_factoryName_, _class_) \
187 class _factoryName_ : public Core::ObjectFactory \
190 virtual Core::DocObject* createByFactory(Core::CoreDocument* doc) \
192 auto o = new _class_; \
193 o->setDocument(doc); \
197 //BUILDCLASS(_class_, _ifcClass_, __COUNTER__, __COUNTER__)
203 #define DECLARE_OBJECT_FACTORY(_factoryName_, _class_, _ifcClass_) \
204 class _factoryName_ : public Core::ObjectFactory \
207 virtual Core::DocObject* createByFactory(Core::CoreDocument* doc) \
209 auto o = new _class_; \
210 o->setDocument(doc); \
215 #define DECLARE_OBJECT_FACTORY_NOIFC(_factoryName_, _class_) \
216 class _factoryName_ : public Core::ObjectFactory \
219 virtual Core::DocObject* createByFactory(Core::CoreDocument* doc) \
221 auto o = new _class_; \
222 o->setDocument(doc); \
229 #define DECLARE_TEMPLATE_OBJECT_FACTORY(_factoryName_, _class_, _ifcClass_) \
231 class _factoryName_ : public Core::ObjectFactory \
234 virtual Core::DocObject* createByFactory(Core::CoreDocument* doc) \
236 auto o = new _class_<T>; \
237 o->setDocument(doc); \
238 o->setIfc3EntityType(LxIfc3::_ifcClass_); \
245 #define REGISTER_OBJECT_FACTORY(_factoryName_, _class_) Core::ObjectFactory::registry[#_class_] = (Core::ObjectFactory*)new _factoryName_();
247 #define INIT_PROPERTY_TEMPLATES(_class_) \
248 Core::PropertyLink<_class_*>::init(qPrintable(QString("PropertyLink[%1]").arg(#_class_))); \
249 Core::PropertyLinkSet<_class_*>::init(qPrintable(QString("PropertyLinkSet[%1]").arg(#_class_))); \
250 Core::PropertyBackLink<_class_*>::init(qPrintable(QString("PropertyBackLink[%1]").arg(#_class_))); \
251 Core::PropertyBackLinkSet<_class_*>::init(qPrintable(QString("PropertyBackLinkSet[%1]").arg(#_class_))); \
252 Core::PropertyTypedLinkList<_class_*>::init(qPrintable(QString("PropertyTypedLinkList[%1]").arg(#_class_)));
254 #define DECLARE_PROPERTY_TEMPLATES(_class_, _export_symbol_) \
255 template class _export_symbol_ Core::PropertyLink<_class_*>; \
256 template class _export_symbol_ Core::PropertyLinkSet<_class_*>; \
257 template class _export_symbol_ Core::PropertyBackLink<_class_*>; \
258 template class _export_symbol_ Core::PropertyBackLinkSet<_class_*>; \
259 template class _export_symbol_ Core::PropertyTypedLinkList<_class_*>;
261 #define CREATE_FOR_TEST(_class_) \
264 class R : public _class_ \
272 v->check_lx(#_class_, __FUNCTION__); \
278 #define TYPE_FOR_SAVE_IS_PARENT() \
280 Base::Type getTypeForSave() { return getTypeId().getParent(); }
284 #define __INIT_OBJECT(_class_) \
286 INIT_PROPERTY_TEMPLATES(_class_)
288 #define LX_INIT_OBJECT(_class_) \
290 _class_::lx_field_init(); \
291 CREATE_FOR_TEST(_class_) \
292 INIT_PROPERTY_TEMPLATES(_class_)
294 #define LX_INIT_OBJECT_LINK(_class_) \
296 _class_::lx_field_init(); \
297 CREATE_FOR_TEST(_class_) \
298 INIT_PROPERTY_TEMPLATES(_class_)
300 #define LX_INIT_OBJECT_ABSTRACT(_class_) \
302 _class_::lx_field_init(); \
303 INIT_PROPERTY_TEMPLATES(_class_)