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: G4FieldManagerStore.hh 69786 2013-05-15 09:38:51Z gcosmo $ 00028 // 00029 // class G4FieldManagerStore 00030 // 00031 // Class description: 00032 // 00033 // Container for all FieldManagers, 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 function 00036 // G4FieldManagerStore::GetInstance() 00037 // 00038 // All FieldManagers should be registered with G4FieldManagerStore, 00039 // and removed on their destruction. 00040 // Intended principally to enable resetting of 'state' at start of event. 00041 // The underlying container initially has a capacity of 100. 00042 // 00043 // Member data: 00044 // 00045 // static G4FieldManagerStore* fgInstance 00046 // - Ptr to the single G4FieldManagerStore. 00047 00048 // History: 00049 // 07.12.07 J.Apostolakis Initial version 00050 // -------------------------------------------------------------------- 00051 #ifndef G4FIELDMANAGERSTORE_HH 00052 #define G4FIELDMANAGERSTORE_HH 00053 00054 #include <vector> 00055 00056 #include "G4FieldManager.hh" 00057 00058 class G4FieldManagerStore : public std::vector<G4FieldManager*> 00059 { 00060 public: // with description 00061 00062 static void Register(G4FieldManager* pVolume); 00063 // Add the logical volume to the collection. 00064 static void DeRegister(G4FieldManager* pVolume); 00065 // Remove the logical volume from the collection. 00066 static G4FieldManagerStore* GetInstance(); 00067 // Get a ptr to the unique G4FieldManagerStore, creating it if necessary. 00068 static void Clean(); 00069 // Delete all volumes from the store. 00070 00071 void ClearAllChordFindersState(); 00072 // Looping over all field managers, call each one to reset step estimate 00073 00074 virtual ~G4FieldManagerStore(); 00075 // Destructor: takes care to delete allocated field managers. 00076 00077 protected: 00078 00079 G4FieldManagerStore(); 00080 00081 private: 00082 00083 static G4FieldManagerStore* fgInstance; 00084 static G4bool locked; 00085 }; 00086 00087 #endif