Fix compilation and execution of IfcConvert

This commit is contained in:
Thomas Krijnen
2017-12-21 14:14:04 +01:00
parent 6622afd93a
commit 4d325e026e
10 changed files with 1465 additions and 1458 deletions
@@ -1,5 +1,7 @@
#include "IteratorImplementation.h"
#include <boost/algorithm/string/case_conv.hpp>
template <typename P>
IteratorFactoryImplementation<P>& iterator_implementations() {
static IteratorFactoryImplementation<P> impl;
@@ -9,23 +11,29 @@ IteratorFactoryImplementation<P>& iterator_implementations() {
template IteratorFactoryImplementation<float>& iterator_implementations<float>();
template IteratorFactoryImplementation<double>& iterator_implementations<double>();
#define INIT(a) extern void init_##a(); init_##a();
template <typename P>
extern void init_IteratorImplementation_Ifc2x3(IteratorFactoryImplementation<P>*);
template <typename P>
extern void init_IteratorImplementation_Ifc4(IteratorFactoryImplementation<P>*);
template <typename P>
IteratorFactoryImplementation<P>::IteratorFactoryImplementation() {
INIT(IteratorImplementation_Ifc2x3);
INIT(IteratorImplementation_Ifc4);
init_IteratorImplementation_Ifc2x3(this);
init_IteratorImplementation_Ifc4(this);
}
template <class P>
void IteratorFactoryImplementation<P>::bind(const std::string& schema_name, typename get_factory_type<P>::type fn) {
this->insert(std::make_pair(schema_name, fn));
const std::string schema_name_lower = boost::to_lower_copy(schema_name);
this->insert(std::make_pair(schema_name_lower, fn));
}
template <class P>
IfcGeom::IteratorImplementation<P>* IteratorFactoryImplementation<P>::construct(const std::string& schema_name, const IfcGeom::IteratorSettings& settings, IfcParse::IfcFile* file) {
const std::string schema_name_lower = boost::to_lower_copy(schema_name);
std::map<std::string, typename get_factory_type<P>::type>::const_iterator it;
it = this->find(schema_name);
it = this->find(schema_name_lower);
if (it == end()) {
throw IfcParse::IfcException("No geometry iterator registered for " + schema_name);
}