[833] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
| 27 | // $Id: G4PhysicsTable.icc,v 1.8 2006/06/29 19:02:36 gunter Exp $ |
---|
[1058] | 28 | // GEANT4 tag $Name: geant4-09-02-ref-02 $ |
---|
[833] | 29 | // |
---|
| 30 | // |
---|
| 31 | // ------------------------------------------------------------ |
---|
| 32 | // GEANT 4 class inline implementation |
---|
| 33 | // |
---|
| 34 | // History: first implementation, based on object model of |
---|
| 35 | // 2nd December 1995, G.Cosmo |
---|
| 36 | // |
---|
| 37 | // ------------------------------------------------------------ |
---|
| 38 | |
---|
| 39 | inline |
---|
| 40 | void G4PhysicsTable::clearAndDestroy() |
---|
| 41 | { |
---|
| 42 | G4PhysicsVector* a=0; |
---|
| 43 | while (size()>0) |
---|
| 44 | { |
---|
| 45 | a = G4PhysCollection::back(); |
---|
| 46 | G4PhysCollection::pop_back(); |
---|
| 47 | if ( a ) { delete a; } |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | vecFlag.clear(); |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | inline |
---|
| 54 | G4PhysicsVector*& G4PhysicsTable::operator()(size_t i) |
---|
| 55 | { |
---|
| 56 | return (*this)[i]; |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | inline |
---|
| 60 | G4PhysicsVector* const& G4PhysicsTable::operator()(size_t i) const |
---|
| 61 | { |
---|
| 62 | return (*this)[i]; |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | inline |
---|
| 66 | void G4PhysicsTable::push_back(G4PhysicsVector* pvec) |
---|
| 67 | { |
---|
| 68 | G4PhysCollection::push_back(pvec); |
---|
| 69 | vecFlag.push_back(true); |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | inline |
---|
| 73 | void G4PhysicsTable::insert(G4PhysicsVector* pvec) |
---|
| 74 | { |
---|
| 75 | G4PhysCollection::push_back(pvec); |
---|
| 76 | vecFlag.push_back(true); |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | inline |
---|
| 80 | void G4PhysicsTable::insertAt (size_t idx, G4PhysicsVector* pvec) |
---|
| 81 | { |
---|
| 82 | G4PhysicsTableIterator itr=begin(); |
---|
| 83 | for (size_t i=0; i<idx; ++i) { itr++; } |
---|
| 84 | G4PhysCollection::insert(itr, pvec); |
---|
| 85 | |
---|
| 86 | G4FlagCollection::iterator itrF=vecFlag.begin(); |
---|
| 87 | for (size_t j=0; j<idx; ++j) { itrF++; } |
---|
| 88 | vecFlag.insert(itrF, true); |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | inline |
---|
| 92 | size_t G4PhysicsTable::entries() const |
---|
| 93 | { |
---|
| 94 | return G4PhysCollection::size(); |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | inline |
---|
| 98 | size_t G4PhysicsTable::length() const |
---|
| 99 | { |
---|
| 100 | return G4PhysCollection::size(); |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | inline |
---|
| 104 | G4bool G4PhysicsTable::isEmpty() const |
---|
| 105 | { |
---|
| 106 | return G4PhysCollection::empty(); |
---|
| 107 | } |
---|
| 108 | |
---|
| 109 | inline |
---|
| 110 | G4bool G4PhysicsTable::GetFlag(size_t i) const |
---|
| 111 | { |
---|
| 112 | return vecFlag[i]; |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | inline |
---|
| 116 | void G4PhysicsTable::ClearFlag(size_t i) |
---|
| 117 | { |
---|
| 118 | vecFlag[i] = false; |
---|
| 119 | } |
---|