Geant4
10.03.p01
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
G4ParticleTableIterator.hh
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: G4ParticleTableIterator.hh 91885 2015-08-10 07:05:56Z gcosmo $
28
//
29
//
30
// ------------------------------------------------------------
31
// GEANT 4 class header file
32
//
33
// History: first implementation, based on object model of
34
// 28 Oct 1999, H.Kurashige
35
// ------------------------------------------------------------
36
37
#ifndef G4ParticleTableIterator_h
38
#define G4ParticleTableIterator_h 1
39
40
#include <map>
41
#include "
G4ParticleDefinition.hh
"
42
43
template
<
class
K,
class
V >
class
G4ParticleTableIterator
44
{
45
public
:
46
typedef
std::map<K, V, std::less<K> >
Map
;
47
G4ParticleTableIterator
(
Map
&adict):
48
it(adict.begin()),
49
mydict(&adict),
50
defined(false),
51
skipIons(true)
52
{}
53
54
G4bool
operator++
()
55
{
56
if
(!defined)
return
false
;
57
it++;
58
return
it!=mydict->end() ?
true
:
false
;
59
}
60
61
G4bool
operator()
()
62
{
63
if
(!defined) {
64
defined=
true
;
65
it=mydict->begin();
66
}
else
{
67
it++;
68
}
69
if
(it==mydict->end())
return
false
;
70
if
(skipIons){
71
while
((static_cast<G4ParticleDefinition*>((*it).second))->IsGeneralIon()){
// Loop checking, 09.08.2015, K.Kurashige
72
it++;
73
if
(it==mydict->end())
return
false
;
74
}
75
}
76
return
true
;
77
}
78
79
void
reset
(
G4bool
ifSkipIon =
true
) {defined=
false
; skipIons = ifSkipIon; }
80
K*
key
()
const
{
return
&((*it).first); }
81
V
value
()
const
{
return
(*it).second; }
82
83
private
:
84
typename
Map::iterator it;
85
Map
* mydict;
86
G4bool
defined;
87
G4bool
skipIons;
88
};
89
90
#endif
G4ParticleTableIterator::operator()
G4bool operator()()
Definition:
G4ParticleTableIterator.hh:61
G4ParticleTableIterator
Definition:
G4ParticleTableIterator.hh:43
G4ParticleTableIterator::reset
void reset(G4bool ifSkipIon=true)
Definition:
G4ParticleTableIterator.hh:79
G4ParticleTableIterator::key
K * key() const
Definition:
G4ParticleTableIterator.hh:80
G4bool
bool G4bool
Definition:
G4Types.hh:79
G4ParticleDefinition.hh
G4ParticleTableIterator::operator++
G4bool operator++()
Definition:
G4ParticleTableIterator.hh:54
G4ParticleTableIterator::value
V value() const
Definition:
G4ParticleTableIterator.hh:81
G4ParticleTableIterator::Map
std::map< K, V, std::less< K > > Map
Definition:
G4ParticleTableIterator.hh:46
G4ParticleTableIterator::G4ParticleTableIterator
G4ParticleTableIterator(Map &adict)
Definition:
G4ParticleTableIterator.hh:47
geant4.10.03.p01
source
particles
management
include
G4ParticleTableIterator.hh
Generated on Thu Mar 16 2017 22:37:57 for Geant4 by
1.8.5