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