Milena (Olena)
User documentation 2.0a Id
|
00001 // Copyright (C) 2008, 2009 EPITA Research and Development Laboratory 00002 // (LRDE) 00003 // 00004 // This file is part of Olena. 00005 // 00006 // Olena is free software: you can redistribute it and/or modify it under 00007 // the terms of the GNU General Public License as published by the Free 00008 // Software Foundation, version 2 of the License. 00009 // 00010 // Olena is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 // General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Olena. If not, see <http://www.gnu.org/licenses/>. 00017 // 00018 // As a special exception, you may use this file as part of a free 00019 // software project without restriction. Specifically, if other files 00020 // instantiate templates or use macros or inline functions from this 00021 // file, or you compile this file and link it with other files to produce 00022 // an executable, this file does not by itself cause the resulting 00023 // executable to be covered by the GNU General Public License. This 00024 // exception does not however invalidate any other reasons why the 00025 // executable file might be covered by the GNU General Public License. 00026 00027 #ifndef MLN_CORE_INTERNAL_NEIGHB_NITER_IMPL_HH 00028 # define MLN_CORE_INTERNAL_NEIGHB_NITER_IMPL_HH 00029 00033 00034 # include <mln/core/macros.hh> 00035 # include <mln/core/internal/force_exact.hh> 00036 00037 00038 namespace mln 00039 { 00040 00041 // Forward declaration. 00042 template <typename P, typename W> class graph_window_base; 00043 template <typename G, typename S> class graph_elt_window; 00044 template <typename G, typename S, typename S2> class graph_elt_mixed_window; 00045 template <typename G, typename F, typename I> class graph_elt_window_if; 00046 template <typename G, typename F> class line_graph_elt_window; 00047 namespace util 00048 { 00049 template <typename G> class vertex; 00050 template <typename G> class edge; 00051 } 00052 00053 00054 namespace internal 00055 { 00056 00058 template <typename W, typename E> 00059 struct neighb_niter_impl 00060 { 00061 00062 }; 00063 00076 template <typename P, typename E> 00077 struct neighb_niter_impl_graph_window 00078 { 00079 unsigned id() const 00080 { 00081 return internal::force_exact<E>(*this).compute_p_().id(); 00082 } 00083 00084 }; 00085 00091 template <typename G, typename E> 00092 struct neighb_niter_impl_graph_window< util::vertex<G>, E > 00093 { 00094 }; 00095 00101 template <typename G, typename E> 00102 struct neighb_niter_impl_graph_window< util::edge<G>, E > 00103 { 00104 }; 00105 00106 00109 template <typename P, typename T, typename E> 00110 struct neighb_niter_impl< graph_window_base<P, T>, E > 00111 : neighb_niter_impl_graph_window<P,E> 00112 { 00113 typedef typename T::target S; 00114 00115 // Tech. note: A copy is returned since it actually is a 00116 // temporary object; we cannot return a "const&" here for some 00117 // compilers badly kills the temporary object... 00118 mln_graph_element(S) element() const 00119 { 00120 return internal::force_exact<E>(*this).compute_p_().element(); 00121 } 00122 00123 }; 00124 00125 00126 00129 template <typename G, typename S, typename E> 00130 struct neighb_niter_impl<graph_elt_window<G,S>, E> 00131 : public neighb_niter_impl< graph_window_base< mln_result(S::fun_t), 00132 graph_elt_window<G,S> >, 00133 E > 00134 { 00135 00136 }; 00137 00140 template <typename G, typename F, typename E> 00141 struct neighb_niter_impl<line_graph_elt_window<G,F>, E> 00142 : public neighb_niter_impl< graph_window_base< mln_result(F), 00143 line_graph_elt_window<G, F> >, 00144 E > 00145 { 00146 00147 }; 00148 00149 00152 template <typename G, typename S, typename I, typename E> 00153 struct neighb_niter_impl<graph_elt_window_if<G,S,I>, E> 00154 : public neighb_niter_impl< graph_window_base< mln_result(S::fun_t), 00155 graph_elt_window_if<G,S,I> >, 00156 E > 00157 { 00158 00159 }; 00160 00161 00164 template <typename G, typename S, typename S2, typename E> 00165 struct neighb_niter_impl<graph_elt_mixed_window<G,S,S2>, E> 00166 : public neighb_niter_impl< graph_window_base< mln_result(S2::fun_t), 00167 graph_elt_mixed_window<G,S,S2> >, 00168 E > 00169 { 00170 00171 }; 00172 00173 00174 } // end of namespace mln::internal 00175 00176 } // end of namespace mln 00177 00178 #endif // ! MLN_CORE_INTERNAL_NEIGHB_NITER_IMPL_HH