Files
geant4/source/processes/management/include/G4ProcTblElement.icc
2020-06-26 10:23:25 +02:00

116 lines
3.8 KiB
Plaintext

//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4ProcTblElement inline methods implementation
//
// Author: H.Kurashige, 04.08.1998
// --------------------------------------------------------------------
inline
G4bool G4ProcTblElement::Contains(const G4ProcessManager* pManager) const
{
for (auto i = pProcMgrVector->cbegin(); i!= pProcMgrVector->cend(); ++i)
{
if (*i==pManager) return true;
}
return false;
}
// --------------------------------------------------------------------
inline
G4int G4ProcTblElement::GetIndex(const G4ProcessManager* pManager) const
{
G4int index = 0;
for (auto i = pProcMgrVector->cbegin(); i!= pProcMgrVector->cend(); ++i)
{
if (*i==pManager) return index;
index +=1;
}
return -1;
}
// --------------------------------------------------------------------
inline
G4int G4ProcTblElement::Length() const
{
return G4int(pProcMgrVector->size());
}
// --------------------------------------------------------------------
inline
G4ProcessManager* G4ProcTblElement::GetProcessManager(G4int index) const
{
if ((index < G4int(pProcMgrVector->size())) && (index>=0))
{
return (*pProcMgrVector)[index];
}
else
{
return nullptr;
}
}
// --------------------------------------------------------------------
inline
G4VProcess* G4ProcTblElement::GetProcess() const
{
return pProcess;
}
// --------------------------------------------------------------------
inline
void G4ProcTblElement::Insert(G4ProcessManager* aProcMgr)
{
pProcMgrVector->push_back(aProcMgr);
}
// --------------------------------------------------------------------
inline
void G4ProcTblElement::Remove(G4ProcessManager* aProcMgr)
{
for (auto i = pProcMgrVector->cbegin(); i!= pProcMgrVector->cend(); ++i)
{
if (*i==aProcMgr)
{
pProcMgrVector->erase(i);
break;
}
}
}
// --------------------------------------------------------------------
inline
const G4String& G4ProcTblElement::GetProcessName() const
{
return pProcess->GetProcessName();
}
// --------------------------------------------------------------------
inline const std::vector<G4ProcessManager*>*
G4ProcTblElement::GetProcMgrVector() const
{
return pProcMgrVector;
}