Geant4 Cross Reference |
>> 1 // This code implementation is the intellectual property of >> 2 // the GEANT4 collaboration. 1 // 3 // 2 // ******************************************* << 4 // By copying, distributing or modifying the Program (or any work 3 // * License and Disclaimer << 5 // based on the Program) you indicate your acceptance of this statement, 4 // * << 6 // and all its terms. 5 // * The Geant4 software is copyright of th << 6 // * the Geant4 Collaboration. It is provided << 7 // * conditions of the Geant4 Software License << 8 // * LICENSE and available at http://cern.ch/ << 9 // * include a list of copyright holders. << 10 // * << 11 // * Neither the authors of this software syst << 12 // * institutes,nor the agencies providing fin << 13 // * work make any representation or warran << 14 // * regarding this software system or assum << 15 // * use. Please see the license in the file << 16 // * for the full disclaimer and the limitatio << 17 // * << 18 // * This code implementation is the result << 19 // * technical work of the GEANT4 collaboratio << 20 // * By using, copying, modifying or distri << 21 // * any work based on the software) you ag << 22 // * use in resulting scientific publicati << 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* << 25 // 7 // 26 // G4ProcessVector inline methods implementati << 8 // $Id: G4ProcessVector.icc,v 1.1 2000/11/03 03:44:52 kurasige Exp $ >> 9 // GEANT4 tag $Name: geant4-03-00 $ 27 // 10 // 28 // Authors: G.Cosmo, H.Kurashige - 1998 << 11 inline G4bool G4ProcessVector::operator==(const G4ProcessVector &right) const 29 // ------------------------------------------- << 30 << 31 inline G4bool G4ProcessVector::operator==(cons << 32 { 12 { 33 return (this == (G4ProcessVector *) &right); 13 return (this == (G4ProcessVector *) &right); 34 } 14 } 35 15 36 inline std::size_t G4ProcessVector::entries() << 16 inline G4int G4ProcessVector::entries() const 37 { 17 { 38 return pProcVector->size(); 18 return pProcVector->size(); 39 } 19 } 40 20 41 inline std::size_t G4ProcessVector::size() con << 21 inline G4int G4ProcessVector::length() const 42 { 22 { 43 return pProcVector->size(); 23 return pProcVector->size(); 44 } 24 } 45 25 46 inline std::size_t G4ProcessVector::length() c << 26 inline G4int G4ProcessVector::index(G4VProcess* aProcess) const 47 { 27 { 48 return pProcVector->size(); << 28 G4ProcVector::iterator it; >> 29 size_t j=0; >> 30 for (it=pProcVector->begin();it!=pProcVector->end(); ++j,it++) { >> 31 if (*(*it)==*aProcess) return j; >> 32 } >> 33 return -1; >> 34 } >> 35 >> 36 inline G4bool G4ProcessVector::contains(G4VProcess* aProcess) const >> 37 { >> 38 G4ProcVector::iterator it; >> 39 for (it=pProcVector->begin();it!=pProcVector->end(); it++) { >> 40 if (*(*it)==*aProcess) return true; >> 41 } >> 42 return false; 49 } 43 } 50 44 51 inline G4bool G4ProcessVector::insert(G4VProce 45 inline G4bool G4ProcessVector::insert(G4VProcess* aProcess) 52 { 46 { 53 pProcVector->push_back(aProcess); 47 pProcVector->push_back(aProcess); 54 return true; 48 return true; 55 } 49 } 56 50 >> 51 inline G4bool G4ProcessVector::insertAt(G4int i,G4VProcess* aProcess) >> 52 { >> 53 if ( (i<0) || (i>pProcVector->size()) ) return false; >> 54 if (i==pProcVector->size()) { >> 55 pProcVector->push_back(aProcess); >> 56 } else { >> 57 G4ProcVector::iterator it=pProcVector->begin(); >> 58 int j; >> 59 for(j=0;j!=i;++j) it++; >> 60 pProcVector->insert(it, aProcess); >> 61 } >> 62 return true; >> 63 } >> 64 >> 65 inline G4VProcess* G4ProcessVector::removeAt(G4int i) >> 66 { >> 67 G4ProcVector::iterator it=pProcVector->begin(); >> 68 int j; >> 69 for(j=0;j<pProcVector->size() && j<i;++j) it++; >> 70 G4VProcess* rValue = *it; >> 71 pProcVector->erase(it); >> 72 return rValue; >> 73 } >> 74 57 inline G4VProcess* G4ProcessVector::removeLast 75 inline G4VProcess* G4ProcessVector::removeLast() 58 { 76 { 59 G4VProcess* rValue = pProcVector->back(); 77 G4VProcess* rValue = pProcVector->back(); 60 pProcVector->pop_back(); 78 pProcVector->pop_back(); 61 return rValue; 79 return rValue; 62 } 80 } 63 81 64 inline void G4ProcessVector::clear() 82 inline void G4ProcessVector::clear() 65 { 83 { 66 pProcVector->clear(); 84 pProcVector->clear(); 67 } 85 } 68 86 69 inline G4VProcess* const& G4ProcessVector::ope 87 inline G4VProcess* const& G4ProcessVector::operator[](G4int i) const 70 { 88 { 71 return (*pProcVector)[i]; 89 return (*pProcVector)[i]; 72 } 90 } 73 91 74 inline G4VProcess* const& G4ProcessVector::ope 92 inline G4VProcess* const& G4ProcessVector::operator()(G4int i) const 75 { 93 { 76 return (*pProcVector)[i]; 94 return (*pProcVector)[i]; 77 } 95 } 78 96 79 inline G4VProcess* & G4ProcessVector::operator 97 inline G4VProcess* & G4ProcessVector::operator[](G4int i) 80 { 98 { 81 return (*pProcVector)[i]; 99 return (*pProcVector)[i]; 82 } 100 } 83 101 84 inline G4VProcess* & G4ProcessVector::operator 102 inline G4VProcess* & G4ProcessVector::operator()(G4int i) 85 { 103 { 86 return (*pProcVector)[i]; 104 return (*pProcVector)[i]; 87 } 105 } >> 106 >> 107 >> 108 >> 109 88 110