mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 18:57:17 +00:00
Some fixes for clang
This commit is contained in:
@@ -333,6 +333,14 @@ public:
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool convert_placement(IfcUtil::IfcBaseClass* item, gp_Trsf& trsf) {
|
||||||
|
if (item->as<IfcSchema::IfcObjectPlacement>()) {
|
||||||
|
return convert(item->as<IfcSchema::IfcObjectPlacement>(), trsf);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
IfcUtil::IfcBaseClass* MAKE_TYPE_NAME(tesselate_)(const TopoDS_Shape& shape, double deflection);
|
IfcUtil::IfcBaseClass* MAKE_TYPE_NAME(tesselate_)(const TopoDS_Shape& shape, double deflection);
|
||||||
|
|||||||
@@ -607,7 +607,7 @@ namespace IfcGeom {
|
|||||||
ifc_product = ifc_entity->as<IfcSchema::IfcProduct>();
|
ifc_product = ifc_entity->as<IfcSchema::IfcProduct>();
|
||||||
parent_id = -1;
|
parent_id = -1;
|
||||||
try {
|
try {
|
||||||
IfcSchema::IfcObjectDefinition* parent_object = kernel.get_decomposing_entity(ifc_product)->as<IfcSchema::IfcObjectDefinition>();
|
IfcSchema::IfcObjectDefinition* parent_object = kernel.get_decomposing_entity(ifc_product)->template as<IfcSchema::IfcObjectDefinition>();
|
||||||
if (parent_object) {
|
if (parent_object) {
|
||||||
parent_id = parent_object->data().id();
|
parent_id = parent_object->data().id();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,6 +128,15 @@ IfcUtil::IfcBaseEntity* IfcGeom::Kernel::get_decomposing_entity(IfcUtil::IfcBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
// LayerAssignments renamed from plural to singular, LayerAssignment, so work around that
|
||||||
|
IfcEntityList::ptr getLayerAssignments(Ifc2x3::IfcRepresentationItem* item) {
|
||||||
|
return item->LayerAssignments()->generalize();
|
||||||
|
}
|
||||||
|
IfcEntityList::ptr getLayerAssignments(Ifc4::IfcRepresentationItem* item) {
|
||||||
|
return item->LayerAssignment()->generalize();
|
||||||
|
}
|
||||||
|
|
||||||
template <typename Schema>
|
template <typename Schema>
|
||||||
static std::map<std::string, IfcUtil::IfcBaseEntity*> get_layers_impl(typename Schema::IfcProduct* prod) {
|
static std::map<std::string, IfcUtil::IfcBaseEntity*> get_layers_impl(typename Schema::IfcProduct* prod) {
|
||||||
std::map<std::string, IfcUtil::IfcBaseEntity*> layers;
|
std::map<std::string, IfcUtil::IfcBaseEntity*> layers;
|
||||||
|
|||||||
@@ -12,16 +12,6 @@
|
|||||||
|
|
||||||
#include <TopExp_Explorer.hxx>
|
#include <TopExp_Explorer.hxx>
|
||||||
|
|
||||||
namespace {
|
|
||||||
// LayerAssignments renamed from plural to singular, LayerAssignment, so work around that
|
|
||||||
IfcEntityList::ptr getLayerAssignments(Ifc2x3::IfcRepresentationItem* item) {
|
|
||||||
return item->LayerAssignments()->generalize();
|
|
||||||
}
|
|
||||||
IfcEntityList::ptr getLayerAssignments(Ifc4::IfcRepresentationItem* item) {
|
|
||||||
return item->LayerAssignment()->generalize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace IfcGeom {
|
namespace IfcGeom {
|
||||||
|
|
||||||
template <typename P, typename PP>
|
template <typename P, typename PP>
|
||||||
@@ -89,8 +79,8 @@ namespace IfcGeom {
|
|||||||
return implementation_->convert(item);
|
return implementation_->convert(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool convert(IfcUtil::IfcBaseClass* item, gp_Trsf& trsf) {
|
virtual bool convert_placement(IfcUtil::IfcBaseClass* item, gp_Trsf& trsf) {
|
||||||
return implementation_->convert(item, trsf);
|
return implementation_->convert_placement(item, trsf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int count(const TopoDS_Shape&, TopAbs_ShapeEnum);
|
static int count(const TopoDS_Shape&, TopAbs_ShapeEnum);
|
||||||
|
|||||||
@@ -1791,6 +1791,7 @@ class IFC2X3_instance_factory : public IfcParse::instance_factory {
|
|||||||
|
|
||||||
|
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
|
__attribute__((optnone))
|
||||||
#elif defined(__GNUC__) || defined(__GNUG__)
|
#elif defined(__GNUC__) || defined(__GNUG__)
|
||||||
#pragma GCC push_options
|
#pragma GCC push_options
|
||||||
#pragma GCC optimize ("O0")
|
#pragma GCC optimize ("O0")
|
||||||
|
|||||||
@@ -2105,6 +2105,7 @@ class IFC4_instance_factory : public IfcParse::instance_factory {
|
|||||||
|
|
||||||
|
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
|
__attribute__((optnone))
|
||||||
#elif defined(__GNUC__) || defined(__GNUG__)
|
#elif defined(__GNUC__) || defined(__GNUG__)
|
||||||
#pragma GCC push_options
|
#pragma GCC push_options
|
||||||
#pragma GCC optimize ("O0")
|
#pragma GCC optimize ("O0")
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ namespace IfcUtil {
|
|||||||
protected:
|
protected:
|
||||||
IfcEntityInstanceData* data_;
|
IfcEntityInstanceData* data_;
|
||||||
|
|
||||||
|
static bool is_null(const IfcBaseClass* not_this) {
|
||||||
|
return !not_this;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IfcBaseClass() : data_(0) {}
|
IfcBaseClass() : data_(0) {}
|
||||||
IfcBaseClass(IfcEntityInstanceData* d) : data_(d) {}
|
IfcBaseClass(IfcEntityInstanceData* d) : data_(d) {}
|
||||||
@@ -52,7 +56,8 @@ namespace IfcUtil {
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
T* as() {
|
T* as() {
|
||||||
if (this == 0) {
|
// @todo: do not allow this to be null in the first place
|
||||||
|
if (is_null(this)) {
|
||||||
return static_cast<T*>(0);
|
return static_cast<T*>(0);
|
||||||
}
|
}
|
||||||
return declaration().is(T::Class())
|
return declaration().is(T::Class())
|
||||||
@@ -62,7 +67,7 @@ namespace IfcUtil {
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
const T* as() const {
|
const T* as() const {
|
||||||
if (this == 0) {
|
if (is_null(this)) {
|
||||||
return static_cast<const T*>(0);
|
return static_cast<const T*>(0);
|
||||||
}
|
}
|
||||||
return declaration().is(T::Class())
|
return declaration().is(T::Class())
|
||||||
|
|||||||
@@ -527,7 +527,7 @@ static void start_element(void* user, const xmlChar* tag, const xmlChar** attrs)
|
|||||||
instance_to_attribute(inst_or_reference, attr, newinst);
|
instance_to_attribute(inst_or_reference, attr, newinst);
|
||||||
state->stack.back().inst()->data().setArgument(idx, attr);
|
state->stack.back().inst()->data().setArgument(idx, attr);
|
||||||
state->stack.push_back(stack_node::instance(id_in_file, newinst));
|
state->stack.push_back(stack_node::instance(id_in_file, newinst));
|
||||||
} else if (auto select = attribute_type->as_named_type()->declared_type()->as_select_type()) {
|
} else if (attribute_type->as_named_type()->declared_type()->as_select_type()) {
|
||||||
// Select types cause an additional indirection, so the current stack node is simply repeated
|
// Select types cause an additional indirection, so the current stack node is simply repeated
|
||||||
state->stack.push_back(stack_node::select(state->stack.back().inst(), idx));
|
state->stack.push_back(stack_node::select(state->stack.back().inst(), idx));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user