|
G4OCCT 0.1.0
Geant4 interface to Open CASCADE Technology (OCCT) geometry definitions
|
Singleton registry for named G4OCCTAssemblyVolume instances. More...
#include <G4OCCTAssemblyRegistry.hh>
Public Member Functions | |
| void | Register (const std::string &name, G4OCCTAssemblyVolume *assembly) |
| G4OCCTAssemblyVolume * | Get (const std::string &name) const |
| G4OCCTAssemblyVolume * | Release (const std::string &name) |
| std::size_t | Size () const |
Static Public Member Functions | |
| static G4OCCTAssemblyRegistry & | Instance () |
| Return the singleton instance. | |
Singleton registry for named G4OCCTAssemblyVolume instances.
Stores heap-allocated G4OCCTAssemblyVolume objects by name and takes ownership of them. This is primarily used by the DD4hep plugin to keep assemblies alive past the plugin build phase, where local variables would otherwise be destroyed too early.
The registry owns all registered assemblies. They are deleted when Release() is called or when the registry is destroyed.
Definition at line 38 of file G4OCCTAssemblyRegistry.hh.
| G4OCCTAssemblyVolume * G4OCCTAssemblyRegistry::Get | ( | const std::string & | name | ) | const |
Retrieve an assembly by name.
| name | Assembly name as passed to Register(). |
nullptr if not found. Definition at line 35 of file G4OCCTAssemblyRegistry.cc.
Referenced by G4OCCTAssemblySDSetup::Apply().
|
static |
Return the singleton instance.
Definition at line 13 of file G4OCCTAssemblyRegistry.cc.
Referenced by G4OCCTAssemblySDSetup::Apply(), and G4OCCT_ImportSTEPAssembly().
| void G4OCCTAssemblyRegistry::Register | ( | const std::string & | name, |
| G4OCCTAssemblyVolume * | assembly | ||
| ) |
Register a named assembly (takes ownership).
| name | Unique name for this assembly. |
| assembly | Non-null pointer to the assembly to register. |
| std::runtime_error | if name is already registered. |
Definition at line 24 of file G4OCCTAssemblyRegistry.cc.
Referenced by G4OCCT_ImportSTEPAssembly().
| G4OCCTAssemblyVolume * G4OCCTAssemblyRegistry::Release | ( | const std::string & | name | ) |
Remove an assembly from the registry and return ownership to the caller.
| name | Assembly name to release. |
nullptr if not found. The caller is responsible for deleting the returned object. Definition at line 40 of file G4OCCTAssemblyRegistry.cc.
| std::size_t G4OCCTAssemblyRegistry::Size | ( | ) | const |
Return the number of registered assemblies.
Definition at line 50 of file G4OCCTAssemblyRegistry.cc.