File indexing completed on 2026-04-17 07:46:40
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Geometry/GeometryModuleHelper.hpp"
0010
0011 #include "Acts/Geometry/GeometryModule.h"
0012 #include "Acts/Geometry/TrackingGeometry.hpp"
0013 #include "Acts/Utilities/Logger.hpp"
0014
0015 #include <exception>
0016 #include <memory>
0017
0018 namespace Acts::detail {
0019
0020 const ActsGeometryModuleV1* getGeometryModuleFromRaw(
0021 const char* module_abi_tag, const char* user_data_type,
0022 void* (*buildFunc)(const void*, const void*)) {
0023 static const ActsGeometryModuleV1 s_module = {
0024 .module_abi_tag = module_abi_tag,
0025 .user_data_type = user_data_type,
0026 .build = buildFunc,
0027 .destroy =
0028 [](void* handle) noexcept {
0029 if (handle == nullptr) {
0030 return;
0031 }
0032
0033 delete static_cast<TrackingGeometry*>(handle);
0034 },
0035 };
0036
0037 return &s_module;
0038 }
0039
0040 const ActsGeometryModuleV1* getGeometryModule(const char* module_abi_tag,
0041 const char* user_data_type,
0042 BuildFunction buildFunc) {
0043 static BuildFunction s_buildFunc = buildFunc;
0044
0045 return getGeometryModuleFromRaw(
0046 module_abi_tag, user_data_type,
0047 [](const void* , const void* loggerPtr) noexcept -> void* {
0048 if (loggerPtr == nullptr) {
0049 return nullptr;
0050 }
0051 const auto& logger = *static_cast<const Logger*>(loggerPtr);
0052 try {
0053 return s_buildFunc(logger).release();
0054 } catch (const std::exception& e) {
0055 ACTS_ERROR("Failed to build geometry module: " << e.what());
0056 return nullptr;
0057 } catch (...) {
0058 ACTS_ERROR("Failed to build geometry module");
0059 return nullptr;
0060 }
0061 });
0062 }
0063
0064 }