Go to the documentation of this file. 6 #define LX__QUOTE(str) #str 9 #define LX_NODE_HEADER() \ 11 static void lx_field_init(); \ 14 static const Core::LxFieldData** getFieldDataPtr(void); \ 15 virtual const Core::LxFieldData* getFieldData(void) const; \ 16 virtual const Core::LxFieldData* getParentFieldData(void) const; \ 19 static const Core::LxFieldData** parentFieldData; \ 20 static Core::LxFieldData* fieldData; \ 21 static unsigned int classinstances; \ 22 static bool lxFieldIsInit; 24 #define LX_NODE_ABSTRACT_SOURCE(_class_) \ 26 unsigned int ::_class_::classinstances = 0; \ 27 const Core::LxFieldData** ::_class_::parentFieldData = (const Core::LxFieldData**)0xdeadbeefLL; \ 28 Core::LxFieldData* ::_class_::fieldData = NULL; \ 29 bool ::_class_::lxFieldIsInit = false; \ 31 const Core::LxFieldData** _class_::getFieldDataPtr(void) { return const_cast<const Core::LxFieldData**>(&::_class_::fieldData); } \ 33 const Core::LxFieldData* _class_::getFieldData(void) const { return ::_class_::fieldData; } \ 35 const Core::LxFieldData* _class_::getParentFieldData(void) const { return *(::_class_::parentFieldData); } 37 #define LX_INIT(_class_, _parentclass_) \ 38 void _class_::lx_field_init() \ 40 ::_class_::parentFieldData = ::_parentclass_::getFieldDataPtr(); \ 41 ::_class_::lxFieldIsInit = true; \ 44 #define LX_INIT_NO_PARENT(_class_) \ 45 void _class_::lx_field_init() \ 47 _class_::parentFieldData = 0; \ 48 _class_::lxFieldIsInit = true; \ 51 #define LX_NODE_SOURCE(_class_, _parentclass_) \ 52 LX_NODE_ABSTRACT_SOURCE(_class_) \ 53 LX_INIT(_class_, _parentclass_) 55 #define LX_NODE_SOURCE_NO_PARENT(_class_) \ 56 LX_NODE_ABSTRACT_SOURCE(_class_) \ 57 LX_INIT_NO_PARENT(_class_) 60 #define LX_NODE_CONSTRUCTOR(_class_) \ 63 ::_class_::classinstances++; \ 67 assert(::_class_::lxFieldIsInit && "\nClass not init!\n"); \ 68 assert((::_class_::parentFieldData != (const Core::LxFieldData**)0xdeadbeefLL) && "\nParent-Class not init\n"); \ 69 if (!::_class_::fieldData) \ 71 ::_class_::fieldData = new Core::LxFieldData(::_class_::parentFieldData ? *::_class_::parentFieldData : NULL); \ 77 Core::PropertyContainer::isValid(); \ 80 Core::PostInitClass __postInit__(this) 83 #define LX_PRIVATE_COMMON_INIT_CODE(_class_, _parentclass_) \ 87 _class_::parentFieldData = _parentclass_::getFieldDataPtr(); \ 90 #define LX_NODE_INIT_CLASS_NO_PARENT(_class_) \ 93 _class_::parentFieldData = 0; \ 94 _class_::lxFieldIsInit = true; \ 98 #define LX_NODE_INIT_CLASS(_class_, _parentclass_) \ 101 LX_PRIVATE_COMMON_INIT_CODE(_class_, _parentclass_); \ 102 _class_::lxFieldIsInit = true; \ 105 #define LX_NODE_ADD_FIELD(_field_, _defaultval_) \ 108 fieldData->addField(this, LX__QUOTE(_field_), &this->_field_); \ 113 #define CONCATSTR(a, b) a##b 115 #define BUILDCLASS(CLASS, NAME, CTR, CTR2) \ 116 class CONCATSTR(NAME, CTR) \ 119 CONCATSTR(NAME, CTR)() { CLASS::setIfcNameAndID(LX__QUOTE(NAME), LxIfc4::NAME); } \ 121 static CONCATSTR(NAME, CTR) CONCATSTR(NAME, CTR2); 125 #define DECLARE_OBJECT_FACTORY_IFC(_factoryName_, _class_, _ifc4Class_, _ifc3Class_) 129 #define DECLARE_OBJECT_FACTORY_IFC(_factoryName_, _class_, _ifc4Class_, _ifc3Class_) \ 130 class _factoryName_ : public Core::ObjectFactory \ 133 virtual Core::DocObject* createByFactory(Core::CoreDocument* doc) \ 135 auto o = new _class_; \ 136 o->setDocument(doc); \ 137 o->setIfc3EntityType(LxIfc3::_ifc3Class_); \ 138 o->setIfc4EntityType(LxIfc4::_ifc4Class_); \ 142 BUILDCLASS(_class_, _ifc4Class_, __COUNTER__, __COUNTER__) 147 #define DECLARE_OBJECT_FACTORY_IFC(_factoryName_, _class_, _ifc4Class_, _ifc3Class_) \ 148 class _factoryName_ : public Core::ObjectFactory \ 151 virtual Core::DocObject* createByFactory(Core::CoreDocument* doc) \ 153 auto o = new _class_; \ 154 o->setDocument(doc); \ 166 #define DECLARE_OBJECT_FACTORY(_factoryName_, _class_, _ifcClass_) 167 #define DECLARE_OBJECT_FACTORY_NOIFC(_factoryName_, _class_) 171 #define DECLARE_OBJECT_FACTORY(_factoryName_, _class_, _ifcClass_) \ 172 class _factoryName_ : public Core::ObjectFactory \ 175 virtual Core::DocObject* createByFactory(Core::CoreDocument* doc) \ 177 auto o = new _class_; \ 178 o->setDocument(doc); \ 179 o->setIfc3EntityType(LxIfc3::_ifcClass_); \ 180 o->setIfc4EntityType(LxIfc4::_ifcClass_); \ 184 BUILDCLASS(_class_, _ifcClass_, __COUNTER__, __COUNTER__) 188 #define DECLARE_OBJECT_FACTORY_NOIFC(_factoryName_, _class_) \ 189 class _factoryName_ : public Core::ObjectFactory \ 192 virtual Core::DocObject* createByFactory(Core::CoreDocument* doc) \ 194 auto o = new _class_; \ 195 o->setDocument(doc); \ 199 //BUILDCLASS(_class_, _ifcClass_, __COUNTER__, __COUNTER__) 205 #define DECLARE_OBJECT_FACTORY(_factoryName_, _class_, _ifcClass_) \ 206 class _factoryName_ : public Core::ObjectFactory \ 209 virtual Core::DocObject* createByFactory(Core::CoreDocument* doc) \ 211 auto o = new _class_; \ 212 o->setDocument(doc); \ 217 #define DECLARE_OBJECT_FACTORY_NOIFC(_factoryName_, _class_) \ 218 class _factoryName_ : public Core::ObjectFactory \ 221 virtual Core::DocObject* createByFactory(Core::CoreDocument* doc) \ 223 auto o = new _class_; \ 224 o->setDocument(doc); \ 231 #define DECLARE_TEMPLATE_OBJECT_FACTORY(_factoryName_, _class_, _ifcClass_) \ 233 class _factoryName_ : public Core::ObjectFactory \ 236 virtual Core::DocObject* createByFactory(Core::CoreDocument* doc) \ 238 auto o = new _class_<T>; \ 239 o->setDocument(doc); \ 240 o->setIfc3EntityType(LxIfc3::_ifcClass_); \ 247 #define REGISTER_OBJECT_FACTORY(_factoryName_, _class_) Core::ObjectFactory::registry[#_class_] = (Core::ObjectFactory*)new _factoryName_(); 249 #define INIT_PROPERTY_TEMPLATES(_class_) \ 250 Core::PropertyLink<_class_*>::init(qPrintable(QString("PropertyLink[%1]").arg(#_class_))); \ 251 Core::PropertyLinkSet<_class_*>::init(qPrintable(QString("PropertyLinkSet[%1]").arg(#_class_))); \ 252 Core::PropertyBackLink<_class_*>::init(qPrintable(QString("PropertyBackLink[%1]").arg(#_class_))); \ 253 Core::PropertyBackLinkSet<_class_*>::init(qPrintable(QString("PropertyBackLinkSet[%1]").arg(#_class_))); \ 254 Core::PropertyTypedLinkList<_class_*>::init(qPrintable(QString("PropertyTypedLinkList[%1]").arg(#_class_))); 256 #define DECLARE_PROPERTY_TEMPLATES(_class_, _export_symbol_) \ 257 template class _export_symbol_ Core::PropertyLink<_class_*>; \ 258 template class _export_symbol_ Core::PropertyLinkSet<_class_*>; \ 259 template class _export_symbol_ Core::PropertyBackLink<_class_*>; \ 260 template class _export_symbol_ Core::PropertyBackLinkSet<_class_*>; \ 261 template class _export_symbol_ Core::PropertyTypedLinkList<_class_*>; 263 #define CREATE_FOR_TEST(_class_) \ 266 class R : public _class_ \ 274 v->check_lx(#_class_, __FUNCTION__); \ 280 #define TYPE_FOR_SAVE_IS_PARENT() \ 282 Base::Type getTypeForSave() { return getTypeId().getParent(); } 286 #define __INIT_OBJECT(_class_) \ 288 INIT_PROPERTY_TEMPLATES(_class_) 290 #define LX_INIT_OBJECT(_class_) \ 292 _class_::lx_field_init(); \ 293 CREATE_FOR_TEST(_class_) \ 294 INIT_PROPERTY_TEMPLATES(_class_) 296 #define LX_INIT_OBJECT_LINK(_class_) \ 298 _class_::lx_field_init(); \ 299 CREATE_FOR_TEST(_class_) \ 300 INIT_PROPERTY_TEMPLATES(_class_) 302 #define LX_INIT_OBJECT_ABSTRACT(_class_) \ 304 _class_::lx_field_init(); \ 305 INIT_PROPERTY_TEMPLATES(_class_)