00001 /* ./contener/iterator.h 00002 ********************************** 00003 Copyright INRIA and CEA 00004 00005 author : Guillaume ANCIAUX (anciaux@labri.fr, g.anciaux@laposte.net) 00006 00007 The LibMultiScale is a C++ parallel framework for the multiscale 00008 coupling methods dedicated to material simulations. This framework 00009 provides an API which makes it possible to program coupled simulations 00010 and integration of already existing codes. 00011 00012 This Project is done in a collaboration between INRIA Futurs Bordeaux 00013 within ScAlApplix team and CEA/DPTA Ile de France. 00014 00015 This software is governed by the CeCILL-C license under French law and 00016 abiding by the rules of distribution of free software. You can use, 00017 modify and/ or redistribute the software under the terms of the CeCILL-C 00018 license as circulated by CEA, CNRS and INRIA at the following URL 00019 "http://www.cecill.info". 00020 00021 As a counterpart to the access to the source code and rights to copy, 00022 modify and redistribute granted by the license, users are provided only 00023 with a limited warranty and the software's author, the holder of the 00024 economic rights, and the successive licensors have only limited 00025 liability. 00026 00027 In this respect, the user's attention is drawn to the risks associated 00028 with loading, using, modifying and/or developing or reproducing the 00029 software by the user in light of its specific status of free software, 00030 that may mean that it is complicated to manipulate, and that also 00031 therefore means that it is reserved for developers and experienced 00032 professionals having in-depth computer knowledge. Users are therefore 00033 encouraged to load and test the software's suitability as regards their 00034 requirements in conditions enabling the security of their systems and/or 00035 data to be ensured and, more generally, to use and operate it in the 00036 same conditions as regards security. 00037 00038 The fact that you are presently reading this means that you have had 00039 knowledge of the CeCILL-C license and that you accept its terms. 00040 ***********************************/ 00041 00042 #ifndef ITERATEUR_H 00043 #define ITERATEUR_H 00044 00045 00046 template <typename T,typename IT> class Contener; 00047 00053 template <typename T,typename D> 00054 class Iterator 00055 { 00056 00057 public: 00058 00059 Iterator(Contener<T,Iterator<T,D> > & c): 00060 my_cont(c),end_flag(false) 00061 {}; 00062 00064 T & GetFirst (){ 00065 end_flag = false; 00066 return myIterator()->GetFirst(); 00067 } 00068 00070 T & GetNext (){ 00071 return myIterator()->GetNext(); 00072 }; 00073 00075 bool end(){ 00076 return end_flag; 00077 }; 00078 00079 private: 00080 00082 D* myIterator(){ 00083 return static_cast<D*>(this); 00084 } 00085 00086 protected: 00088 Contener<T,Iterator<T,D> > & my_cont; 00089 00091 bool end_flag; 00092 00093 }; 00094 #endif //ITERATEUR_H 00095
1.5.2