From 163e10b60836bfe96b62ed1d22a2336c00afeef3 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Mon, 18 Jul 2022 11:57:02 +0200 Subject: [PATCH] More schema macro rewriting --- src/ifcgeom_schema_agnostic/Kernel.h | 49 +++++++++++++--------------- src/ifcgeom_schema_agnostic/empty.h | 2 ++ 2 files changed, 24 insertions(+), 27 deletions(-) create mode 100644 src/ifcgeom_schema_agnostic/empty.h diff --git a/src/ifcgeom_schema_agnostic/Kernel.h b/src/ifcgeom_schema_agnostic/Kernel.h index 930255c768..f0671cd682 100644 --- a/src/ifcgeom_schema_agnostic/Kernel.h +++ b/src/ifcgeom_schema_agnostic/Kernel.h @@ -5,33 +5,28 @@ #include "../ifcgeom_schema_agnostic/IfcGeomIteratorSettings.h" #include "../ifcgeom_schema_agnostic/IfcRepresentationShapeItem.h" -#ifdef HAS_SCHEMA_2x3 -#include "../ifcparse/Ifc2x3.h" -#endif -#ifdef HAS_SCHEMA_4 -#include "../ifcparse/Ifc4.h" -#endif -#ifdef HAS_SCHEMA_4x1 -#include "../ifcparse/Ifc4x1.h" -#endif -#ifdef HAS_SCHEMA_4x2 -#include "../ifcparse/Ifc4x2.h" -#endif -#ifdef HAS_SCHEMA_4x3_rc1 -#include "../ifcparse/Ifc4x3_rc1.h" -#endif -#ifdef HAS_SCHEMA_4x3_rc2 -#include "../ifcparse/Ifc4x3_rc2.h" -#endif -#ifdef HAS_SCHEMA_4x3_rc3 -#include "../ifcparse/Ifc4x3_rc3.h" -#endif -#ifdef HAS_SCHEMA_4x3_rc4 -#include "../ifcparse/Ifc4x3_rc4.h" -#endif -#ifdef HAS_SCHEMA_4x3 -#include "../ifcparse/Ifc4x3.h" -#endif +#include +#include +#include + +// @tfk A macro cannot define an include (I think), so here we can't +// loop over the sequence of schema identifiers, but rather we have +// unroll the loop with at least the amount of schemas we'd like support +// for and then overflow into an existing empty include file. + +#define INCLUDE_SCHEMA(n) \ + BOOST_PP_IIF(BOOST_PP_GREATER(BOOST_PP_SEQ_SIZE(SCHEMA_SEQ), n), BOOST_PP_STRINGIZE(BOOST_PP_CAT(BOOST_PP_CAT(../ifcparse/Ifc,BOOST_PP_SEQ_ELEM(n,SCHEMA_SEQ)),.h)), "empty.h") + +#include INCLUDE_SCHEMA(0) +#include INCLUDE_SCHEMA(1) +#include INCLUDE_SCHEMA(2) +#include INCLUDE_SCHEMA(3) +#include INCLUDE_SCHEMA(4) +#include INCLUDE_SCHEMA(5) +#include INCLUDE_SCHEMA(6) +#include INCLUDE_SCHEMA(7) +#include INCLUDE_SCHEMA(8) +#include INCLUDE_SCHEMA(9) #include diff --git a/src/ifcgeom_schema_agnostic/empty.h b/src/ifcgeom_schema_agnostic/empty.h new file mode 100644 index 0000000000..85b3761c34 --- /dev/null +++ b/src/ifcgeom_schema_agnostic/empty.h @@ -0,0 +1,2 @@ +// A purposely empty file so that the unrolled loop +// can overflow into an existing empty include file. \ No newline at end of file