00001 #ifndef DCHAIN_MUTEWHOLEITR_H 00002 #define DCHAIN_MUTEWHOLEITR_H 00003 // -*- C++ -*- 00004 // 00005 // Package: DChain 00006 // Module: MuteWholeItr 00007 // 00008 // Description: Itr through a entire LabeledList. 00009 // 00010 // Usage: 00011 // <usage> 00012 // 00013 // Author: Simon Patton 00014 // Created: Wed Sep 11 21:51:25 EDT 1996 00015 // $Id: MuteWholeItr.h,v 1.1.1.1 2009/03/03 06:06:56 maqm Exp $ 00016 // 00017 // Revision history 00018 // 00019 // $Log: MuteWholeItr.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:17 cdj 00024 // massive class renaming, addition of [] for selection and unit tests 00025 // 00026 // 00027 00028 // system include files 00029 00030 // user include files 00031 #include "DecayChain/Iterator/MuteWholeCandidateItr.h" // superclass 00032 #include "DecayChain/Element/LabeledParticle.h" 00033 #include "DecayChain/List/IndexedLabeledParticles.h" 00034 00035 00036 // forward declarations 00037 namespace dchain { 00038 template <class T> class LabeledParticle; 00039 template <class T, class CandidateClass> class LabeledParticleList; 00040 00041 template < class T , class CandidateClass > class IndexedLabeledParticles ; 00042 00043 // 00044 // Note : some functions are inlines in the declaration becuase too many 00045 // compiler bugs make it impractical to have definition outside 00046 // the delcaration! This should be reviewed in the future 00047 // 00048 00049 template < class T > 00050 class MuteWholeItr : public MuteWholeCandidateItr< typename T::CandidateClass > 00051 { 00052 // friend classses and functions 00053 friend class LabeledParticleList< T , typename T::CandidateClass > ; 00054 00055 public: 00056 // constants, enums and typedefs 00057 typedef MuteWholeCandidateItr<typename T::CandidateClass> ParentType; 00058 typedef typename ParentType::difference_type difference_type; 00059 typedef typename ParentType::size_type size_type; 00060 00061 // Constructors and destructor 00062 MuteWholeItr( const MuteWholeItr< T >& aOtherItr ) ; 00063 //virtual ~MuteWholeItr() ; 00064 00065 // assignment operator(s) 00066 const MuteWholeItr< T >& operator=( const MuteWholeItr< T >& aOtherItr ) ; 00067 00068 // member functions 00069 MuteWholeItr< T >& operator++() ; 00070 MuteWholeItr< T > operator++( int ) ; 00071 MuteWholeItr< T >& operator--() ; 00072 MuteWholeItr< T > operator--( int ) ; 00073 MuteWholeItr< T >& operator+=( difference_type n ) 00074 { 00075 MuteWholeCandidateItr< typename T::CandidateClass >::operator+=( n ) ; 00076 return( *this ) ; 00077 } 00078 MuteWholeItr< T > operator+( difference_type n ) 00079 { 00080 MuteWholeItr< T > tmp( *this ) ; 00081 return ( tmp += n ) ; 00082 } 00083 MuteWholeItr< T >& operator-=( difference_type n ) 00084 { 00085 MuteWholeCandidateItr< typename T::CandidateClass >::operator-=( n ) ; 00086 return( *this ) ; 00087 } 00088 MuteWholeItr< T > operator-( difference_type n ) 00089 { 00090 MuteWholeItr< T > tmp( *this ) ; 00091 return ( tmp -= n ) ; 00092 } 00093 00094 // const member functions 00095 LabeledParticle< T >& operator*() const ; 00096 LabeledParticle< T >& operator[]( size_type n ) const 00097 { 00098 return ( ( *(IndexedLabeledParticles< T , typename T::CandidateClass >*)(this->indexedCandidates()) ).labeledParticleClass( this->index() + n ) ) ; 00099 } 00100 difference_type operator-( const MuteWholeItr< T >& aOtherItr ) const 00101 { 00102 return ( this->index() - aOtherItr.index() ) ; 00103 } 00104 00105 // static member functions 00106 00107 protected: 00108 // Constructors and destructor 00109 MuteWholeItr( IndexedLabeledParticles< T , typename T::CandidateClass >* aList , 00110 const size_type aIndex ) : 00111 MuteWholeCandidateItr< typename T::CandidateClass >( aList , 00112 aIndex ) {} 00113 00114 // protected member functions 00115 00116 // protected const member functions 00117 00118 private: 00119 // Constructors and destructor 00120 MuteWholeItr() ; // stop default 00121 00122 // private member functions 00123 00124 // private const member functions 00125 00126 // data members 00127 00128 // static data members 00129 00130 } ; 00131 00132 // inline function definitions 00133 00134 // 00135 // constructors and destructor 00136 // 00137 00138 template < class T > 00139 inline 00140 MuteWholeItr< T >::MuteWholeItr( const MuteWholeItr< T >& aOtherItr ) : 00141 MuteWholeCandidateItr< typename T::CandidateClass >( aOtherItr ) 00142 { 00143 } 00144 00145 // 00146 // assignment operators 00147 // 00148 00149 template < class T > 00150 inline 00151 const MuteWholeItr< T >& MuteWholeItr< T >::operator=( const MuteWholeItr< T >& aOtherItr ) 00152 { 00153 MuteWholeCandidateItr< typename T::CandidateClass >::operator=( aOtherItr ) ; 00154 return ( *this ) ; 00155 } 00156 00157 // 00158 // member functions 00159 // 00160 00161 template < class T > 00162 inline 00163 MuteWholeItr< T >& MuteWholeItr< T >::operator++() 00164 { 00165 MuteWholeCandidateItr< typename T::CandidateClass >::operator++() ; 00166 return ( *this ) ; 00167 } 00168 00169 template < class T > 00170 inline 00171 MuteWholeItr< T > MuteWholeItr< T >::operator++( int ) 00172 { 00173 MuteWholeItr< T > tmp( *this ) ; 00174 MuteWholeCandidateItr< typename T::CandidateClass >::operator++() ; 00175 return ( tmp ) ; 00176 } 00177 00178 template < class T > 00179 inline 00180 MuteWholeItr< T >& MuteWholeItr< T >::operator--() 00181 { 00182 MuteWholeCandidateItr< typename T::CandidateClass >::operator--() ; 00183 return ( *this ) ; 00184 } 00185 00186 template < class T > 00187 inline 00188 MuteWholeItr< T > MuteWholeItr< T >::operator--( int ) 00189 { 00190 MuteWholeItr< T > tmp( *this ) ; 00191 MuteWholeCandidateItr< typename T::CandidateClass >::operator--() ; 00192 return ( tmp ) ; 00193 } 00194 00195 // 00196 // const member functions 00197 // 00198 00199 template < class T > 00200 inline 00201 LabeledParticle< T >& MuteWholeItr< T >::operator*() const 00202 { 00203 return ( ( *(IndexedLabeledParticles< T , typename T::CandidateClass >*)(this->indexedCandidates()) ).labeledParticleClass( this->index() ) ) ; 00204 } 00205 } 00206 00207 #endif /* DCHAIN_WHOLEITR_H */