BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Event/DecayChain/include/DecayChain/Iterator/WholeItr.h
Go to the documentation of this file.
1#ifndef DCHAIN_WHOLEITR_H
2#define DCHAIN_WHOLEITR_H
3// -*- C++ -*-
4//
5// Package: DChain
6// Module: WholeItr
7//
8// Description: a Iterator though whole of LabeledDecayList
9//
10// Usage:
11// <usage>
12//
13// Author: Simon Patton
14// Created: Wed Sep 11 21:51:25 EDT 1996
15// $Id: WholeItr.h,v 1.1.1.1 2009/03/03 06:06:56 maqm Exp $
16//
17// Revision history
18//
19// $Log: WholeItr.h,v $
20// Revision 1.1.1.1 2009/03/03 06:06:56 maqm
21// first import of DecayChain
22//
23// Revision 1.1 2006/01/11 20:28:19 cdj
24// massive class renaming, addition of [] for selection and unit tests
25//
26// Revision 1.1.1.1 2000/12/18 22:16:51 cdj
27// imported DChain
28//
29// Revision 1.11 1998/08/28 05:16:09 sjp
30// Updated to use IndexedLabeled classes
31//
32// Revision 1.10 1997/08/28 06:59:30 sjp
33// Modified files to handle complete templating
34//
35// Revision 1.9 1997/08/26 04:13:34 sjp
36// Made Candidate handling objects into `CandidateClass' Templates
37//
38// Revision 1.8 1997/08/19 23:02:03 sjp
39// Restructured package to be independent of Rock
40//
41// Revision 1.7 1997/08/15 21:32:43 sjp
42// Updated to use <package>/<file>.h include structure.
43// Updated to use bug flags specified in Experiement.h
44//
45// Revision 1.6 1997/01/31 20:17:19 sjp
46// Modified to use the new `bug' include files
47//
48// Revision 1.5 1997/01/22 16:27:35 sjp
49// Fixed error in pre-processor labels
50//
51// Revision 1.4 1997/01/21 20:34:11 sjp
52// Changed CPP flags and include because of library reorganization
53//
54// Revision 1.3 1996/12/31 17:46:45 sjp
55// Replaced ptrdiff with member type distance
56//
57// Revision 1.2 1996/12/20 21:19:28 sjp
58// Extended pathnames for Include files
59//
60// Revision 1.1 1996/11/04 19:36:16 sjp
61// New file for new `List' module
62//
63
64// system include files
65
66// user include files
67#include "DecayChain/Element/LabeledParticle.h"
68#include "DecayChain/Iterator/WholeCandidateItr.h" // superclass
69#include "DecayChain/List/IndexedLabeledParticles.h"
70
71// forward declarations
72namespace dchain {
73 // template < class T > class LabeledParticle ;
74 // template < class T , class CandidateClass > class IndexedLabeledParticles ;
75 template <class T, class CandidateClass> class LabeledParticleList;
76
77 //
78 // Note : some functions are inlines in the declaration becuase too many
79 // compiler bugs make it impractical to have definition outside
80 // the delcaration! This should be reviewed in the future
81 //
82
83 template <class T> class WholeItr : public WholeCandidateItr<typename T::CandidateClass> {
84 // friend classses and functions
85 friend class LabeledParticleList<T, typename T::CandidateClass>;
86
87 public:
88 // constants, enums and typedefs
89 typedef WholeCandidateItr<typename T::CandidateClass> ParentType;
92
93 // Constructors and destructor
94 WholeItr( const WholeItr<T>& aOtherItr );
95 // virtual ~WholeItr() ;
96
97 // assignment operator(s)
98 const WholeItr<T>& operator=( const WholeItr<T>& aOtherItr );
99
100 // member functions
101 WholeItr<T>& operator++();
102 WholeItr<T> operator++( int );
103 WholeItr<T>& operator--();
104 WholeItr<T> operator--( int );
105 WholeItr<T>& operator+=( difference_type n ) {
107 return ( *this );
108 }
110 WholeItr<T> tmp( *this );
111 return ( tmp += n );
112 }
118 WholeItr<T> tmp( *this );
119 return ( tmp -= n );
120 }
121
122 // const member functions
125 return ( ( *(IndexedLabeledParticles<
126 T, typename T::CandidateClass>*)( this->indexedCandidates() ) )
127 .labeledParticleClass( this->index() + n ) );
128 }
129 difference_type operator-( const WholeItr<T>& aOtherItr ) const {
130 return ( this->index() - aOtherItr.index() );
131 }
132
133 // static member functions
134
135 protected:
136 // Constructors and destructor
138 const size_type aIndex )
139 : WholeCandidateItr<typename T::CandidateClass>( aList, aIndex ) {}
140
141 // protected member functions
142
143 // protected const member functions
144
145 private:
146 // Constructors and destructor
147 WholeItr(); // stop default
148
149 // private member functions
150
151 // private const member functions
152
153 // data members
154
155 // static data members
156 };
157
158 // inline function definitions
159
160 // user include files
161
162 //
163 // constructors and destructor
164 //
165
166 template <class T>
167 inline WholeItr<T>::WholeItr( const WholeItr<T>& aOtherItr )
168 : WholeCandidateItr<typename T::CandidateClass>( aOtherItr ) {}
169
170 //
171 // assignment operators
172 //
173
174 template <class T>
175 inline const WholeItr<T>& WholeItr<T>::operator=( const WholeItr<T>& aOtherItr ) {
177 return ( *this );
178 }
179
180 //
181 // member functions
182 //
183
184 template <class T> inline WholeItr<T>& WholeItr<T>::operator++() {
186 return ( *this );
187 }
188
189 template <class T> inline WholeItr<T> WholeItr<T>::operator++( int ) {
190 WholeItr<T> tmp( *this );
192 return ( tmp );
193 }
194
195 template <class T> inline WholeItr<T>& WholeItr<T>::operator--() {
197 return ( *this );
198 }
199
200 template <class T> inline WholeItr<T> WholeItr<T>::operator--( int ) {
201 WholeItr<T> tmp( *this );
203 return ( tmp );
204 }
205
206 //
207 // const member functions
208 //
209
210 template <class T> inline const LabeledParticle<T>& WholeItr<T>::operator*() const {
211 return ( ( *(IndexedLabeledParticles<
212 T, typename T::CandidateClass>*)( this->indexedCandidates() ) )
213 .labeledParticleClass( this->index() ) );
214 }
215} // namespace dchain
216
217#endif /* DCHAIN_WHOLEITR_H */
const Int_t n
WholeCandidateItr< CandidateClass > & operator+=(difference_type n)
const WholeCandidateItr & operator=(const WholeCandidateItr< CandidateClass > &aOtherItr)
WholeCandidateItr< CandidateClass > & operator-=(difference_type n)
const WholeItr< T > & operator=(const WholeItr< T > &aOtherItr)
WholeItr(const IndexedLabeledParticles< T, typename T::CandidateClass > *aList, const size_type aIndex)
WholeCandidateItr< typename T::CandidateClass > ParentType
const LabeledParticle< T > & operator[](size_type n) const
difference_type operator-(const WholeItr< T > &aOtherItr) const