This commit is contained in:
Thomas Krijnen
2020-07-22 12:25:24 +02:00
parent 416640891f
commit 4f1aca8ceb
+11 -7
View File
@@ -246,7 +246,13 @@ namespace IfcGeom {
typedef P Precision; typedef P Precision;
typedef PP PlacementPrecision; typedef PP PlacementPrecision;
boost::optional<bool> initialization_outcome_;
bool initialize() { bool initialize() {
if (initialization_outcome_) {
return *initialization_outcome_;
}
try { try {
initUnits(); initUnits();
} catch (const std::exception& e) { } catch (const std::exception& e) {
@@ -364,9 +370,8 @@ namespace IfcGeom {
if (representations->size() == 0) { if (representations->size() == 0) {
Logger::Warning("No representations encountered, aborting"); Logger::Warning("No representations encountered, aborting");
return false; initialization_outcome_ = false;
} } else {
representation_iterator = representations->begin(); representation_iterator = representations->begin();
ifcproducts.reset(); ifcproducts.reset();
@@ -377,14 +382,13 @@ namespace IfcGeom {
collect(); collect();
process_concurrently(); process_concurrently();
return all_processed_elements_.size(); initialization_outcome_ = !all_processed_elements_.empty();
} else { } else {
if (!create()) { initialization_outcome_ = create();
return false;
} }
} }
return true; return *initialization_outcome_;
} }
void collect() { void collect() {