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