|
||||
File indexing completed on 2025-01-18 09:57:56
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 // 9.10.2018 G.Cosmo - Initial version 0042 // -------------------------------------------------------------------- 0043 #ifndef G4ASSEMBLYSTORE_HH 0044 #define G4ASSEMBLYSTORE_HH 0045 0046 #include <vector> 0047 #include "G4Types.hh" 0048 #include "G4String.hh" 0049 #include "G4VStoreNotifier.hh" 0050 0051 class G4AssemblyVolume; 0052 0053 class G4AssemblyStore : public std::vector<G4AssemblyVolume*> 0054 { 0055 public: 0056 0057 static void Register(G4AssemblyVolume* pAssembly); 0058 // Add the assembly to the collection. 0059 static void DeRegister(G4AssemblyVolume* pAssembly); 0060 // Remove the assembly from the collection. 0061 static G4AssemblyStore* GetInstance(); 0062 // Get a ptr to the unique G4AssemblyStore, creating it if necessary. 0063 static void SetNotifier(G4VStoreNotifier* pNotifier); 0064 // Assign a notifier for allocation/deallocation of assemblies. 0065 static void Clean(); 0066 // Delete all assemblies from the store. 0067 0068 G4AssemblyVolume* GetAssembly(unsigned int id, G4bool verbose=true) const; 0069 // Returns an assembly through its Id number specification. 0070 0071 protected: 0072 0073 G4AssemblyStore(); 0074 // Protected singleton constructor. 0075 virtual ~G4AssemblyStore(); 0076 // Destructor: takes care to delete allocated assemblies. 0077 0078 private: 0079 0080 static G4AssemblyStore* fgInstance; 0081 static G4ThreadLocal G4VStoreNotifier* fgNotifier; 0082 static G4ThreadLocal G4bool locked; 0083 }; 0084 0085 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |