Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // G4ProcTblElement inline methods implementat << 27 // 23 // 28 // Author: H.Kurashige, 04.08.1998 << 24 // $Id: G4ProcTblElement.icc,v 1.7 2001/07/11 10:08:17 gunter Exp $ 29 // ------------------------------------------- << 25 // GEANT4 tag $Name: geant4-05-02-patch-01 $ >> 26 // >> 27 // >> 28 // ------------------------------------------------------------ >> 29 // GEANT 4 class header file >> 30 // >> 31 // History: first implementation, based on object model of >> 32 // 4th Aug 1998, H.Kurashige >> 33 // ------------------------------------------------------------ >> 34 // Use STL vector instead of RW vector 1. Mar 00 H.Kurashige 30 35 >> 36 ///////////// 31 inline 37 inline 32 G4bool G4ProcTblElement::Contains(const G4Proc << 38 G4bool G4ProcTblElement::Contains(const G4ProcessManager* pManager) const 33 { 39 { 34 for (auto i = pProcMgrVector->cbegin(); i!= << 40 G4ProcMgrVector::iterator i; 35 { << 41 for (i = pProcMgrVector->begin(); i!= pProcMgrVector->end(); ++i) { 36 if (*i==pManager) return true; 42 if (*i==pManager) return true; 37 } 43 } 38 return false; 44 return false; 39 } 45 } 40 46 41 // ------------------------------------------- << 47 ////////////////////////// 42 inline 48 inline 43 G4int G4ProcTblElement::GetIndex(const G4Proce << 49 G4int G4ProcTblElement::GetIndex(const G4ProcessManager* pManager) const 44 { 50 { 45 G4int index = 0; 51 G4int index = 0; 46 for (auto i = pProcMgrVector->cbegin(); i!= << 52 G4ProcMgrVector::iterator i; 47 { << 53 for (i = pProcMgrVector->begin(); i!= pProcMgrVector->end(); ++i) { 48 if (*i==pManager) return index; 54 if (*i==pManager) return index; 49 index +=1; 55 index +=1; 50 } 56 } 51 return -1; 57 return -1; 52 } 58 } 53 59 54 // ------------------------------------------- << 60 >> 61 ////////////////////////// 55 inline 62 inline 56 G4int G4ProcTblElement::Length() const << 63 G4int G4ProcTblElement::Length() const 57 { 64 { 58 return G4int(pProcMgrVector->size()); << 65 return pProcMgrVector->size(); 59 } 66 } 60 67 61 // ------------------------------------------- << 68 ////////////////////////// 62 inline 69 inline 63 G4ProcessManager* G4ProcTblElement::GetProcess << 70 G4ProcessManager* G4ProcTblElement::GetProcessManager(G4int index) const 64 { 71 { 65 if ((index < G4int(pProcMgrVector->size())) << 72 if ((index < G4int(pProcMgrVector->size())) && (index>=0)){ 66 { << 67 return (*pProcMgrVector)[index]; 73 return (*pProcMgrVector)[index]; 68 } << 74 } else { 69 else << 75 return 0; 70 { << 71 return nullptr; << 72 } 76 } 73 } 77 } 74 78 75 // ------------------------------------------- << 79 >> 80 ////////////////////////// 76 inline 81 inline 77 G4VProcess* G4ProcTblElement::GetProcess() con << 82 G4VProcess* G4ProcTblElement::GetProcess() const 78 { 83 { 79 return pProcess; 84 return pProcess; 80 } 85 } 81 86 82 // ------------------------------------------- << 87 >> 88 ////////////////////////// 83 inline 89 inline 84 void G4ProcTblElement::Insert(G4ProcessManage << 90 void G4ProcTblElement::Insert(G4ProcessManager* aProcMgr) 85 { 91 { 86 pProcMgrVector->push_back(aProcMgr); 92 pProcMgrVector->push_back(aProcMgr); 87 } 93 } 88 94 89 // ------------------------------------------- << 95 ////////////////////////// 90 inline 96 inline 91 void G4ProcTblElement::Remove(G4ProcessManager << 97 void G4ProcTblElement::Remove(G4ProcessManager* aProcMgr) 92 { 98 { 93 for (auto i = pProcMgrVector->cbegin(); i!= << 99 G4ProcMgrVector::iterator i; 94 { << 100 for (i = pProcMgrVector->begin(); i!= pProcMgrVector->end(); ++i) { 95 if (*i==aProcMgr) << 101 if (*i==aProcMgr){ 96 { << 97 pProcMgrVector->erase(i); 102 pProcMgrVector->erase(i); 98 break; 103 break; 99 } 104 } 100 } 105 } 101 } 106 } 102 107 103 // ------------------------------------------- << 108 ////////////////////////// 104 inline 109 inline 105 const G4String& G4ProcTblElement::GetProcessNa << 110 const G4String& G4ProcTblElement::GetProcessName() const 106 { 111 { 107 return pProcess->GetProcessName(); 112 return pProcess->GetProcessName(); 108 } << 109 << 110 // ------------------------------------------- << 111 inline const std::vector<G4ProcessManager*>* << 112 G4ProcTblElement::GetProcMgrVector() const << 113 { << 114 return pProcMgrVector; << 115 } 113 } 116 114