// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ProcTblElement.icc,v 1.5 2000/03/02 01:45:10 kurasige Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// 
// ------------------------------------------------------------
//	GEANT 4 class header file 
//
//	For information related to this code contact:
//	CERN, IT Division, ASD group
//	History: first implementation, based on object model of
//	4th Aug 1998, H.Kurashige
// ------------------------------------------------------------
//   Use STL vector instead of RW vector    1. Mar 00 H.Kurashige

/////////////
inline 
 G4bool G4ProcTblElement::Contains(const G4ProcessManager* pManager) const
{
  G4ProcMgrVector::iterator i;
  for (i = pProcMgrVector->begin(); i!= pProcMgrVector->end(); ++i) {
    if (*i==pManager) return true;
  }
  return false;
}

//////////////////////////
inline 
 G4int  G4ProcTblElement::GetIndex(const G4ProcessManager* pManager) const
{
  G4int index = 0;
  G4ProcMgrVector::iterator i;
  for (i = pProcMgrVector->begin(); i!= pProcMgrVector->end(); ++i) {
    if (*i==pManager) return index;
    index +=1;
  }
  return -1;
}


//////////////////////////
inline 
 G4int  G4ProcTblElement::Length() const
{
  return pProcMgrVector->size();
} 

//////////////////////////
inline 
 G4ProcessManager* G4ProcTblElement::GetProcessManager(G4int index) const
{
  if ((index < pProcMgrVector->size()) && (index>=0)){
    return (*pProcMgrVector)[index];
  } else {
    return 0;
  }
}


//////////////////////////
inline 
 G4VProcess* G4ProcTblElement::GetProcess() const
{
  return pProcess;
}


//////////////////////////
inline 
 void  G4ProcTblElement::Insert(G4ProcessManager* aProcMgr)
{
  pProcMgrVector->push_back(aProcMgr);
} 

//////////////////////////
inline 
 void  G4ProcTblElement::Remove(G4ProcessManager* aProcMgr)
{
  G4ProcMgrVector::iterator i;
  for (i = pProcMgrVector->begin(); i!= pProcMgrVector->end(); ++i) {
    if (*i==aProcMgr){
      pProcMgrVector->erase(i); 
      break;
    } 
  }
} 

//////////////////////////
inline 
 const G4String& G4ProcTblElement::GetProcessName() const
{
  return  pProcess->GetProcessName();
}
