00001 #ifndef DCHAIN_WHOLEITR_H 00002 #define DCHAIN_WHOLEITR_H 00003 // -*- C++ -*- 00004 // 00005 // Package: DChain 00006 // Module: WholeItr 00007 // 00008 // Description: a Iterator though whole of LabeledDecayList 00009 // 00010 // Usage: 00011 // <usage> 00012 // 00013 // Author: Simon Patton 00014 // Created: Wed Sep 11 21:51:25 EDT 1996 00015 // $Id: WholeItr.h,v 1.1.1.1 2009/03/03 06:06:56 maqm Exp $ 00016 // 00017 // Revision history 00018 // 00019 // $Log: WholeItr.h,v $ 00020 // Revision 1.1.1.1 2009/03/03 06:06:56 maqm 00021 // first import of DecayChain 00022 // 00023 // Revision 1.1 2006/01/11 20:28:19 cdj 00024 // massive class renaming, addition of [] for selection and unit tests 00025 // 00026 // Revision 1.1.1.1 2000/12/18 22:16:51 cdj 00027 // imported DChain 00028 // 00029 // Revision 1.11 1998/08/28 05:16:09 sjp 00030 // Updated to use IndexedLabeled classes 00031 // 00032 // Revision 1.10 1997/08/28 06:59:30 sjp 00033 // Modified files to handle complete templating 00034 // 00035 // Revision 1.9 1997/08/26 04:13:34 sjp 00036 // Made Candidate handling objects into `CandidateClass' Templates 00037 // 00038 // Revision 1.8 1997/08/19 23:02:03 sjp 00039 // Restructured package to be independent of Rock 00040 // 00041 // Revision 1.7 1997/08/15 21:32:43 sjp 00042 // Updated to use <package>/<file>.h include structure. 00043 // Updated to use bug flags specified in Experiement.h 00044 // 00045 // Revision 1.6 1997/01/31 20:17:19 sjp 00046 // Modified to use the new `bug' include files 00047 // 00048 // Revision 1.5 1997/01/22 16:27:35 sjp 00049 // Fixed error in pre-processor labels 00050 // 00051 // Revision 1.4 1997/01/21 20:34:11 sjp 00052 // Changed CPP flags and include because of library reorganization 00053 // 00054 // Revision 1.3 1996/12/31 17:46:45 sjp 00055 // Replaced ptrdiff with member type distance 00056 // 00057 // Revision 1.2 1996/12/20 21:19:28 sjp 00058 // Extended pathnames for Include files 00059 // 00060 // Revision 1.1 1996/11/04 19:36:16 sjp 00061 // New file for new `List' module 00062 // 00063 00064 // system include files 00065 00066 // user include files 00067 #include "DecayChain/Iterator/WholeCandidateItr.h" // superclass 00068 #include "DecayChain/Element/LabeledParticle.h" 00069 #include "DecayChain/List/IndexedLabeledParticles.h" 00070 00071 // forward declarations 00072 namespace dchain { 00073 //template < class T > class LabeledParticle ; 00074 //template < class T , class CandidateClass > class IndexedLabeledParticles ; 00075 template < class T , class CandidateClass > class LabeledParticleList ; 00076 00077 // 00078 // Note : some functions are inlines in the declaration becuase too many 00079 // compiler bugs make it impractical to have definition outside 00080 // the delcaration! This should be reviewed in the future 00081 // 00082 00083 template < class T > 00084 class WholeItr : public WholeCandidateItr< typename T::CandidateClass > 00085 { 00086 // friend classses and functions 00087 friend class LabeledParticleList< T , typename T::CandidateClass > ; 00088 00089 public: 00090 // constants, enums and typedefs 00091 typedef WholeCandidateItr<typename T::CandidateClass> ParentType; 00092 typedef typename ParentType::difference_type difference_type; 00093 typedef typename ParentType::size_type size_type; 00094 00095 // Constructors and destructor 00096 WholeItr( const WholeItr< T >& aOtherItr ) ; 00097 //virtual ~WholeItr() ; 00098 00099 // assignment operator(s) 00100 const WholeItr< T >& operator=( const WholeItr< T >& aOtherItr ) ; 00101 00102 // member functions 00103 WholeItr< T >& operator++() ; 00104 WholeItr< T > operator++( int ) ; 00105 WholeItr< T >& operator--() ; 00106 WholeItr< T > operator--( int ) ; 00107 WholeItr< T >& operator+=( difference_type n ) 00108 { 00109 WholeCandidateItr< typename T::CandidateClass >::operator+=( n ) ; 00110 return( *this ) ; 00111 } 00112 WholeItr< T > operator+( difference_type n ) 00113 { 00114 WholeItr< T > tmp( *this ) ; 00115 return ( tmp += n ) ; 00116 } 00117 WholeItr< T >& operator-=( difference_type n ) 00118 { 00119 WholeCandidateItr< typename T::CandidateClass >::operator-=( n ) ; 00120 return( *this ) ; 00121 } 00122 WholeItr< T > operator-( difference_type n ) 00123 { 00124 WholeItr< T > tmp( *this ) ; 00125 return ( tmp -= n ) ; 00126 } 00127 00128 // const member functions 00129 const LabeledParticle< T >& operator*() const ; 00130 const LabeledParticle< T >& operator[]( size_type n ) const 00131 { 00132 return ( ( *(IndexedLabeledParticles< T , typename T::CandidateClass >*)(this->indexedCandidates()) ).labeledParticleClass( this->index() + n ) ) ; 00133 } 00134 difference_type operator-( const WholeItr< T >& aOtherItr ) const 00135 { 00136 return ( this->index() - aOtherItr.index() ) ; 00137 } 00138 00139 // static member functions 00140 00141 protected: 00142 // Constructors and destructor 00143 WholeItr( const IndexedLabeledParticles< T , typename T::CandidateClass >* aList , 00144 const size_type aIndex ) : 00145 WholeCandidateItr< typename T::CandidateClass >( aList , 00146 aIndex ) {} 00147 00148 // protected member functions 00149 00150 // protected const member functions 00151 00152 private: 00153 // Constructors and destructor 00154 WholeItr() ; // stop default 00155 00156 // private member functions 00157 00158 // private const member functions 00159 00160 // data members 00161 00162 // static data members 00163 00164 } ; 00165 00166 // inline function definitions 00167 00168 // user include files 00169 00170 // 00171 // constructors and destructor 00172 // 00173 00174 template < class T > 00175 inline 00176 WholeItr< T >::WholeItr( const WholeItr< T >& aOtherItr ) : 00177 WholeCandidateItr< typename T::CandidateClass >( aOtherItr ) 00178 { 00179 } 00180 00181 // 00182 // assignment operators 00183 // 00184 00185 template < class T > 00186 inline 00187 const WholeItr< T >& WholeItr< T >::operator=( const WholeItr< T >& aOtherItr ) 00188 { 00189 WholeCandidateItr< typename T::CandidateClass >::operator=( aOtherItr ) ; 00190 return ( *this ) ; 00191 } 00192 00193 // 00194 // member functions 00195 // 00196 00197 template < class T > 00198 inline 00199 WholeItr< T >& WholeItr< T >::operator++() 00200 { 00201 WholeCandidateItr< typename T::CandidateClass >::operator++() ; 00202 return ( *this ) ; 00203 } 00204 00205 template < class T > 00206 inline 00207 WholeItr< T > WholeItr< T >::operator++( int ) 00208 { 00209 WholeItr< T > tmp( *this ) ; 00210 WholeCandidateItr< typename T::CandidateClass >::operator++() ; 00211 return ( tmp ) ; 00212 } 00213 00214 template < class T > 00215 inline 00216 WholeItr< T >& WholeItr< T >::operator--() 00217 { 00218 WholeCandidateItr< typename T::CandidateClass >::operator--() ; 00219 return ( *this ) ; 00220 } 00221 00222 template < class T > 00223 inline 00224 WholeItr< T > WholeItr< T >::operator--( int ) 00225 { 00226 WholeItr< T > tmp( *this ) ; 00227 WholeCandidateItr< typename T::CandidateClass >::operator--() ; 00228 return ( tmp ) ; 00229 } 00230 00231 // 00232 // const member functions 00233 // 00234 00235 template < class T > 00236 inline 00237 const LabeledParticle< T >& WholeItr< T >::operator*() const 00238 { 00239 return ( ( *(IndexedLabeledParticles< T , typename T::CandidateClass >*)(this->indexedCandidates()) ).labeledParticleClass( this->index() ) ) ; 00240 } 00241 } 00242 00243 00244 #endif /* DCHAIN_WHOLEITR_H */