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

neighb_niter_impl.hh

00001 // Copyright (C) 2008, 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_IMPL_HH
00027 # define MLN_CORE_INTERNAL_NEIGHB_NITER_IMPL_HH
00028 
00032 
00033 # include <mln/core/macros.hh>
00034 # include <mln/core/internal/force_exact.hh>
00035 
00036 
00037 namespace mln
00038 {
00039 
00040   // Forward declaration.
00041   template <typename P, typename W> class graph_window_base;
00042   template <typename G, typename F> class graph_elt_window;
00043   template <typename G, typename F, typename I> class graph_elt_window_if;
00044   template <typename G, typename F> class line_graph_elt_window;
00045   namespace util
00046   {
00047     template <typename G> class vertex;
00048     template <typename G> class edge;
00049   }
00050 
00051 
00052   namespace internal
00053   {
00054 
00056     template <typename W, typename E>
00057     struct neighb_niter_impl
00058     {
00059 
00060     };
00061 
00074     template <typename P, typename E>
00075     struct neighb_niter_impl_graph_window
00076     {
00077       unsigned id() const
00078       {
00079         return internal::force_exact<E>(*this).compute_p_().id();
00080       }
00081 
00082     };
00083 
00089     template <typename G, typename E>
00090     struct neighb_niter_impl_graph_window< util::vertex<G>, E >
00091     {
00092     };
00093 
00099     template <typename G, typename E>
00100     struct neighb_niter_impl_graph_window< util::edge<G>, E >
00101     {
00102     };
00103 
00104 
00107     template <typename P, typename T, typename E>
00108     struct neighb_niter_impl< graph_window_base<P, T>, E >
00109       : neighb_niter_impl_graph_window<P,E>
00110     {
00111       typedef typename T::target S;
00112 
00113       // Tech. note: A copy is returned since it actually is a
00114       // temporary object; we cannot return a "const&" here for some
00115       // compilers badly kills the temporary object...
00116       mln_graph_element(S) element() const
00117       {
00118         return internal::force_exact<E>(*this).compute_p_().element();
00119       }
00120 
00121     };
00122 
00123 
00124 
00127     template <typename G, typename S, typename E>
00128     struct neighb_niter_impl<graph_elt_window<G,S>, E>
00129       : public neighb_niter_impl< graph_window_base< mln_result(S::fun_t),
00130                                                      graph_elt_window<G,S> >,
00131                                   E >
00132     {
00133 
00134     };
00135 
00138     template <typename G, typename F, typename E>
00139     struct neighb_niter_impl<line_graph_elt_window<G,F>, E>
00140       : public neighb_niter_impl< graph_window_base< mln_result(F),
00141                                                      line_graph_elt_window<G, F> >,
00142                                   E >
00143     {
00144 
00145     };
00146 
00147 
00150     template <typename G, typename S, typename I, typename E>
00151     struct neighb_niter_impl<graph_elt_window_if<G,S,I>, E>
00152       : public neighb_niter_impl< graph_window_base< mln_result(S::fun_t),
00153                                                      graph_elt_window_if<G,S,I> >,
00154                                   E >
00155     {
00156 
00157     };
00158 
00159 
00160   } // end of namespace mln::internal
00161 
00162 } // end of namespace mln
00163 
00164 #endif // ! MLN_CORE_INTERNAL_NEIGHB_NITER_IMPL_HH

Generated on Thu Sep 8 2011 18:32:09 for Milena (Olena) by  doxygen 1.7.1