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,v 1.3 2008/01/17 09:39:08 gcosmo Exp $ |
---|
28 | // GEANT4 tag $Name: HEAD $ |
---|
29 | // |
---|
30 | // class G4FieldManagerStore |
---|
31 | // |
---|
32 | // Class description: |
---|
33 | // |
---|
34 | // Container for all FieldManagers, with functionality derived from |
---|
35 | // std::vector<T>. The class is a `singleton', in that only |
---|
36 | // one can exist, and access is provided via the static function |
---|
37 | // G4FieldManagerStore::GetInstance() |
---|
38 | // |
---|
39 | // All FieldManagers should be registered with G4FieldManagerStore, |
---|
40 | // and removed on their destruction. |
---|
41 | // Intended principally to enable resetting of 'state' at start of event. |
---|
42 | // The underlying container initially has a capacity of 100. |
---|
43 | // |
---|
44 | // Member data: |
---|
45 | // |
---|
46 | // static G4FieldManagerStore* fgInstance |
---|
47 | // - Ptr to the single G4FieldManagerStore. |
---|
48 | |
---|
49 | // History: |
---|
50 | // 07.12.07 J.Apostolakis Initial version |
---|
51 | // -------------------------------------------------------------------- |
---|
52 | #ifndef G4FIELDMANAGERSTORE_HH |
---|
53 | #define G4FIELDMANAGERSTORE_HH |
---|
54 | |
---|
55 | #include <vector> |
---|
56 | |
---|
57 | #include "G4FieldManager.hh" |
---|
58 | |
---|
59 | class G4FieldManagerStore : public std::vector<G4FieldManager*> |
---|
60 | { |
---|
61 | public: // with description |
---|
62 | |
---|
63 | static void Register(G4FieldManager* pVolume); |
---|
64 | // Add the logical volume to the collection. |
---|
65 | static void DeRegister(G4FieldManager* pVolume); |
---|
66 | // Remove the logical volume from the collection. |
---|
67 | static G4FieldManagerStore* GetInstance(); |
---|
68 | // Get a ptr to the unique G4FieldManagerStore, creating it if necessary. |
---|
69 | static void Clean(); |
---|
70 | // Delete all volumes from the store. |
---|
71 | |
---|
72 | void ClearAllChordFindersState(); |
---|
73 | // Looping over all field managers, call each one to reset step estimate |
---|
74 | |
---|
75 | virtual ~G4FieldManagerStore(); |
---|
76 | // Destructor: takes care to delete allocated field managers. |
---|
77 | |
---|
78 | protected: |
---|
79 | |
---|
80 | G4FieldManagerStore(); |
---|
81 | |
---|
82 | private: |
---|
83 | |
---|
84 | static G4FieldManagerStore* fgInstance; |
---|
85 | static G4bool locked; |
---|
86 | }; |
---|
87 | |
---|
88 | #endif |
---|