Geant4-11
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
m
n
p
r
s
t
w
y
Enumerations
a
b
c
d
e
f
g
l
m
p
r
s
t
v
y
z
Enumerator
a
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Data Structures
Data Structures
Data Structure Index
Class Hierarchy
Data Fields
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Related Functions
:
a
b
c
d
g
h
i
o
q
r
s
t
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
x
z
Enumerations
b
c
d
e
f
g
i
j
l
m
n
p
r
s
t
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Examples
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
source
global
management
include
G4FastVector.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
// G4FastVector
27
//
28
// Class description:
29
//
30
// Template class defining a vector of pointers,
31
// not performing boundary checking.
32
33
// Author: G.Cosmo, 2 December 1995
34
// First implementation, based on object model
35
// --------------------------------------------------------------------
36
#ifndef G4FastVector_hh
37
#define G4FastVector_hh 1
38
39
#include "
globals.hh
"
40
41
template
<
class
Type, G4
int
N>
42
class
G4FastVector
43
{
44
public
:
45
G4FastVector
() {
ptr
= &
theArray
[0]; }
46
47
~G4FastVector
()
48
{
49
if
(
ptr
!= &
theArray
[0])
50
delete
[]
ptr
;
51
}
52
53
inline
Type
*
operator[]
(
G4int
anIndex)
const
54
// Access operator to the array.
55
{
56
return
ptr
[anIndex];
57
}
58
59
inline
void
Initialize
(
G4int
items)
60
// Normally the pointer ptr points to the stack-array
61
// theArray; only when the number of items is greater
62
// than N, memory is allocated dynamically.
63
{
64
if
(
ptr
!= &
theArray
[0])
65
delete
[]
ptr
;
66
if
(items > N)
67
ptr
=
new
Type
*[items];
68
else
69
ptr
= &
theArray
[0];
70
}
71
72
inline
void
SetElement
(
G4int
anIndex,
Type
* anElement)
73
// To insert an element at the given position inside
74
// the vector.
75
{
76
ptr
[anIndex] = anElement;
77
}
78
79
private
:
80
Type
*
theArray
[N];
81
Type
**
ptr
;
82
};
83
84
#endif
G4int
int G4int
Definition:
G4Types.hh:85
G4FastVector
Definition:
G4FastVector.hh:43
G4FastVector::G4FastVector
G4FastVector()
Definition:
G4FastVector.hh:45
G4FastVector::theArray
Type * theArray[N]
Definition:
G4FastVector.hh:80
G4FastVector::SetElement
void SetElement(G4int anIndex, Type *anElement)
Definition:
G4FastVector.hh:72
G4FastVector::Initialize
void Initialize(G4int items)
Definition:
G4FastVector.hh:59
G4FastVector::operator[]
Type * operator[](G4int anIndex) const
Definition:
G4FastVector.hh:53
G4FastVector::ptr
Type ** ptr
Definition:
G4FastVector.hh:81
G4FastVector::~G4FastVector
~G4FastVector()
Definition:
G4FastVector.hh:47
globals.hh
G4ProfileType
Definition:
G4Profiler.hh:68
Generated by
1.9.3