/******************************************************************************** * * * This file is part of IfcOpenShell. * * * * IfcOpenShell is free software: you can redistribute it and/or modify * * it under the terms of the Lesser GNU General Public License as published by * * the Free Software Foundation, either version 3.0 of the License, or * * (at your option) any later version. * * * * IfcOpenShell is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * Lesser GNU General Public License for more details. * * * * You should have received a copy of the Lesser GNU General Public License * * along with this program. If not, see . * * * ********************************************************************************/ #ifndef KERNEL_REGISTRY_H #define KERNEL_REGISTRY_H #include "../ifcgeom/abstract_kernel.h" #include "../plugin/plugin.h" #include #include #include #include #include namespace ifcopenshell { class file; namespace geom { namespace kernels { struct IFC_GEOM_API kernel_info { std::string backend_id; bool supports_boolean_operations = false; }; class IFC_GEOM_API kernel_registry { public: typedef std::function create_fn; void bind(const kernel_info& info, create_fn create, const ifcopenshell::plugin::module& module = ifcopenshell::plugin::module()); bool has(const std::string& backend_id) const; std::unique_ptr create(const std::string& backend_id, ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger) const; std::vector kernels() const; private: struct entry { ifcopenshell::plugin::module module_; kernel_info info_; create_fn create_; }; std::map entries_; }; IFC_GEOM_API kernel_registry& kernel_registry_instance(); IFC_GEOM_API std::unique_ptr construct(ifcopenshell::file* file, const std::string& geometry_library, ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root()); } } } #endif