Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ITBox.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 // $Id: G4ITBox.hh 64057 2012-10-30 15:04:49Z gcosmo $
27 //
28 // Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
29 //
30 // WARNING : This class is released as a prototype.
31 // It might strongly evolve or even disapear in the next releases.
32 //
33 // History:
34 // -----------
35 // 10 Oct 2011 M.Karamitros created
36 //
37 // -------------------------------------------------------------------
38 
39 #ifndef G4ITBox_h
40 #define G4ITBox_h
41 
42 #include "G4IT.hh"
43 
44 /**
45  * A G4ITBox contains all IT of the same kind.
46  * eg : all °OH
47  * It behaves just like a stack.
48  */
49 
50 class G4ITBox
51 {
52 
53 public :
54  G4ITBox();
55  ~G4ITBox();
56 
57  void ResetStack();
58  void Push(G4IT*);
59  void Extract(G4IT*);
60 
61  /** The FindIT methods are used for check only.
62  * Those methods are not effective due to the
63  * linear search. It is better to use GetIT(track)
64  * in order to retrieve the IT and GetIT(track)->GetBox()
65  * in order to check which is the box pointer.
66  */
67  G4IT* FindIT(const G4Track&) ;
68  const G4IT* FindIT(const G4Track&) const;
69  void TransferTo(G4ITBox*);
70 
71  inline G4bool Empty() const;
72  inline G4int GetNTrack() const;
73 
74  inline G4IT* GetFirstIT();
75  inline G4IT* GetLastIT();
76  inline const G4IT* GetFirstIT() const;
77  inline const G4IT* GetLastIT() const;
78 
79  inline void SetNextBox(G4ITBox* box);
80  inline G4ITBox* GetNextBox();
81  inline void SetPreviousBox(G4ITBox* box);
82  inline G4ITBox* GetPreviousBox();
83 
84 private :
85  const G4ITBox & operator=
86  (const G4ITBox &right);
87  G4int fNbIT;
88  G4IT * fpFirstIT;
89  G4IT * fpLastIT;
90 
91  G4ITBox* fpPreviousBox;
92  G4ITBox* fpNextBox;
93 };
94 
95 inline G4bool G4ITBox::Empty() const
96 {
97  return (fNbIT==0);
98 }
99 
100 inline G4int G4ITBox::GetNTrack() const
101 {
102  return fNbIT ;
103 }
105 {
106  return fpFirstIT ;
107 }
109 {
110  return fpLastIT ;
111 }
112 
113 inline const G4IT* G4ITBox::GetFirstIT() const
114 {
115  return fpFirstIT ;
116 }
117 inline const G4IT* G4ITBox::GetLastIT() const
118 {
119  return fpLastIT ;
120 }
121 
122 inline void G4ITBox::SetNextBox(G4ITBox* box)
123 {
124  fpNextBox = box;
125 }
126 
128 {
129  return fpNextBox ;
130 }
131 
133 {
134  fpPreviousBox = box;
135 }
136 
138 {
139  return fpPreviousBox ;
140 }
141 
142 #endif
G4int GetNTrack() const
Definition: G4ITBox.hh:100
Definition: G4IT.hh:82
void Push(G4IT *)
Definition: G4ITBox.cc:70
G4ITBox()
Definition: G4ITBox.cc:38
G4bool Empty() const
Definition: G4ITBox.hh:95
G4ITBox * GetNextBox()
Definition: G4ITBox.hh:127
int G4int
Definition: G4Types.hh:78
G4ITBox * GetPreviousBox()
Definition: G4ITBox.hh:137
void SetPreviousBox(G4ITBox *box)
Definition: G4ITBox.hh:132
G4IT * GetFirstIT()
Definition: G4ITBox.hh:104
bool G4bool
Definition: G4Types.hh:79
void ResetStack()
void SetNextBox(G4ITBox *box)
Definition: G4ITBox.hh:122
G4IT * FindIT(const G4Track &)
Definition: G4ITBox.cc:110
~G4ITBox()
Definition: G4ITBox.cc:41
G4IT * GetLastIT()
Definition: G4ITBox.hh:108
void TransferTo(G4ITBox *)
Definition: G4ITBox.cc:150
void Extract(G4IT *)
Definition: G4ITBox.cc:87