No anonymous structs to work around gcc 5 issue

This commit is contained in:
Thomas Krijnen
2017-12-28 16:33:07 +01:00
parent 24b46c1f43
commit f5d6f4f7f9
2 changed files with 17 additions and 13 deletions
+8 -7
View File
@@ -150,10 +150,8 @@
#define MAKE_INIT_FN_(a, b) MAKE_INIT_FN__(a, b)
#define MAKE_INIT_FN(t) MAKE_INIT_FN_(t, IfcSchema)
void MAKE_INIT_FN(KernelImplementation_)(IfcGeom::impl::KernelFactoryImplementation* mapping) {
static const std::string schema_name = STRINGIFY(IfcSchema);
struct {
namespace {
struct factory_t {
IfcGeom::Kernel* operator()(IfcParse::IfcFile* file) const {
IfcGeom::MAKE_TYPE_NAME(Kernel)* k = new IfcGeom::MAKE_TYPE_NAME(Kernel);
if (file) {
@@ -201,11 +199,14 @@ void MAKE_INIT_FN(KernelImplementation_)(IfcGeom::impl::KernelFactoryImplementat
}
return k;
}
} factory;
mapping->bind(schema_name, factory);
};
}
void MAKE_INIT_FN(KernelImplementation_)(IfcGeom::impl::KernelFactoryImplementation* mapping) {
static const std::string schema_name = STRINGIFY(IfcSchema);
factory_t factory;
mapping->bind(schema_name, factory);
}
#define Kernel MAKE_TYPE_NAME(Kernel)
@@ -10,16 +10,19 @@ namespace IfcGeom {
#define MAKE_INIT_FN_(a, b) MAKE_INIT_FN__(a, b)
#define MAKE_INIT_FN(t) MAKE_INIT_FN_(t, IfcSchema)
template <typename P>
void MAKE_INIT_FN(IteratorImplementation_)(IteratorFactoryImplementation<P>* mapping) {
static const std::string schema_name = STRINGIFY(IfcSchema);
struct {
namespace {
template <typename P>
struct factory_t {
IfcGeom::IteratorImplementation<P>* operator()(const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file) const {
return new IfcGeom::MAKE_TYPE_NAME(IteratorImplementation_)<P>(settings, file);
}
} factory;
};
}
template <typename P>
void MAKE_INIT_FN(IteratorImplementation_)(IteratorFactoryImplementation<P>* mapping) {
static const std::string schema_name = STRINGIFY(IfcSchema);
factory_t<P> factory;
mapping->bind(schema_name, factory);
}