OpenLexocad  27.1
PropertyMacros.h File Reference
#include <map>
#include <string>

Go to the source code of this file.

Macros

#define LX__QUOTE(str)   #str
 
#define LX_NODE_HEADER()
 
#define LX_NODE_ABSTRACT_SOURCE(_class_)
 
#define LX_INIT(_class_, _parentclass_)
 
#define LX_INIT_NO_PARENT(_class_)
 
#define LX_NODE_SOURCE(_class_, _parentclass_)
 
#define LX_NODE_SOURCE_NO_PARENT(_class_)
 
#define LX_NODE_CONSTRUCTOR(_class_)
 
#define LX_PRIVATE_COMMON_INIT_CODE(_class_, _parentclass_)
 
#define LX_NODE_INIT_CLASS_NO_PARENT(_class_)
 
#define LX_NODE_INIT_CLASS(_class_, _parentclass_)
 
#define LX_NODE_ADD_FIELD(_field_, _defaultval_)
 
#define CONCATSTR(a, b)   a##b
 
#define BUILDCLASS(CLASS, NAME, CTR, CTR2)
 
#define DECLARE_OBJECT_FACTORY_IFC(_factoryName_, _class_, _ifc4Class_, _ifc3Class_)
 
#define DECLARE_OBJECT_FACTORY(_factoryName_, _class_, _ifcClass_)
 
#define DECLARE_OBJECT_FACTORY_NOIFC(_factoryName_, _class_)
 
#define DECLARE_TEMPLATE_OBJECT_FACTORY(_factoryName_, _class_, _ifcClass_)
 
#define REGISTER_OBJECT_FACTORY(_factoryName_, _class_)   Core::ObjectFactory::registry[#_class_] = (Core::ObjectFactory*)new _factoryName_();
 
#define INIT_PROPERTY_TEMPLATES(_class_)
 
#define DECLARE_PROPERTY_TEMPLATES(_class_, _export_symbol_)
 
#define CREATE_FOR_TEST(_class_)
 
#define TYPE_FOR_SAVE_IS_PARENT()
 
#define __INIT_OBJECT(_class_)
 
#define LX_INIT_OBJECT(_class_)
 
#define LX_INIT_OBJECT_LINK(_class_)
 
#define LX_INIT_OBJECT_ABSTRACT(_class_)
 

Macro Definition Documentation

◆ __INIT_OBJECT

#define __INIT_OBJECT (   _class_)
Value:
_class_::init(); \
INIT_PROPERTY_TEMPLATES(_class_)

◆ BUILDCLASS

#define BUILDCLASS (   CLASS,
  NAME,
  CTR,
  CTR2 
)
Value:
class CONCATSTR(NAME, CTR) \
{ \
public: \
CONCATSTR(NAME, CTR)() { CLASS::setIfcNameAndID(LX__QUOTE(NAME), LxIfc4::NAME); } \
}; \
static CONCATSTR(NAME, CTR) CONCATSTR(NAME, CTR2);
#define CONCATSTR(a, b)
Definition: PropertyMacros.h:113
#define LX__QUOTE(str)
Definition: PropertyMacros.h:6

◆ CONCATSTR

#define CONCATSTR (   a,
 
)    a##b

◆ CREATE_FOR_TEST

#define CREATE_FOR_TEST (   _class_)
Value:
do \
{ \
class R : public _class_ \
{ \
public: \
R(){}; \
virtual ~R(){}; \
}; \
\
auto v = new R(); \
v->check_lx(#_class_, __FUNCTION__); \
delete v; \
} while (false);

◆ DECLARE_OBJECT_FACTORY

#define DECLARE_OBJECT_FACTORY (   _factoryName_,
  _class_,
  _ifcClass_ 
)
Value:
class _factoryName_ : public Core::ObjectFactory \
{ \
private: \
{ \
auto o = new _class_; \
o->setDocument(doc); \
o->setIfc3EntityType(LxIfc3::_ifcClass_); \
o->setIfc4EntityType(LxIfc4::_ifcClass_); \
return o; \
} \
}; \
BUILDCLASS(_class_, _ifcClass_, __COUNTER__, __COUNTER__)
virtual Core::DocObject * createByFactory(Core::CoreDocument *doc)=0
Definition: CoreDocument.h:210
Definition: DocObject.h:228
void setDocument(Core::CoreDocument *doc)
Sets the CoreDocument of this DocObject.
Definition: DocObject.h:51

◆ DECLARE_OBJECT_FACTORY_IFC

#define DECLARE_OBJECT_FACTORY_IFC (   _factoryName_,
  _class_,
  _ifc4Class_,
  _ifc3Class_ 
)
Value:
class _factoryName_ : public Core::ObjectFactory \
{ \
private: \
{ \
auto o = new _class_; \
o->setDocument(doc); \
o->setIfc3EntityType(LxIfc3::_ifc3Class_); \
o->setIfc4EntityType(LxIfc4::_ifc4Class_); \
return o; \
} \
}; \
BUILDCLASS(_class_, _ifc4Class_, __COUNTER__, __COUNTER__)
virtual Core::DocObject * createByFactory(Core::CoreDocument *doc)=0
Definition: CoreDocument.h:210
Definition: DocObject.h:228
void setDocument(Core::CoreDocument *doc)
Sets the CoreDocument of this DocObject.
Definition: DocObject.h:51

◆ DECLARE_OBJECT_FACTORY_NOIFC

#define DECLARE_OBJECT_FACTORY_NOIFC (   _factoryName_,
  _class_ 
)
Value:
class _factoryName_ : public Core::ObjectFactory \
{ \
private: \
{ \
auto o = new _class_; \
o->setDocument(doc); \
return o; \
} \
}; \
virtual Core::DocObject * createByFactory(Core::CoreDocument *doc)=0
Definition: CoreDocument.h:210
Definition: DocObject.h:228
void setDocument(Core::CoreDocument *doc)
Sets the CoreDocument of this DocObject.
Definition: DocObject.h:51

◆ DECLARE_PROPERTY_TEMPLATES

#define DECLARE_PROPERTY_TEMPLATES (   _class_,
  _export_symbol_ 
)
Value:
template class _export_symbol_ Core::PropertyLink<_class_*>; \
template class _export_symbol_ Core::PropertyLinkSet<_class_*>; \
template class _export_symbol_ Core::PropertyBackLink<_class_*>; \
template class _export_symbol_ Core::PropertyBackLinkSet<_class_*>; \
template class _export_symbol_ Core::PropertyTypedLinkList<_class_*>;

◆ DECLARE_TEMPLATE_OBJECT_FACTORY

#define DECLARE_TEMPLATE_OBJECT_FACTORY (   _factoryName_,
  _class_,
  _ifcClass_ 
)
Value:
template <class T> \
class _factoryName_ : public Core::ObjectFactory \
{ \
private: \
virtual Core::DocObject* createByFactory(Core::CoreDocument* doc) \
{ \
auto o = new _class_<T>; \
o->setDocument(doc); \
o->setIfc3EntityType(LxIfc3::_ifcClass_); \
/*o->setLxIfcEntity( std::shared_ptr<LxIfc3::LxIfc3Entity>( LxIfcEntityFactory::createIfc3Entity<_ifcClass_> ) );*/ \
return o; \
} \
};
Definition: CoreDocument.h:210
Definition: DocObject.h:228
void setDocument(Core::CoreDocument *doc)
Sets the CoreDocument of this DocObject.
Definition: DocObject.h:51

◆ INIT_PROPERTY_TEMPLATES

#define INIT_PROPERTY_TEMPLATES (   _class_)
Value:
Core::PropertyLink<_class_*>::init(qPrintable(QString("PropertyLink[%1]").arg(#_class_))); \
Core::PropertyLinkSet<_class_*>::init(qPrintable(QString("PropertyLinkSet[%1]").arg(#_class_))); \
Core::PropertyBackLink<_class_*>::init(qPrintable(QString("PropertyBackLink[%1]").arg(#_class_))); \
Core::PropertyBackLinkSet<_class_*>::init(qPrintable(QString("PropertyBackLinkSet[%1]").arg(#_class_))); \
Core::PropertyTypedLinkList<_class_*>::init(qPrintable(QString("PropertyTypedLinkList[%1]").arg(#_class_)));
static void init(void)

◆ LX__QUOTE

#define LX__QUOTE (   str)    #str

◆ LX_INIT

#define LX_INIT (   _class_,
  _parentclass_ 
)
Value:
void _class_::lx_field_init() \
{ \
::_class_::parentFieldData = ::_parentclass_::getFieldDataPtr(); \
::_class_::lxFieldIsInit = true; \
}

◆ LX_INIT_NO_PARENT

#define LX_INIT_NO_PARENT (   _class_)
Value:
void _class_::lx_field_init() \
{ \
_class_::parentFieldData = 0; \
_class_::lxFieldIsInit = true; \
}

◆ LX_INIT_OBJECT

#define LX_INIT_OBJECT (   _class_)
Value:
_class_::init(); \
_class_::lx_field_init(); \
CREATE_FOR_TEST(_class_) \
INIT_PROPERTY_TEMPLATES(_class_)

◆ LX_INIT_OBJECT_ABSTRACT

#define LX_INIT_OBJECT_ABSTRACT (   _class_)
Value:
_class_::init(); \
_class_::lx_field_init(); \
INIT_PROPERTY_TEMPLATES(_class_)

◆ LX_INIT_OBJECT_LINK

#define LX_INIT_OBJECT_LINK (   _class_)
Value:
_class_::init(); \
_class_::lx_field_init(); \
CREATE_FOR_TEST(_class_) \
INIT_PROPERTY_TEMPLATES(_class_)

◆ LX_NODE_ABSTRACT_SOURCE

#define LX_NODE_ABSTRACT_SOURCE (   _class_)
Value:
\
unsigned int ::_class_::classinstances = 0; \
const Core::LxFieldData** ::_class_::parentFieldData = (const Core::LxFieldData**)0xdeadbeefLL; \
Core::LxFieldData* ::_class_::fieldData = NULL; \
bool ::_class_::lxFieldIsInit = false; \
\
const Core::LxFieldData** _class_::getFieldDataPtr(void) { return const_cast<const Core::LxFieldData**>(&::_class_::fieldData); } \
\
const Core::LxFieldData* _class_::getFieldData(void) const { return ::_class_::fieldData; } \
\
const Core::LxFieldData* _class_::getParentFieldData(void) const { return *(::_class_::parentFieldData); }
Definition: PropertyContainer.h:95

◆ LX_NODE_ADD_FIELD

#define LX_NODE_ADD_FIELD (   _field_,
  _defaultval_ 
)
Value:
do \
{ \
fieldData->addField(this, LX__QUOTE(_field_), &this->_field_); \
} while (0)
#define LX__QUOTE(str)
Definition: PropertyMacros.h:6

◆ LX_NODE_CONSTRUCTOR

#define LX_NODE_CONSTRUCTOR (   _class_)
Value:
do \
{ \
::_class_::classinstances++; \
/* Catch attempts to use a node class which has not been initialized. */ \
/* assert(_class_::classTypeId != SoType::badType() && "you forgot init()!"); */ \
/* Initialize a field data container for the class only once. */ \
assert(::_class_::lxFieldIsInit && "\nClass not init!\n"); \
assert((::_class_::parentFieldData != (const Core::LxFieldData**)0xdeadbeefLL) && "\nParent-Class not init\n"); \
if (!::_class_::fieldData) \
{ \
::_class_::fieldData = new Core::LxFieldData(::_class_::parentFieldData ? *::_class_::parentFieldData : NULL); \
} \
/* Extension classes from the application programmers should not be \
considered native. This is important to get the export code to do \
the Right Thing. */ \
\
} while (0); \
Core::PostInitClass __postInit__(this)
Definition: PropertyContainer.h:95
bool isValid() const
Returns true if the status is set to 'Valid'.

◆ LX_NODE_HEADER

#define LX_NODE_HEADER ( )
Value:
public: \
static void lx_field_init(); \
\
protected: \
static const Core::LxFieldData** getFieldDataPtr(void); \
virtual const Core::LxFieldData* getFieldData(void) const; \
virtual const Core::LxFieldData* getParentFieldData(void) const; \
\
private: \
static const Core::LxFieldData** parentFieldData; \
static Core::LxFieldData* fieldData; \
static unsigned int classinstances; \
static bool lxFieldIsInit;
Definition: PropertyContainer.h:95

◆ LX_NODE_INIT_CLASS

#define LX_NODE_INIT_CLASS (   _class_,
  _parentclass_ 
)
Value:
do \
{ \
LX_PRIVATE_COMMON_INIT_CODE(_class_, _parentclass_); \
_class_::lxFieldIsInit = true; \
} while (0)

◆ LX_NODE_INIT_CLASS_NO_PARENT

#define LX_NODE_INIT_CLASS_NO_PARENT (   _class_)
Value:
do \
{ \
_class_::parentFieldData = 0; \
_class_::lxFieldIsInit = true; \
} while (0)

◆ LX_NODE_SOURCE

#define LX_NODE_SOURCE (   _class_,
  _parentclass_ 
)
Value:
LX_INIT(_class_, _parentclass_)
#define LX_NODE_ABSTRACT_SOURCE(_class_)
Definition: PropertyMacros.h:24

◆ LX_NODE_SOURCE_NO_PARENT

#define LX_NODE_SOURCE_NO_PARENT (   _class_)
Value:
LX_INIT_NO_PARENT(_class_)
#define LX_NODE_ABSTRACT_SOURCE(_class_)
Definition: PropertyMacros.h:24

◆ LX_PRIVATE_COMMON_INIT_CODE

#define LX_PRIVATE_COMMON_INIT_CODE (   _class_,
  _parentclass_ 
)
Value:
do \
{ \
/* Store parent's field data pointer for later use in the constructor. */ \
_class_::parentFieldData = _parentclass_::getFieldDataPtr(); \
} while (0)

◆ REGISTER_OBJECT_FACTORY

#define REGISTER_OBJECT_FACTORY (   _factoryName_,
  _class_ 
)    Core::ObjectFactory::registry[#_class_] = (Core::ObjectFactory*)new _factoryName_();

◆ TYPE_FOR_SAVE_IS_PARENT

#define TYPE_FOR_SAVE_IS_PARENT ( )
Value:
private: \
Base::Type getTypeForSave() { return getTypeId().getParent(); }