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