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 // G4ProcessVector inline methods implementati << 27 // 26 // 28 // Authors: G.Cosmo, H.Kurashige - 1998 << 27 // $Id: G4ProcessVector.icc,v 1.5 2006/06/29 21:07:42 gunter Exp $ 29 // ------------------------------------------- << 28 // GEANT4 tag $Name: geant4-08-01 $ 30 << 29 // 31 inline G4bool G4ProcessVector::operator==(cons << 30 inline G4bool G4ProcessVector::operator==(const G4ProcessVector &right) const 32 { 31 { 33 return (this == (G4ProcessVector *) &right); 32 return (this == (G4ProcessVector *) &right); 34 } 33 } 35 34 36 inline std::size_t G4ProcessVector::entries() << 35 inline G4int G4ProcessVector::entries() const 37 { 36 { 38 return pProcVector->size(); 37 return pProcVector->size(); 39 } 38 } 40 39 41 inline std::size_t G4ProcessVector::size() con << 40 inline G4int G4ProcessVector::size() const 42 { 41 { 43 return pProcVector->size(); 42 return pProcVector->size(); 44 } 43 } 45 44 46 inline std::size_t G4ProcessVector::length() c << 45 inline G4int G4ProcessVector::length() const 47 { 46 { 48 return pProcVector->size(); 47 return pProcVector->size(); 49 } 48 } 50 49 >> 50 inline G4int G4ProcessVector::index(G4VProcess* aProcess) const >> 51 { >> 52 G4ProcVector::iterator it; >> 53 size_t j=0; >> 54 for (it=pProcVector->begin();it!=pProcVector->end(); ++j,it++) { >> 55 if (*(*it)==*aProcess) return j; >> 56 } >> 57 return -1; >> 58 } >> 59 >> 60 inline G4bool G4ProcessVector::contains(G4VProcess* aProcess) const >> 61 { >> 62 G4ProcVector::iterator it; >> 63 for (it=pProcVector->begin();it!=pProcVector->end(); it++) { >> 64 if (*(*it)==*aProcess) return true; >> 65 } >> 66 return false; >> 67 } >> 68 51 inline G4bool G4ProcessVector::insert(G4VProce 69 inline G4bool G4ProcessVector::insert(G4VProcess* aProcess) 52 { 70 { 53 pProcVector->push_back(aProcess); 71 pProcVector->push_back(aProcess); 54 return true; 72 return true; 55 } 73 } 56 74 >> 75 inline G4bool G4ProcessVector::insertAt(G4int i,G4VProcess* aProcess) >> 76 { >> 77 if ( (i<0) || (i>G4int(pProcVector->size())) ) return false; >> 78 if (i==G4int(pProcVector->size())) { >> 79 pProcVector->push_back(aProcess); >> 80 } else { >> 81 G4ProcVector::iterator it=pProcVector->begin(); >> 82 int j; >> 83 for(j=0;j!=i;++j) it++; >> 84 pProcVector->insert(it, aProcess); >> 85 } >> 86 return true; >> 87 } >> 88 >> 89 inline G4VProcess* G4ProcessVector::removeAt(G4int i) >> 90 { >> 91 G4ProcVector::iterator it=pProcVector->begin(); >> 92 for(size_t j=0;j<pProcVector->size() && G4int(j)<i;++j) it++; >> 93 G4VProcess* rValue = *it; >> 94 pProcVector->erase(it); >> 95 return rValue; >> 96 } >> 97 57 inline G4VProcess* G4ProcessVector::removeLast 98 inline G4VProcess* G4ProcessVector::removeLast() 58 { 99 { 59 G4VProcess* rValue = pProcVector->back(); 100 G4VProcess* rValue = pProcVector->back(); 60 pProcVector->pop_back(); 101 pProcVector->pop_back(); 61 return rValue; 102 return rValue; 62 } 103 } 63 104 64 inline void G4ProcessVector::clear() 105 inline void G4ProcessVector::clear() 65 { 106 { 66 pProcVector->clear(); 107 pProcVector->clear(); 67 } 108 } 68 109 69 inline G4VProcess* const& G4ProcessVector::ope 110 inline G4VProcess* const& G4ProcessVector::operator[](G4int i) const 70 { 111 { 71 return (*pProcVector)[i]; 112 return (*pProcVector)[i]; 72 } 113 } 73 114 74 inline G4VProcess* const& G4ProcessVector::ope 115 inline G4VProcess* const& G4ProcessVector::operator()(G4int i) const 75 { 116 { 76 return (*pProcVector)[i]; 117 return (*pProcVector)[i]; 77 } 118 } 78 119 79 inline G4VProcess* & G4ProcessVector::operator 120 inline G4VProcess* & G4ProcessVector::operator[](G4int i) 80 { 121 { 81 return (*pProcVector)[i]; 122 return (*pProcVector)[i]; 82 } 123 } 83 124 84 inline G4VProcess* & G4ProcessVector::operator 125 inline G4VProcess* & G4ProcessVector::operator()(G4int i) 85 { 126 { 86 return (*pProcVector)[i]; 127 return (*pProcVector)[i]; 87 } 128 } >> 129 >> 130 >> 131 >> 132 88 133