00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // class G4SolidStore 00030 // 00031 // Class description: 00032 // 00033 // Container for all solids, with functionality derived from 00034 // std::vector<T>. The class is a `singleton', in that only 00035 // one can exist, and access is provided via the static method 00036 // G4SolidStore::GetInstance(). 00037 // 00038 // All solids should be registered with G4SolidStore, and removed on their 00039 // destruction. Intended principally for UI browser. The underlying 00040 // container initially has a capacity of 100. 00041 // 00042 // If much additional functionality is added, should consider containment 00043 // instead of inheritance for std::vector<T> 00044 // 00045 // Member data: 00046 // 00047 // static G4SolidStore* 00048 // - Ptr to the single G4SolidStore 00049 00050 // History: 00051 // 18.04.01 G.Cosmo Migrated to STL vector 00052 // 10.07.95 P.Kent Initial version 00053 // -------------------------------------------------------------------- 00054 #ifndef G4VSOLIDSTORE_HH 00055 #define G4VSOLIDSTORE_HH 00056 00057 #include <vector> 00058 00059 #include "G4VSolid.hh" 00060 #include "G4VStoreNotifier.hh" 00061 00062 class G4SolidStore : public std::vector<G4VSolid*> 00063 { 00064 public: // with description 00065 00066 static void Register(G4VSolid* pSolid); 00067 // Add the solid to the collection. 00068 static void DeRegister(G4VSolid* pSolid); 00069 // Remove the solid from the collection. 00070 static G4SolidStore* GetInstance(); 00071 // Get a ptr to the unique G4SolidStore, creating it if necessary. 00072 static void SetNotifier(G4VStoreNotifier* pNotifier); 00073 // Assign a notifier for allocation/deallocation of solids. 00074 static void Clean(); 00075 // Delete all solids from the store. 00076 00077 G4VSolid* GetSolid(const G4String& name, G4bool verbose=true) const; 00078 // Return the pointer of the first solid in the collection having 00079 // that name. 00080 00081 virtual ~G4SolidStore(); 00082 // Destructor: takes care to delete allocated solids. 00083 00084 protected: 00085 00086 G4SolidStore(); 00087 00088 private: 00089 00090 static G4SolidStore* fgInstance; 00091 static G4VStoreNotifier* fgNotifier; 00092 static G4bool locked; 00093 }; 00094 00095 #endif