Remove templates on iterator and element

This commit is contained in:
Thomas Krijnen
2021-07-11 15:00:59 +02:00
parent ff73f82798
commit eeaf04c6ea
25 changed files with 203 additions and 293 deletions
@@ -2,48 +2,36 @@
#include <boost/algorithm/string/case_conv.hpp>
template <typename P, typename PP>
IteratorFactoryImplementation<P, PP>& iterator_implementations() {
static IteratorFactoryImplementation<P, PP> impl;
IteratorFactoryImplementation& iterator_implementations() {
static IteratorFactoryImplementation impl;
return impl;
}
template IteratorFactoryImplementation<float, float>& iterator_implementations<float, float>();
template IteratorFactoryImplementation<float, double>& iterator_implementations<float, double>();
template IteratorFactoryImplementation<double, double>& iterator_implementations<double, double>();
#ifdef HAS_SCHEMA_2x3
template <typename P, typename PP>
extern void init_IteratorImplementation_Ifc2x3(IteratorFactoryImplementation<P, PP>*);
extern void init_IteratorImplementation_Ifc2x3(IteratorFactoryImplementation*);
#endif
#ifdef HAS_SCHEMA_4
template <typename P, typename PP>
extern void init_IteratorImplementation_Ifc4(IteratorFactoryImplementation<P, PP>*);
extern void init_IteratorImplementation_Ifc4(IteratorFactoryImplementation*);
#endif
#ifdef HAS_SCHEMA_4x1
template <typename P, typename PP>
extern void init_IteratorImplementation_Ifc4x1(IteratorFactoryImplementation<P, PP>*);
extern void init_IteratorImplementation_Ifc4x1(IteratorFactoryImplementation*);
#endif
#ifdef HAS_SCHEMA_4x2
template <typename P, typename PP>
extern void init_IteratorImplementation_Ifc4x2(IteratorFactoryImplementation<P, PP>*);
extern void init_IteratorImplementation_Ifc4x2(IteratorFactoryImplementation*);
#endif
#ifdef HAS_SCHEMA_4x3_rc1
template <typename P, typename PP>
extern void init_IteratorImplementation_Ifc4x3_rc1(IteratorFactoryImplementation<P, PP>*);
extern void init_IteratorImplementation_Ifc4x3_rc1(IteratorFactoryImplementation*);
#endif
#ifdef HAS_SCHEMA_4x3_rc2
template <typename P, typename PP>
extern void init_IteratorImplementation_Ifc4x3_rc2(IteratorFactoryImplementation<P, PP>*);
extern void init_IteratorImplementation_Ifc4x3_rc2(IteratorFactoryImplementation*);
#endif
template <typename P, typename PP>
IteratorFactoryImplementation<P, PP>::IteratorFactoryImplementation() {
IteratorFactoryImplementation::IteratorFactoryImplementation() {
#ifdef HAS_SCHEMA_2x3
init_IteratorImplementation_Ifc2x3(this);
#endif
@@ -64,24 +52,17 @@ IteratorFactoryImplementation<P, PP>::IteratorFactoryImplementation() {
#endif
}
template <typename P, typename PP>
void IteratorFactoryImplementation<P, PP>::bind(const std::string& schema_name, typename get_factory_type<P, PP>::type fn) {
void IteratorFactoryImplementation::bind(const std::string& schema_name, iterator_fn fn) {
const std::string schema_name_lower = boost::to_lower_copy(schema_name);
this->insert(std::make_pair(schema_name_lower, fn));
}
template <typename P, typename PP>
IfcGeom::IteratorImplementation<P, PP>* IteratorFactoryImplementation<P, PP>::construct(const std::string& schema_name, const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file, const std::vector<IfcGeom::filter_t>& filters, int num_threads) {
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) {
const std::string schema_name_lower = boost::to_lower_copy(schema_name);
typename std::map<std::string, typename get_factory_type<P, PP>::type>::const_iterator it;
typename std::map<std::string, iterator_fn>::const_iterator it;
it = this->find(schema_name_lower);
if (it == this->end()) {
throw IfcParse::IfcException("No geometry iterator registered for " + schema_name);
}
return it->second(settings, file, filters, num_threads);
}
template class IteratorFactoryImplementation<float, float>;
template class IteratorFactoryImplementation<float, double>;
template class IteratorFactoryImplementation<double, double>;