• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List

neighb_niter_base.hh

00001 // Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
00002 //
00003 // This file is part of Olena.
00004 //
00005 // Olena is free software: you can redistribute it and/or modify it under
00006 // the terms of the GNU General Public License as published by the Free
00007 // Software Foundation, version 2 of the License.
00008 //
00009 // Olena is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Olena.  If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 // As a special exception, you may use this file as part of a free
00018 // software project without restriction.  Specifically, if other files
00019 // instantiate templates or use macros or inline functions from this
00020 // file, or you compile this file and link it with other files to produce
00021 // an executable, this file does not by itself cause the resulting
00022 // executable to be covered by the GNU General Public License.  This
00023 // exception does not however invalidate any other reasons why the
00024 // executable file might be covered by the GNU General Public License.
00025 
00026 #ifndef MLN_CORE_INTERNAL_NEIGHB_NITER_BASE_HH
00027 # define MLN_CORE_INTERNAL_NEIGHB_NITER_BASE_HH
00028 
00032 
00033 # include <mln/core/internal/site_relative_iterator_base.hh>
00034 # include <mln/core/internal/neighb_niter_impl.hh>
00035 
00036 namespace mln
00037 {
00038 
00039   namespace internal
00040   {
00041 
00042     // neighb_niter_base<W,I,E>
00043 
00044     template <typename W, typename N, typename I, typename E>
00045     class neighb_niter_base
00046       : public internal::site_relative_iterator_base< N,
00047                                                       E,
00048                                                       mln_psite(N) >,
00049         public internal::neighb_niter_impl<W,E>
00050     {
00051     public:
00052 
00054       neighb_niter_base();
00055 
00056       template <typename P>
00057       neighb_niter_base(const N& nbh, const P& c);
00058 
00060       bool is_valid_() const;
00061 
00063       void invalidate_();
00064 
00066       void do_start_();
00067 
00069       void do_next_();
00070 
00072       mln_psite(W) compute_p_() const;
00073 
00074     protected:
00075 
00076       I i_;
00077     };
00078 
00079 
00080 
00081 # ifndef MLN_INCLUDE_ONLY
00082 
00083 
00084     // neighb_niter_base<W,N,I,E>
00085 
00086     template <typename W, typename N, typename I, typename E>
00087     inline
00088     neighb_niter_base<W,N,I,E>::neighb_niter_base()
00089     {
00090     }
00091 
00092     template <typename W, typename N, typename I, typename E>
00093     template <typename P>
00094     inline
00095     neighb_niter_base<W,N,I,E>::neighb_niter_base(const N& nbh, const P& c)
00096     {
00097       this->change_target(nbh);
00098       this->center_at(c);
00099 
00100     }
00101 
00102     template <typename W, typename N, typename I, typename E>
00103     inline
00104     bool
00105     neighb_niter_base<W,N,I,E>::is_valid_() const
00106     {
00107       return i_.is_valid();
00108     }
00109 
00110     template <typename W, typename N, typename I, typename E>
00111     inline
00112     void
00113     neighb_niter_base<W,N,I,E>::invalidate_()
00114     {
00115       i_.invalidate();
00116     }
00117 
00118     template <typename W, typename N, typename I, typename E>
00119     inline
00120     void
00121     neighb_niter_base<W,N,I,E>::do_start_()
00122     {
00123       i_.start();
00124     }
00125 
00126     template <typename W, typename N, typename I, typename E>
00127     inline
00128     void
00129     neighb_niter_base<W,N,I,E>::do_next_()
00130     {
00131       i_.next();
00132     }
00133 
00134     template <typename W, typename N, typename I, typename E>
00135     inline
00136     mln_psite(W)
00137     neighb_niter_base<W,N,I,E>::compute_p_() const
00138     {
00139       return i_.compute_p_();
00140     }
00141 
00142 
00143 # endif // ! MLN_INCLUDE_ONLY
00144 
00145 
00146   } // end of namespace mln::internal
00147 
00148 } // end of namespace mln
00149 
00150 
00151 #endif // ! MLN_CORE_INTERNAL_NEIGHB_NITER_BASE_HH

Generated on Tue Oct 4 2011 15:24:06 for Milena (Olena) by  doxygen 1.7.1