00001 #ifndef DCHAIN_COMBINATORICLOOP_H 00002 #define DCHAIN_COMBINATORICLOOP_H 00003 // -*- C++ -*- 00004 // 00005 // Package: DChain 00006 // Module: CombinatoricLoop 00007 // 00008 // Description: return 'begin' and 'end' of loop during Combinatoric generation 00009 // 00010 // Usage: 00011 // <usage> 00012 // 00013 // Author: Simon Patton 00014 // Created: Mon Oct 21 10:06:45 EDT 1996 00015 // $Id: CombinatoricLoop.h,v 1.1.1.1 2009/03/03 06:06:56 maqm Exp $ 00016 // 00017 // Revision history 00018 // 00019 // $Log: CombinatoricLoop.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:22 cdj 00024 // massive class renaming, addition of [] for selection and unit tests 00025 // 00026 // Revision 1.2 2002/06/19 20:34:30 cleo3 00027 // added missing typename 00028 // 00029 // Revision 1.1.1.1 2000/12/18 22:16:52 cdj 00030 // imported DChain 00031 // 00032 // Revision 1.12 1998/08/19 20:38:01 sjp 00033 // Fixed include path for defintions 00034 // 00035 // Revision 1.11 1998/06/30 23:41:29 sjp 00036 // Moved ctor so that SunOS5 would compile 00037 // 00038 // Revision 1.10 1998/05/01 20:19:10 sjp 00039 // Added necessary include file from STLUtility 00040 // 00041 // Revision 1.9 1998/04/17 19:11:01 sjp 00042 // Modified to use latest types 00043 // 00044 // Revision 1.8 1997/08/28 06:59:49 sjp 00045 // Modified files to handle complete templating 00046 // 00047 // Revision 1.7 1997/08/19 16:18:25 sjp 00048 // Improved handling of STL containers 00049 // 00050 // Revision 1.6 1997/08/15 21:32:14 sjp 00051 // Updated to use <package>/<file>.h include structure. 00052 // Updated to use bug flags specified in Experiement.h 00053 // 00054 // Revision 1.5 1997/01/31 20:17:05 sjp 00055 // Modified to use the new `bug' include files 00056 // 00057 // Revision 1.4 1997/01/22 16:27:14 sjp 00058 // Fixed error in pre-processor labels 00059 // 00060 // Revision 1.3 1997/01/21 20:33:43 sjp 00061 // Changed CPP flags and include because of library reorganization 00062 // 00063 // Revision 1.2 1996/12/20 21:19:06 sjp 00064 // Extended pathnames for Include files 00065 // 00066 // Revision 1.1 1996/11/04 19:35:52 sjp 00067 // New file for new `List' module 00068 // 00069 00070 // system include files 00071 #include <assert.h> 00072 00073 // user include files 00074 #include "DecayChain/List/CandidateList.h" // for iterator declarations 00075 00076 // STL include files 00077 #include <vector> 00078 00079 // forward declarations 00080 namespace dchain { 00081 template < class CandidateClass > class CombinatoricLoop ; 00082 00083 // 00084 // Note: Most of the methods are included in the declarations because 00085 // there are too many problems with the g++ compiler to make is 00086 // sensible to have separate definitions 00087 00088 #ifndef _combinatoricloop_vector_ 00089 // The following CPP macro is used to avoid having to typedef 00090 // a map in the class. Why? Because things can get messy, at 00091 // least in the g++ compiler as the typedef can cause instantiation 00092 // when not all the necessary information is available! 00093 #define _combinatoricloop_vector_ std::vector< CombinatoricLoop< CandidateClass >* > 00094 #endif 00095 00096 template< class CandidateClass > 00097 class CombinatoricLoop 00098 { 00099 // friend classses and functions 00100 00101 public: 00102 00103 // constants, enums and typedefs 00104 00105 // Constructors and destructor 00106 // Due to some `feature' of CC on SunOS5 the constructor has been 00107 // moved to be the last declaration in the public area. 00108 virtual ~CombinatoricLoop(); 00109 00110 // member functions 00111 void setCurrentIterator( typename dchain::CandidateList< CandidateClass >::const_partial_iterator& aIterator ) ; 00112 00113 // const member functions 00114 const typename dchain::CandidateList< CandidateClass >::const_partial_iterator partial_begin() const ; 00115 const typename dchain::CandidateList< CandidateClass >::const_partial_iterator partial_end() const ; 00116 00117 CombinatoricLoop( const typename dchain::CandidateList< CandidateClass >::const_partial_iterator& aBegin , 00118 const typename dchain::CandidateList< CandidateClass >::const_partial_iterator& aEnd , 00119 _combinatoricloop_vector_& aLoopList ) ; 00120 00121 // static member functions 00122 00123 protected: 00124 // protected member functions 00125 00126 // protected const member functions 00127 00128 private: 00129 // Constructors and destructor 00130 CombinatoricLoop() ; // stop default 00131 CombinatoricLoop( const CombinatoricLoop< CandidateClass >& ) ; // stop default 00132 00133 // assignment operator(s) 00134 const CombinatoricLoop& operator=( const CombinatoricLoop< CandidateClass >& ) ; // stop default 00135 00136 // private member functions 00137 void adjustEnd() ; 00138 00139 // private const member functions 00140 00141 // data members 00142 typename dchain::CandidateList< CandidateClass >::const_partial_iterator m_beginIterator ; 00143 typename dchain::CandidateList< CandidateClass >::const_partial_iterator m_endIterator ; 00144 typename dchain::CandidateList< CandidateClass >::const_partial_iterator m_currentIterator ; 00145 typename _combinatoricloop_vector_::const_iterator* m_previousDuplicate ; 00146 00147 // static data members 00148 00149 }; 00150 00151 // inline function definitions 00152 } 00153 00154 // function definitions 00155 # include "DecayChain/List/Template/CombinatoricLoop.cc" 00156 00157 #endif /* DCHAIN_COMBINATORICLOOP_H */