Skip to content

Commit

Permalink
IO_Assimp: fix compilation errors with OpenCascade < 7.8
Browse files Browse the repository at this point in the history
  • Loading branch information
HuguesDelorme committed May 20, 2024
1 parent 6862a16 commit 7fafed2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
16 changes: 15 additions & 1 deletion src/base/occ_handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
#pragma once

#include <Standard_Handle.hxx>
#include <Standard_Version.hxx>
#include <utility> // For std::forward()

namespace Mayo {

// Template alias for OpenCascade handle
template<typename T> using OccHandle = opencascade::handle<T>;

// Constructs an object of 'T' wrapped in an OpenCascade handle
// Constructs an object of type 'T' wrapped in an OpenCascade handle
// Note: Standard_Transient must be a base class of 'T'
template<typename T, typename... Args>
OccHandle<T> makeOccHandle(Args&&... args)
Expand All @@ -23,3 +24,16 @@ OccHandle<T> makeOccHandle(Args&&... args)
}

} // namespace Mayo

#if OCC_VERSION_HEX < 0x070800
namespace std {

// Specialization of C++11 std::hash<> functor for opencascade::handle<> objects
template<typename T> struct hash<opencascade::handle<T>> {
inline std::size_t operator()(const opencascade::handle<T>& hnd) const {
return hash<T*>{}(hnd.get());
}
};

} // namespace std
#endif
15 changes: 0 additions & 15 deletions src/base/tkernel_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "occ_handle.h"

#include <Quantity_Color.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Version.hxx>
#include <string>
#include <string_view>
Expand All @@ -21,7 +20,6 @@
#if OCC_VERSION_HEX >= OCC_VERSION_CHECK(7, 5, 0)
# include <Message_ProgressRange.hxx>
#else
# include <Standard_Handle.hxx>
class Message_ProgressIndicator;
#endif

Expand Down Expand Up @@ -56,16 +54,3 @@ class TKernelUtils {
};

} // namespace Mayo

#if OCC_VERSION_HEX < OCC_VERSION_CHECK(7, 8, 0)
namespace std {

// Specialization of C++11 std::hash<> functor for opencascade::handle<> objects
template<typename T> struct hash<opencascade::handle<T>> {
inline std::size_t operator()(const opencascade::handle<T>& hnd) const {
return hash<T*>{}(hnd.get());
}
};

} // namespace std
#endif
1 change: 0 additions & 1 deletion src/io_assimp/io_assimp_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#pragma once

#include "../base/io_reader.h"
#include "../base/occ_handle.h"

#include <assimp/Importer.hpp>

Expand Down

0 comments on commit 7fafed2

Please sign in to comment.