IAP GITLAB
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
corsika
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pranav Sampathkumar
corsika
Commits
4207555d
Commit
4207555d
authored
6 years ago
by
ralfulrich
Browse files
Options
Downloads
Patches
Plain Diff
added stack
parent
a139b7a1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Framework/StackInterface/Stack.h
+10
-2
10 additions, 2 deletions
Framework/StackInterface/Stack.h
Framework/StackInterface/StackIterator.h
+14
-3
14 additions, 3 deletions
Framework/StackInterface/StackIterator.h
with
24 additions
and
5 deletions
Framework/StackInterface/Stack.h
+
10
−
2
View file @
4207555d
...
@@ -3,10 +3,16 @@
...
@@ -3,10 +3,16 @@
#include
<StackInterface/StackIterator.h>
// to help application programmres
#include
<StackInterface/StackIterator.h>
// to help application programmres
/**
All classes around management of particles on a stack.
*/
namespace
stack
{
namespace
stack
{
/**
/**
Interface definition of a Stack object.
Interface definition of a Stack object. The Stack implements the
std-type begin/end function to allow integration in normal for
loops etc.
*/
*/
template
<
typename
DataImpl
,
typename
Particle
>
template
<
typename
DataImpl
,
typename
Particle
>
...
@@ -35,8 +41,10 @@ namespace stack {
...
@@ -35,8 +41,10 @@ namespace stack {
const_iterator
cbegin
()
const
{
return
const_iterator
(
*
this
,
0
);
}
const_iterator
cbegin
()
const
{
return
const_iterator
(
*
this
,
0
);
}
const_iterator
cend
()
const
{
return
const_iterator
(
*
this
,
GetSize
());
}
const_iterator
cend
()
const
{
return
const_iterator
(
*
this
,
GetSize
());
}
const_iterator
clast
()
const
{
return
const_iterator
(
*
this
,
GetSize
()
-
1
);
}
const_iterator
clast
()
const
{
return
const_iterator
(
*
this
,
GetSize
()
-
1
);
}
/// increase stack size, create new particle at end of stack
iterator
NewParticle
()
{
IncrementSize
();
return
iterator
(
*
this
,
GetSize
()
-
1
);
}
iterator
NewParticle
()
{
IncrementSize
();
return
iterator
(
*
this
,
GetSize
()
-
1
);
}
/// delete last particle on stack by decrementing stack size
void
DeleteLast
()
{
DecrementSize
();
}
void
DeleteLast
()
{
DecrementSize
();
}
};
};
...
...
This diff is collapsed.
Click to expand it.
Framework/StackInterface/StackIterator.h
+
14
−
3
View file @
4207555d
...
@@ -10,7 +10,7 @@ namespace stack {
...
@@ -10,7 +10,7 @@ namespace stack {
template
<
class
Stack
,
class
Particle
>
class
StackIteratorInfo
;
template
<
class
Stack
,
class
Particle
>
class
StackIteratorInfo
;
/**
/**
\
class StackIterator
@
class StackIterator
The StackIterator is the main interface to iterator over
The StackIterator is the main interface to iterator over
particles on a stack. At the same time StackIterator is a
particles on a stack. At the same time StackIterator is a
...
@@ -20,7 +20,17 @@ namespace stack {
...
@@ -20,7 +20,17 @@ namespace stack {
This allows to write code like
This allows to write code like
\verbatim
\verbatim
for (auto& p : theStack) { p.SetEnergy(newEnergy); }
for (auto& p : theStack) { p.SetEnergy(newEnergy); }
\endverbatim
\endverbatim
The template argument Stack determines the type of Stack object
the data is stored in. A pointer to the Stack object is part of
the StackIterator. In addition to Stack the iterator only knows
the index fIndex in the Stack data.
The template argument Particles acts as a policy to provide
readout function of Particle data from the stack. The Particle
class must know how to retrieve information from the Stack data
for a particle entry at any index fIndex.
*/
*/
template
<
typename
Stack
,
typename
Particle
>
template
<
typename
Stack
,
typename
Particle
>
...
@@ -62,8 +72,9 @@ namespace stack {
...
@@ -62,8 +72,9 @@ namespace stack {
/**
/**
\
class StackIteratorInfo
@
class StackIteratorInfo
This is the class where custom ...
Internal helper class for StackIterator. Document better...
Internal helper class for StackIterator. Document better...
*/
*/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment