18G4OCCTAssemblyRegistry::~G4OCCTAssemblyRegistry() {
19 for (
auto& [name, assembly] : fAssemblies) {
26 throw std::invalid_argument(
"G4OCCTAssemblyRegistry: null assembly passed for '" + name +
"'.");
28 if (fAssemblies.count(name) != 0) {
29 throw std::runtime_error(
"G4OCCTAssemblyRegistry: assembly '" + name +
30 "' is already registered.");
32 fAssemblies[name] = assembly;
36 const auto it = fAssemblies.find(name);
37 return it != fAssemblies.end() ? it->second :
nullptr;
41 const auto it = fAssemblies.find(name);
42 if (it == fAssemblies.end()) {
46 fAssemblies.erase(it);
Declaration of G4OCCTAssemblyRegistry.
Declaration of G4OCCTAssemblyVolume.
Singleton registry for named G4OCCTAssemblyVolume instances.
G4OCCTAssemblyVolume * Get(const std::string &name) const
static G4OCCTAssemblyRegistry & Instance()
Return the singleton instance.
G4OCCTAssemblyVolume * Release(const std::string &name)
void Register(const std::string &name, G4OCCTAssemblyVolume *assembly)
Extends Geant4's G4AssemblyVolume with an OCCT XDE label reference.