2017-12-19 20:24:00 +01:00
|
|
|
#include "IteratorImplementation.h"
|
|
|
|
|
|
2017-12-21 14:14:04 +01:00
|
|
|
#include <boost/algorithm/string/case_conv.hpp>
|
|
|
|
|
|
2021-07-11 15:00:59 +02:00
|
|
|
IteratorFactoryImplementation& iterator_implementations() {
|
|
|
|
|
static IteratorFactoryImplementation impl;
|
2017-12-19 20:24:00 +01:00
|
|
|
return impl;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-11 22:29:16 +02:00
|
|
|
#ifdef HAS_SCHEMA_2x3
|
2021-07-11 15:00:59 +02:00
|
|
|
extern void init_IteratorImplementation_Ifc2x3(IteratorFactoryImplementation*);
|
2021-05-11 22:29:16 +02:00
|
|
|
#endif
|
2017-12-21 14:14:04 +01:00
|
|
|
|
2021-05-11 22:29:16 +02:00
|
|
|
#ifdef HAS_SCHEMA_4
|
2021-07-11 15:00:59 +02:00
|
|
|
extern void init_IteratorImplementation_Ifc4(IteratorFactoryImplementation*);
|
2021-05-11 22:29:16 +02:00
|
|
|
#endif
|
2017-12-19 20:24:00 +01:00
|
|
|
|
2021-05-11 22:29:16 +02:00
|
|
|
#ifdef HAS_SCHEMA_4x1
|
2021-07-11 15:00:59 +02:00
|
|
|
extern void init_IteratorImplementation_Ifc4x1(IteratorFactoryImplementation*);
|
2021-05-11 22:29:16 +02:00
|
|
|
#endif
|
2020-06-15 12:48:30 +02:00
|
|
|
|
2021-05-11 22:29:16 +02:00
|
|
|
#ifdef HAS_SCHEMA_4x2
|
2021-07-11 15:00:59 +02:00
|
|
|
extern void init_IteratorImplementation_Ifc4x2(IteratorFactoryImplementation*);
|
2021-05-11 22:29:16 +02:00
|
|
|
#endif
|
2020-06-15 12:48:30 +02:00
|
|
|
|
2021-05-11 22:29:16 +02:00
|
|
|
#ifdef HAS_SCHEMA_4x3_rc1
|
2021-07-11 15:00:59 +02:00
|
|
|
extern void init_IteratorImplementation_Ifc4x3_rc1(IteratorFactoryImplementation*);
|
2021-05-11 22:29:16 +02:00
|
|
|
#endif
|
2020-06-15 12:48:30 +02:00
|
|
|
|
2021-05-11 22:29:16 +02:00
|
|
|
#ifdef HAS_SCHEMA_4x3_rc2
|
2021-07-11 15:00:59 +02:00
|
|
|
extern void init_IteratorImplementation_Ifc4x3_rc2(IteratorFactoryImplementation*);
|
2021-05-11 22:29:16 +02:00
|
|
|
#endif
|
2021-02-14 12:43:27 +01:00
|
|
|
|
2021-07-11 15:00:59 +02:00
|
|
|
IteratorFactoryImplementation::IteratorFactoryImplementation() {
|
2021-05-11 22:29:16 +02:00
|
|
|
#ifdef HAS_SCHEMA_2x3
|
2017-12-21 14:14:04 +01:00
|
|
|
init_IteratorImplementation_Ifc2x3(this);
|
2021-05-11 22:29:16 +02:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAS_SCHEMA_4
|
2017-12-21 14:14:04 +01:00
|
|
|
init_IteratorImplementation_Ifc4(this);
|
2021-05-11 22:29:16 +02:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAS_SCHEMA_4x1
|
2020-06-15 12:48:30 +02:00
|
|
|
init_IteratorImplementation_Ifc4x1(this);
|
2021-05-11 22:29:16 +02:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAS_SCHEMA_4x2
|
2020-06-15 12:48:30 +02:00
|
|
|
init_IteratorImplementation_Ifc4x2(this);
|
2021-05-11 22:29:16 +02:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAS_SCHEMA_4x3_rc1
|
2020-06-15 12:48:30 +02:00
|
|
|
init_IteratorImplementation_Ifc4x3_rc1(this);
|
2021-05-11 22:29:16 +02:00
|
|
|
#endif
|
|
|
|
|
#ifdef HAS_SCHEMA_4x3_rc2
|
2021-02-14 12:43:27 +01:00
|
|
|
init_IteratorImplementation_Ifc4x3_rc2(this);
|
2021-05-11 22:29:16 +02:00
|
|
|
#endif
|
2017-12-19 20:24:00 +01:00
|
|
|
}
|
|
|
|
|
|
2021-07-11 15:00:59 +02:00
|
|
|
void IteratorFactoryImplementation::bind(const std::string& schema_name, iterator_fn fn) {
|
2017-12-21 14:14:04 +01:00
|
|
|
const std::string schema_name_lower = boost::to_lower_copy(schema_name);
|
|
|
|
|
this->insert(std::make_pair(schema_name_lower, fn));
|
2017-12-19 20:24:00 +01:00
|
|
|
}
|
|
|
|
|
|
2021-07-11 15:00:59 +02:00
|
|
|
IfcGeom::IteratorImplementation* IteratorFactoryImplementation::construct(const std::string& schema_name, const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector<IfcGeom::filter_t>& filters, int num_threads) {
|
2017-12-21 14:14:04 +01:00
|
|
|
const std::string schema_name_lower = boost::to_lower_copy(schema_name);
|
2021-07-11 15:00:59 +02:00
|
|
|
typename std::map<std::string, iterator_fn>::const_iterator it;
|
2017-12-21 14:14:04 +01:00
|
|
|
it = this->find(schema_name_lower);
|
2017-12-29 12:09:07 +01:00
|
|
|
if (it == this->end()) {
|
2017-12-20 11:10:27 +01:00
|
|
|
throw IfcParse::IfcException("No geometry iterator registered for " + schema_name);
|
|
|
|
|
}
|
2019-07-03 12:10:27 +02:00
|
|
|
return it->second(settings, file, filters, num_threads);
|
2017-12-20 11:10:27 +01:00
|
|
|
}
|