Continue work on plug-in and tests

This commit is contained in:
Thomas Krijnen
2026-05-06 21:17:25 +02:00
parent 4670715ef3
commit 98ff457fd6
61 changed files with 16000 additions and 16377 deletions
+20 -13
View File
@@ -53,27 +53,34 @@ macro(build_example exe_name)
install(TARGETS ${exe_name})
endmacro()
macro(build_schema_example exe_name schema)
build_example(${exe_name} ${ARGN})
if(NOT STANDALONE_PROJECT)
target_link_libraries(${exe_name} parse_schema_ifc${schema})
endif()
endmacro()
if("4" IN_LIST SCHEMA_VERSIONS)
build_example(arbitrary_open_profile_def)
build_example(triangulated_faceset)
build_schema_example(arbitrary_open_profile_def 4)
build_schema_example(triangulated_faceset 4)
endif()
if("2x3" IN_LIST SCHEMA_VERSIONS)
build_example(composite_profile_def)
build_example(csg_primitive)
build_example(ellipse_pies)
build_example(faces)
build_example(ifc_curve_rebar)
build_example(profiles)
build_example(IfcParseExamples)
build_schema_example(composite_profile_def 2x3)
build_schema_example(csg_primitive 2x3)
build_schema_example(ellipse_pies 2x3)
build_schema_example(faces 2x3)
build_schema_example(ifc_curve_rebar 2x3)
build_schema_example(profiles 2x3)
build_schema_example(IfcParseExamples 2x3)
if(WITH_OPENCASCADE)
build_example(IfcOpenHouse geometry_serializer)
build_example(IfcAdvancedHouse geometry_serializer)
build_schema_example(IfcOpenHouse 2x3 geometry_serializer)
build_schema_example(IfcAdvancedHouse 2x3 geometry_serializer)
endif()
endif()
if("4x3_add2" IN_LIST SCHEMA_VERSIONS)
build_example(IfcAlignment)
build_example(IfcSimplifiedAlignment)
build_schema_example(IfcAlignment 4x3_add2)
build_schema_example(IfcSimplifiedAlignment 4x3_add2)
endif()
+3 -49
View File
@@ -24,48 +24,10 @@
#include "../ifcparse/logger.h"
#include "../ifcparse/schemas/Ifc2x3.h"
#include <boost/preprocessor/stringize.hpp>
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/seq/size.hpp>
#include <boost/preprocessor/seq/pop_back.hpp>
#include <boost/preprocessor/comparison/greater.hpp>
#include <boost/preprocessor/selection/min.hpp>
#ifdef _MSC_VER
#define strcasecmp _stricmp
#endif
#ifndef SCHEMA_SEQ
static_assert(false, "A boost preprocessor sequence of schema identifiers is needed for this file to compile.");
#endif
// @todo duplicated with Kernel.h
// @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(../ifcparse/schemas/BOOST_PP_CAT(Ifc,BOOST_PP_SEQ_ELEM(BOOST_PP_MIN(n, BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_POP_BACK(SCHEMA_SEQ))),SCHEMA_SEQ)).h), "../ifcgeom/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 INCLUDE_SCHEMA(10)
#include INCLUDE_SCHEMA(11)
#include INCLUDE_SCHEMA(12)
#include INCLUDE_SCHEMA(13)
#include INCLUDE_SCHEMA(14)
#include INCLUDE_SCHEMA(15)
#include <iomanip>
#if USE_VLD
@@ -205,19 +167,11 @@ void get_psets_s(element_properties& props, const typename Schema::IfcObjectDefi
}
}
// What follows is machinery to create a preprocessor-based dispatch mechanism to dispatch to the
// correct get_psets_s<Schema>() based on inst->declaration().schema()->name().
#define EXPAND_AND_CONCATENATE(elem) Ifc##elem
#define GENERATE_LITERAL_STRING(elem) "Ifc" # elem
#define TEST_AND_DISPATCH(r, data, elem) \
if (strcasecmp(schema_name, GENERATE_LITERAL_STRING(elem)) == 0) { get_psets_s<EXPAND_AND_CONCATENATE(elem)>(props, inst.as<EXPAND_AND_CONCATENATE(elem)::IfcObjectDefinition>()); }
void get_psets(element_properties& props, const express::Base& inst) {
auto schema_name = inst.declaration().schema()->name().c_str();
BOOST_PP_SEQ_FOR_EACH(TEST_AND_DISPATCH, , SCHEMA_SEQ)
if (strcasecmp(schema_name, "Ifc2x3") == 0) {
get_psets_s<Ifc2x3>(props, inst.as<Ifc2x3::IfcObjectDefinition>());
}
}
int main(int argc, char** argv) {