mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +00:00
Don't fail on parse errors in multithreaded mode #746
This commit is contained in:
@@ -388,18 +388,24 @@ namespace IfcGeom {
|
|||||||
void collect() {
|
void collect() {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
IfcSchema::IfcProduct::list* previous = nullptr;
|
IfcSchema::IfcProduct::list* previous = nullptr;
|
||||||
while (auto rp = get_next_task()) {
|
while (auto rp = try_get_next_task()) {
|
||||||
// Note that get_next_task() mutates the state of the iterator
|
// Note that get_next_task() mutates the state of the iterator
|
||||||
// we use that capture all products that can be processed as
|
// we use that capture all products that can be processed as
|
||||||
// part of this representation and then keep iterating until
|
// part of this representation and then keep iterating until
|
||||||
// the underlying list of products changes.
|
// the underlying list of products changes.
|
||||||
if (ifcproducts.get() != previous) {
|
if (ifcproducts.get() != previous) {
|
||||||
previous = ifcproducts.get();
|
previous = ifcproducts.get();
|
||||||
geometry_conversion_task<P, PP> t;
|
if (ifcproducts->size()) {
|
||||||
t.index = i++;
|
geometry_conversion_task<P, PP> t;
|
||||||
t.representation = *representation_iterator;
|
t.index = i++;
|
||||||
t.products = ifcproducts;
|
t.representation = *representation_iterator;
|
||||||
tasks_.emplace_back(t);
|
t.products = ifcproducts;
|
||||||
|
tasks_.emplace_back(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rp->which() == 1) {
|
||||||
|
Logger::Error(boost::get<IfcParse::IfcException>(*rp));
|
||||||
}
|
}
|
||||||
|
|
||||||
_nextShape();
|
_nextShape();
|
||||||
@@ -599,6 +605,26 @@ namespace IfcGeom {
|
|||||||
return associated_single_materials.size() == 1;
|
return associated_single_materials.size() == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::optional<boost::variant<std::pair<IfcSchema::IfcRepresentation*, IfcSchema::IfcProduct*>,IfcParse::IfcException>> try_get_next_task() {
|
||||||
|
boost::variant<
|
||||||
|
std::pair<IfcSchema::IfcRepresentation*, IfcSchema::IfcProduct*>,
|
||||||
|
IfcParse::IfcException
|
||||||
|
> r;
|
||||||
|
try {
|
||||||
|
auto p = get_next_task();
|
||||||
|
if (p) {
|
||||||
|
r = *p;
|
||||||
|
} else {
|
||||||
|
return boost::none;
|
||||||
|
}
|
||||||
|
} catch (IfcParse::IfcException& e) {
|
||||||
|
r = e;
|
||||||
|
} catch (...) {
|
||||||
|
r = IfcParse::IfcException("Unknown error");
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
boost::optional<std::pair<IfcSchema::IfcRepresentation*, IfcSchema::IfcProduct*>> get_next_task() {
|
boost::optional<std::pair<IfcSchema::IfcRepresentation*, IfcSchema::IfcProduct*>> get_next_task() {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
IfcSchema::IfcRepresentation* representation;
|
IfcSchema::IfcRepresentation* representation;
|
||||||
|
|||||||
Reference in New Issue
Block a user