Files
IfcOpenShell/src/ifcgeom/kernel_registry.h
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
2.9 KiB
C++
Raw Normal View History

2026-04-14 13:50:23 +02:00
/********************************************************************************
* *
* 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 <http://www.gnu.org/licenses/>. *
* *
********************************************************************************/
#ifndef KERNEL_REGISTRY_H
#define KERNEL_REGISTRY_H
2026-08-08 14:19:57 +02:00
#include "../ifcgeom/abstract_kernel.h"
2026-04-14 13:50:23 +02:00
#include "../plugin/plugin.h"
2026-08-08 16:28:47 +02:00
#include <functional>
2026-04-14 13:50:23 +02:00
#include <map>
#include <memory>
#include <string>
#include <vector>
namespace ifcopenshell {
class file;
2026-08-08 07:42:45 +02:00
namespace geom {
2026-04-14 13:50:23 +02:00
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<abstract_kernel*(ifcopenshell::file*, ifcopenshell::geom::settings&, ifcopenshell::logger&)> create_fn;
2026-04-14 13:50:23 +02:00
2026-04-17 11:24:09 +02:00
void bind(const kernel_info& info, create_fn create, const ifcopenshell::plugin::module& module = ifcopenshell::plugin::module());
2026-04-14 13:50:23 +02:00
bool has(const std::string& backend_id) const;
std::unique_ptr<abstract_kernel> create(const std::string& backend_id, ifcopenshell::file* file, ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger) const;
2026-04-14 13:50:23 +02:00
std::vector<kernel_info> kernels() const;
private:
struct entry {
2026-08-09 09:52:17 +02:00
ifcopenshell::plugin::module module_;
2026-04-14 13:50:23 +02:00
kernel_info info_;
create_fn create_;
};
std::map<std::string, entry> entries_;
};
IFC_GEOM_API kernel_registry& kernel_registry_instance();
IFC_GEOM_API std::unique_ptr<abstract_kernel> construct(ifcopenshell::file* file, const std::string& geometry_library, ifcopenshell::geom::settings& settings, ifcopenshell::logger& logger = ifcopenshell::logger::root());
2026-04-14 13:50:23 +02:00
}
}
}
#endif