Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4ITBox Class Reference

#include <G4ITBox.hh>

Public Member Functions

 G4ITBox ()
 
 ~G4ITBox ()
 
void ResetStack ()
 
void Push (G4IT *)
 
void Extract (G4IT *)
 
G4ITFindIT (const G4Track &)
 
const G4ITFindIT (const G4Track &) const
 
void TransferTo (G4ITBox *)
 
G4bool Empty () const
 
G4int GetNTrack () const
 
G4ITGetFirstIT ()
 
G4ITGetLastIT ()
 
const G4ITGetFirstIT () const
 
const G4ITGetLastIT () const
 
void SetNextBox (G4ITBox *box)
 
G4ITBoxGetNextBox ()
 
void SetPreviousBox (G4ITBox *box)
 
G4ITBoxGetPreviousBox ()
 

Detailed Description

A G4ITBox contains all IT of the same kind. eg : all °OH It behaves just like a stack.

Definition at line 50 of file G4ITBox.hh.

Constructor & Destructor Documentation

G4ITBox::G4ITBox ( )

Definition at line 38 of file G4ITBox.cc.

38  : fNbIT(0), fpFirstIT(0), fpLastIT(0), fpPreviousBox(0), fpNextBox(0)
39 {;}
G4ITBox::~G4ITBox ( )

Definition at line 41 of file G4ITBox.cc.

References G4IT::GetNext(), SetNextBox(), and SetPreviousBox().

42 {
43  if( fNbIT != 0 )
44  {
45  G4IT * aIT = fpFirstIT;
46  G4IT * nextIT;
47 
48  while( aIT != 0 )
49  {
50  nextIT = aIT->GetNext();
51  delete aIT;
52  aIT = nextIT;
53  }
54  }
55 
56  if(fpPreviousBox) fpPreviousBox->SetNextBox(fpNextBox) ;
57  if(fpNextBox) fpNextBox->SetPreviousBox(fpPreviousBox);
58 }
Definition: G4IT.hh:82
G4IT * GetNext()
Definition: G4IT.hh:198
void SetPreviousBox(G4ITBox *box)
Definition: G4ITBox.hh:132
void SetNextBox(G4ITBox *box)
Definition: G4ITBox.hh:122

Member Function Documentation

G4bool G4ITBox::Empty ( ) const
inline

Definition at line 95 of file G4ITBox.hh.

96 {
97  return (fNbIT==0);
98 }
void G4ITBox::Extract ( G4IT aStackedIT)

Definition at line 87 of file G4ITBox.cc.

References G4IT::GetNext(), G4IT::GetPrevious(), G4IT::SetITBox(), G4IT::SetNext(), and G4IT::SetPrevious().

Referenced by G4IT::TakeOutBox(), and TransferTo().

88 {
89  if( aStackedIT == fpFirstIT )
90  {
91  fpFirstIT = aStackedIT->GetNext();
92  }
93  else if( aStackedIT == fpLastIT )
94  {
95  fpLastIT = aStackedIT->GetPrevious();
96 
97  }
98 
99  if( aStackedIT->GetNext())
100  aStackedIT->GetNext()->SetPrevious(aStackedIT->GetPrevious());
101  if( aStackedIT->GetPrevious())
102  aStackedIT->GetPrevious()->SetNext(aStackedIT->GetNext());
103 
104  aStackedIT->SetNext(0);
105  aStackedIT->SetPrevious(0);
106  aStackedIT->SetITBox(0);
107  fNbIT--;
108 }
void SetNext(G4IT *)
Definition: G4IT.hh:188
void SetITBox(G4ITBox *)
Definition: G4IT.hh:178
G4IT * GetPrevious()
Definition: G4IT.hh:193
G4IT * GetNext()
Definition: G4IT.hh:198
void SetPrevious(G4IT *)
Definition: G4IT.hh:183
G4IT * G4ITBox::FindIT ( const G4Track track)

The FindIT methods are used for check only. Those methods are not effective due to the linear search. It is better to use GetIT(track) in order to retrieve the IT and GetIT(track)->GetBox() in order to check which is the box pointer.

Definition at line 110 of file G4ITBox.cc.

References G4IT::GetPrevious().

111 {
112  if( fNbIT == 0 ) return 0;
113 
114  G4IT * temp = fpLastIT;
115  G4bool find = false;
116 
117  while(find == false && temp != 0)
118  {
119  if(temp-> GetTrack() == &track)
120  {
121  find = true;
122  break;
123  }
124  temp = temp->GetPrevious();
125  }
126 
127  return temp;
128 }
Definition: G4IT.hh:82
G4IT * GetPrevious()
Definition: G4IT.hh:193
bool G4bool
Definition: G4Types.hh:79
const G4IT * G4ITBox::FindIT ( const G4Track track) const

Definition at line 130 of file G4ITBox.cc.

References G4IT::GetPrevious().

131 {
132  if( fNbIT == 0 ) return 0;
133 
134  const G4IT * temp = fpLastIT;
135  G4bool find = false;
136 
137  while(find == false && temp != 0)
138  {
139  if(temp-> GetTrack() == &track)
140  {
141  find = true;
142  break;
143  }
144  temp = temp->GetPrevious();
145  }
146 
147  return temp;
148 }
Definition: G4IT.hh:82
G4IT * GetPrevious()
Definition: G4IT.hh:193
bool G4bool
Definition: G4Types.hh:79
G4IT * G4ITBox::GetFirstIT ( )
inline

Definition at line 104 of file G4ITBox.hh.

105 {
106  return fpFirstIT ;
107 }
const G4IT * G4ITBox::GetFirstIT ( ) const
inline

Definition at line 113 of file G4ITBox.hh.

114 {
115  return fpFirstIT ;
116 }
G4IT * G4ITBox::GetLastIT ( )
inline

Definition at line 108 of file G4ITBox.hh.

109 {
110  return fpLastIT ;
111 }
const G4IT * G4ITBox::GetLastIT ( ) const
inline

Definition at line 117 of file G4ITBox.hh.

118 {
119  return fpLastIT ;
120 }
G4ITBox * G4ITBox::GetNextBox ( )
inline

Definition at line 127 of file G4ITBox.hh.

Referenced by G4ITManager< T >::GetNextBox().

128 {
129  return fpNextBox ;
130 }
G4int G4ITBox::GetNTrack ( ) const
inline

Definition at line 100 of file G4ITBox.hh.

101 {
102  return fNbIT ;
103 }
G4ITBox * G4ITBox::GetPreviousBox ( )
inline

Definition at line 137 of file G4ITBox.hh.

138 {
139  return fpPreviousBox ;
140 }
void G4ITBox::Push ( G4IT aIT)

Definition at line 70 of file G4ITBox.cc.

References G4IT::SetITBox(), G4IT::SetNext(), and G4IT::SetPrevious().

Referenced by TransferTo().

71 {
72  if( fNbIT == 0 )
73  {
74  aIT->SetPrevious( 0 );
75  fpFirstIT = aIT;
76  }
77  else
78  {
79  fpLastIT->SetNext( aIT );
80  aIT->SetPrevious( fpLastIT );
81  }
82  fpLastIT = aIT;
83  fNbIT++;
84  aIT->SetITBox(this);
85 }
void SetNext(G4IT *)
Definition: G4IT.hh:188
void SetITBox(G4ITBox *)
Definition: G4IT.hh:178
void SetPrevious(G4IT *)
Definition: G4IT.hh:183
void G4ITBox::ResetStack ( )
void G4ITBox::SetNextBox ( G4ITBox box)
inline

Definition at line 122 of file G4ITBox.hh.

Referenced by ~G4ITBox().

123 {
124  fpNextBox = box;
125 }
void G4ITBox::SetPreviousBox ( G4ITBox box)
inline

Definition at line 132 of file G4ITBox.hh.

Referenced by ~G4ITBox().

133 {
134  fpPreviousBox = box;
135 }
void G4ITBox::TransferTo ( G4ITBox aStack)

Definition at line 150 of file G4ITBox.cc.

References Extract(), G4IT::GetNext(), and Push().

151 {
152  G4IT * ITToTransfer = fpFirstIT;
153  while(fNbIT)
154  {
155  Extract(ITToTransfer);
156  aStack->Push(ITToTransfer);
157  ITToTransfer = ITToTransfer->GetNext();
158  }
159 }
Definition: G4IT.hh:82
void Push(G4IT *)
Definition: G4ITBox.cc:70
G4IT * GetNext()
Definition: G4IT.hh:198
void Extract(G4IT *)
Definition: G4ITBox.cc:87

The documentation for this class was generated from the following files: