Geant4  10.01.p03
G4PhysicsTable.icc
Go to the documentation of this file.
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 70961 2013-06-07 15:17:02Z gcosmo $
28 //
29 //
30 // ------------------------------------------------------------
31 // GEANT 4 class inline implementation
32 //
33 // History: first implementation, based on object model of
34 // 2nd December 1995, G.Cosmo
35 //
36 // ------------------------------------------------------------
37 
38 inline
39  void G4PhysicsTable::clearAndDestroy()
40 {
41  G4PhysicsVector* a=0;
42  while (size()>0)
43  {
44  a = G4PhysCollection::back();
45  G4PhysCollection::pop_back();
46  if ( a ) { delete a; }
47  }
48  G4PhysCollection::clear();
49  vecFlag.clear();
50 }
51 
52 inline
53  G4PhysicsVector*& G4PhysicsTable::operator()(size_t i)
54 {
55  return (*this)[i];
56 }
57 
58 inline
59  G4PhysicsVector* const& G4PhysicsTable::operator()(size_t i) const
60 {
61  return (*this)[i];
62 }
63 
64 inline
65  void G4PhysicsTable::push_back(G4PhysicsVector* pvec)
66 {
67  G4PhysCollection::push_back(pvec);
68  vecFlag.push_back(true);
69 }
70 
71 inline
72  void G4PhysicsTable::insert(G4PhysicsVector* pvec)
73 {
74  G4PhysCollection::push_back(pvec);
75  vecFlag.push_back(true);
76 }
77 
78 inline
79  void G4PhysicsTable::insertAt (size_t idx, G4PhysicsVector* pvec)
80 {
81  G4PhysicsTableIterator itr=begin();
82  for (size_t i=0; i<idx; ++i) { itr++; }
83  G4PhysCollection::insert(itr, pvec);
84 
85  G4FlagCollection::iterator itrF=vecFlag.begin();
86  for (size_t j=0; j<idx; ++j) { itrF++; }
87  vecFlag.insert(itrF, true);
88 }
89 
90 inline
91  size_t G4PhysicsTable::entries() const
92 {
93  return G4PhysCollection::size();
94 }
95 
96 inline
97  size_t G4PhysicsTable::length() const
98 {
99  return G4PhysCollection::size();
100 }
101 
102 inline
103  G4bool G4PhysicsTable::isEmpty() const
104 {
105  return G4PhysCollection::empty();
106 }
107 
108 inline
109  G4bool G4PhysicsTable::GetFlag(size_t i) const
110 {
111  return vecFlag[i];
112 }
113 
114 inline
115  void G4PhysicsTable::ClearFlag(size_t i)
116 {
117  vecFlag[i] = false;
118 }