Geant4_10
G4ITManager_iterator.cc
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: G4ITManager_iterator.cc 64057 2012-10-30 15:04:49Z gcosmo $
27 //
28 // Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
29 //
30 // History:
31 // -----------
32 // 10 Oct 2011 M.Karamitros created
33 //
34 // -------------------------------------------------------------------
35 
36 #include "G4ITManager.hh"
37 
38 // Description of G4ITManager<IT>::iterator
39 
41 {
42  if(box)
43  {
44  fCurrentBox = box ;
45  }
46  else
47  {
48  fCurrentBox = 0;
49  }
50 
51  fNextIT = 0;
52 }
53 //______________________________________________________________________
54 
56 {
57  if(fCurrentBox)
58  {
59  fNextIT = fCurrentBox->GetFirstIT();
60 
61  if(fNextIT)
62  {
63 // G4cout << "G4VITManager::allbox_iterator, fNextIT :" << fNextIT -> GetName()<< G4endl;
64  return true;
65  }
66  }
67 
68  return false;
69 }
70 //______________________________________________________________________
71 
73 {
74  if(fCurrentBox)
75  {
76  if(fNextIT)
77  {
78  fNextIT = fNextIT->GetNext();
79  }
80  }
81  return *this;
82 }
83 
84 //______________________________________________________________________
85 
87 {
88  if(fNextIT) return false;
89  return true ;
90 }
91 
92 //______________________________________________________________________
93 
95 {
96  if(this != &i)
97  {
98  fNextIT = i.fNextIT;
99  fCurrentBox = i.fCurrentBox;
100  }
101  return *this;
102 }
103 
104 //______________________________________________________________________
105 
107 {
108  return fNextIT;
109 }
110 
111 //______________________________________________________________________
112 
114 {
115  return fCurrentBox;
116 }
117 
118 //______________________________________________________________________
119 
121 {
122  if(fNextIT)
123  {
124  if(fNextIT->GetTrack())
125  {
126  G4cout
127  << fNextIT->GetTrack()->GetTrackID()
128  << "\t"
129  << fNextIT->GetName()
130  << G4endl;
131  }
132  }
133  else
134  {
135  G4cout<<"fNextIT = 0"<<G4endl;
136  }
137 }
138 
Definition: G4IT.hh:82
iterator & operator++(G4int)
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
bool G4bool
Definition: G4Types.hh:79
iterator & operator=(const iterator &i)
#define G4endl
Definition: G4ios.hh:61
UBox box
Definition: UPolycone.cc:32