Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4FieldManagerStore.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4FieldManagerStore.hh 66872 2013-01-15 01:25:57Z japost $
28 //
29 // class G4FieldManagerStore
30 //
31 // Class description:
32 //
33 // Container for all FieldManagers, with functionality derived from
34 // std::vector<T>. The class is a `singleton', in that only
35 // one can exist, and access is provided via the static function
36 // G4FieldManagerStore::GetInstance()
37 //
38 // All FieldManagers should be registered with G4FieldManagerStore,
39 // and removed on their destruction.
40 // Intended principally to enable resetting of 'state' at start of event.
41 // The underlying container initially has a capacity of 100.
42 //
43 // Member data:
44 //
45 // static G4FieldManagerStore* fgInstance
46 // - Ptr to the single G4FieldManagerStore.
47 
48 // History:
49 // 07.12.07 J.Apostolakis Initial version
50 // --------------------------------------------------------------------
51 #ifndef G4FIELDMANAGERSTORE_HH
52 #define G4FIELDMANAGERSTORE_HH
53 
54 #include <vector>
55 
56 #include "G4FieldManager.hh"
57 
58 class G4FieldManagerStore : public std::vector<G4FieldManager*>
59 {
60  public: // with description
61 
62  static void Register(G4FieldManager* pVolume);
63  // Add the logical volume to the collection.
64  static void DeRegister(G4FieldManager* pVolume);
65  // Remove the logical volume from the collection.
67  // Get a ptr to the unique G4FieldManagerStore, creating it if necessary.
68  static void Clean();
69  // Delete all volumes from the store.
70 
72  // Looping over all field managers, call each one to reset step estimate
73 
74  virtual ~G4FieldManagerStore();
75  // Destructor: takes care to delete allocated field managers.
76 
77  protected:
78 
80 
81  private:
82 
83  static G4ThreadLocal G4FieldManagerStore* fgInstance;
84  static G4ThreadLocal G4bool locked;
85 };
86 
87 #endif
#define G4ThreadLocal
Definition: tls.hh:52
bool G4bool
Definition: G4Types.hh:79
static G4FieldManagerStore * GetInstance()
static void Register(G4FieldManager *pVolume)
static void DeRegister(G4FieldManager *pVolume)