|
|
|||
File indexing completed on 2026-09-16 09:10:05
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // G4AssemblyStore 0027 // 0028 // Class description: 0029 // 0030 // Container for all assemblies, with functionality derived from 0031 // std::vector<T>. The class is a `singleton', in that only 0032 // one can exist, and access is provided via the static method 0033 // G4AssemblyStore::GetInstance(). 0034 // 0035 // All assemblies should be registered with G4AssemblyStore, and removed on 0036 // their destruction. The underlying container initially has a capacity of 20. 0037 // 0038 // If much additional functionality is added, should consider containment 0039 // instead of inheritance for std::vector<T>. 0040 0041 // Author: Gabriele Cosmo (CERN), 9 October 2018 0042 // -------------------------------------------------------------------- 0043 #ifndef G4ASSEMBLYSTORE_HH 0044 #define G4ASSEMBLYSTORE_HH 0045 0046 #include <vector> 0047 0048 #include "G4Types.hh" 0049 #include "G4String.hh" 0050 #include "G4VStoreNotifier.hh" 0051 0052 class G4AssemblyVolume; 0053 0054 /** 0055 * @brief G4AssemblyStore is a container for all assemblies, with functionality 0056 * derived from std::vector<T>. The class is a singleton. 0057 * All assemblies are registered with G4AssemblyStore, and removed on their 0058 * destruction. 0059 */ 0060 0061 class G4AssemblyStore : public std::vector<G4AssemblyVolume*> 0062 { 0063 public: 0064 0065 /** 0066 Adds the assembly to the collection. 0067 */ 0068 static void Register(G4AssemblyVolume* pAssembly); 0069 0070 /** 0071 Removes the assembly from the collection. 0072 */ 0073 static void DeRegister(G4AssemblyVolume* pAssembly); 0074 0075 /** 0076 Gets a pointer to the unique G4AssemblyStore, creating it if necessary. 0077 */ 0078 static G4AssemblyStore* GetInstance(); 0079 0080 /** 0081 Assigns a notifier for allocation/deallocation of assemblies. 0082 */ 0083 static void SetNotifier(G4VStoreNotifier* pNotifier); 0084 0085 /** 0086 Deletes all assemblies from the store. 0087 */ 0088 static void Clean(); 0089 0090 /** 0091 Returns an assembly through its Id number specification. 0092 */ 0093 G4AssemblyVolume* GetAssembly(unsigned int id, G4bool verbose=true) const; 0094 0095 private: 0096 0097 /** 0098 Private singleton constructor. 0099 */ 0100 G4AssemblyStore(); 0101 0102 /** 0103 Private destructor. Takes care to delete allocated assemblies. 0104 */ 0105 virtual ~G4AssemblyStore(); 0106 0107 private: 0108 0109 static G4AssemblyStore* fgInstance; 0110 static G4ThreadLocal G4VStoreNotifier* fgNotifier; 0111 static G4ThreadLocal G4bool locked; 0112 }; 0113 0114 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|