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.

00038                  : fNbIT(0), fpFirstIT(0), fpLastIT(0), fpPreviousBox(0), fpNextBox(0)
00039 {;}

G4ITBox::~G4ITBox (  ) 

Definition at line 41 of file G4ITBox.cc.

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

00042 {
00043     if( fNbIT != 0 )
00044     {
00045         G4IT * aIT = fpFirstIT;
00046         G4IT * nextIT;
00047 
00048         while( aIT != 0 )
00049         {
00050             nextIT = aIT->GetNext();
00051             delete aIT;
00052             aIT = nextIT;
00053         }
00054     }
00055 
00056     if(fpPreviousBox)    fpPreviousBox->SetNextBox(fpNextBox) ;
00057     if(fpNextBox)        fpNextBox->SetPreviousBox(fpPreviousBox);
00058 }


Member Function Documentation

G4bool G4ITBox::Empty (  )  const [inline]

Definition at line 95 of file G4ITBox.hh.

00096 {
00097     return (fNbIT==0);
00098 }

void G4ITBox::Extract ( G4IT  ) 

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().

00088 {
00089     if( aStackedIT == fpFirstIT )
00090     {
00091         fpFirstIT = aStackedIT->GetNext();
00092     }
00093     else  if( aStackedIT == fpLastIT )
00094     {
00095         fpLastIT = aStackedIT->GetPrevious();
00096 
00097     }
00098 
00099     if( aStackedIT->GetNext())
00100         aStackedIT->GetNext()->SetPrevious(aStackedIT->GetPrevious());
00101     if( aStackedIT->GetPrevious())
00102         aStackedIT->GetPrevious()->SetNext(aStackedIT->GetNext());
00103 
00104     aStackedIT->SetNext(0);
00105     aStackedIT->SetPrevious(0);
00106     aStackedIT->SetITBox(0);
00107     fNbIT--;
00108 }

const G4IT * G4ITBox::FindIT ( const G4Track  )  const

Definition at line 130 of file G4ITBox.cc.

References G4IT::GetPrevious().

00131 {
00132     if( fNbIT == 0 ) return 0;
00133 
00134     const G4IT * temp = fpLastIT;
00135     G4bool find = false;
00136 
00137     while(find == false && temp != 0)
00138     {
00139         if(temp-> GetTrack() == &track)
00140         {
00141             find = true;
00142             break;
00143         }
00144         temp = temp->GetPrevious();
00145     }
00146 
00147     return temp;
00148 }

G4IT * G4ITBox::FindIT ( const G4Track  ) 

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().

00111 {
00112     if( fNbIT == 0 ) return 0;
00113 
00114     G4IT * temp = fpLastIT;
00115     G4bool find = false;
00116 
00117     while(find == false && temp != 0)
00118     {
00119         if(temp-> GetTrack() == &track)
00120         {
00121             find = true;
00122             break;
00123         }
00124         temp = temp->GetPrevious();
00125     }
00126 
00127     return temp;
00128 }

const G4IT * G4ITBox::GetFirstIT (  )  const [inline]

Definition at line 113 of file G4ITBox.hh.

00114 {
00115     return fpFirstIT ;
00116 }

G4IT * G4ITBox::GetFirstIT (  )  [inline]

Definition at line 104 of file G4ITBox.hh.

Referenced by G4VITManager::iterator::begin(), and G4VITManager::allbox_iterator::operator++().

00105 {
00106     return fpFirstIT ;
00107 }

const G4IT * G4ITBox::GetLastIT (  )  const [inline]

Definition at line 117 of file G4ITBox.hh.

00118 {
00119     return fpLastIT ;
00120 }

G4IT * G4ITBox::GetLastIT (  )  [inline]

Definition at line 108 of file G4ITBox.hh.

00109 {
00110     return fpLastIT ;
00111 }

G4ITBox * G4ITBox::GetNextBox (  )  [inline]

Definition at line 127 of file G4ITBox.hh.

Referenced by G4ITManager< T >::GetNextBox(), and G4VITManager::allbox_iterator::operator++().

00128 {
00129     return fpNextBox ;
00130 }

G4int G4ITBox::GetNTrack (  )  const [inline]

Definition at line 100 of file G4ITBox.hh.

00101 {
00102     return fNbIT ;
00103 }

G4ITBox * G4ITBox::GetPreviousBox (  )  [inline]

Definition at line 137 of file G4ITBox.hh.

00138 {
00139     return fpPreviousBox ;
00140 }

void G4ITBox::Push ( G4IT  ) 

Definition at line 70 of file G4ITBox.cc.

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

Referenced by TransferTo().

00071 {
00072     if( fNbIT == 0 )
00073     {
00074         aIT->SetPrevious( 0 );
00075         fpFirstIT = aIT;
00076     }
00077     else
00078     {
00079         fpLastIT->SetNext( aIT );
00080         aIT->SetPrevious( fpLastIT );
00081     }
00082     fpLastIT = aIT;
00083     fNbIT++;
00084     aIT->SetITBox(this);
00085 }

void G4ITBox::ResetStack (  ) 

void G4ITBox::SetNextBox ( G4ITBox box  )  [inline]

Definition at line 122 of file G4ITBox.hh.

Referenced by ~G4ITBox().

00123 {
00124     fpNextBox = box;
00125 }

void G4ITBox::SetPreviousBox ( G4ITBox box  )  [inline]

Definition at line 132 of file G4ITBox.hh.

00133 {
00134     fpPreviousBox = box;
00135 }

void G4ITBox::TransferTo ( G4ITBox  ) 

Definition at line 150 of file G4ITBox.cc.

References Extract(), and Push().

00151 {
00152     G4IT * ITToTransfer = fpFirstIT;
00153     while(fNbIT)
00154     {
00155         Extract(ITToTransfer);
00156         aStack->Push(ITToTransfer);
00157         ITToTransfer = ITToTransfer->GetNext();
00158     }
00159 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:52:19 2013 for Geant4 by  doxygen 1.4.7