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