656: Add forward declaration files + sketch the mechanism for 'plain' and 'ch_value'.

2006-10-17 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr> Add forward declaration files. * oln/core/aliases.hh: New. * oln/core/fwd_decls.hh: New. * oln/core/1d/fwd_decls.hh: New. * oln/core/2d/fwd_decls.hh: New. * oln/core/3d/fwd_decls.hh: New. * oln/core/gen/fwd_decls.hh: New. * oln/morpher/fwd_decls.hh: New. * oln/debug/typename.hh: New. * oln/Makefile.am: Update. Sketch the mechanism for 'plain' and 'ch_value'. * oln/core/type_fun/plain.hh: New. * oln/core/type_fun/ch_value.hh: New. * oln/core/typedefs.hh (oln_plain, oln_plain_): New. * oln/core/image_entry.hh (concrete_type): Remove; obsolete. * oln/core/abstract/image.hh (topo, operator): Change sigs. (topo_t, psite_t, rvalue_t): Remove; now unused. (decl): Uncomment static checks. * oln/core/abstract/image/computability/hierarchy.hh (plain): New. * oln/core/1d/image1d.hh (real_type): Remove; obsolete. * oln/core/2d/image2d.hh: Likewise. * oln/core/3d/image3d.hh: Likewise. * oln/morpher/value_cast.hh (class): Change into struct for homogeneity for other morphers. Index: oln/debug/typename.hh =================================================================== --- oln/debug/typename.hh (revision 0) +++ oln/debug/typename.hh (revision 0) @@ -0,0 +1,279 @@ +// Copyright (C) 2006 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_DEBUG_TYPENAME_HH +# define OLN_DEBUG_TYPENAME_HH + +# include <string> +# include <sstream> + +# include <oln/core/fwd_decls.hh> +# include <oln/core/aliases.hh> +# include <oln/morpher/fwd_decls.hh> + + +# define oln_decl_typename_string(Type) \ + \ + template <> \ + struct typename_string <Type> \ + { \ + static std::string get() \ + { \ + return #Type; \ + } \ + } \ + + +# define oln_decl_typename_string_T(Type) \ + \ + template <typename T> \ + struct typename_string < Type<T> > \ + { \ + static std::string get() \ + { \ + std::ostringstream oss; \ + oss << (#Type) << '<' << typename_string<T>::get() << '>'; \ + return oss.str(); \ + } \ + } + + +# define oln_decl_typename_string_U(Type) \ + \ + template <unsigned U> \ + struct typename_string < Type<U> > \ + { \ + static std::string get() \ + { \ + std::ostringstream oss; \ + oss << (#Type) << '<' << U << '>'; \ + return oss.str(); \ + } \ + } + + +# define oln_decl_typename_string_TT(Type) \ + \ + template <typename T1, typename T2> \ + struct typename_string < Type<T1, T2> > \ + { \ + static std::string get() \ + { \ + std::ostringstream oss; \ + oss << (#Type) << '<' << typename_string<T1>::get() << ',' \ + << typename_string<T2>::get() << '>'; \ + return oss.str(); \ + } \ + } + + + +namespace oln +{ + + namespace debug + { + + namespace internal + { + + template <typename T> + struct typename_string + { + static std::string get() + { + return "?"; + } + }; + + template <typename T> + struct typename_string <const T> + { + static std::string get() + { + return std::string("const ") + typename_string<T>::get(); + } + }; + + template <typename T> + struct typename_string <T*> + { + static std::string get() + { + return typename_string<T>::get() + '*'; + } + }; + + } // end of namespace oln::debug::internal + + + template <typename T> + struct type + { + static std::string to_string() + { + return internal::typename_string<T>::get(); + } + }; + + + namespace internal + { + + // Builtin. + + oln_decl_typename_string(void); + oln_decl_typename_string(bool); + + oln_decl_typename_string(char); + + oln_decl_typename_string(unsigned char); + oln_decl_typename_string(signed char); + + oln_decl_typename_string(unsigned short); + oln_decl_typename_string(signed short); + + oln_decl_typename_string(unsigned long); + oln_decl_typename_string(signed long); + + oln_decl_typename_string(int); + oln_decl_typename_string(unsigned int); + oln_decl_typename_string(float); + oln_decl_typename_string(double); + + + // From oln/core/1d/fwd_decls.hh + + oln_decl_typename_string_TT(oln::array1d); + oln_decl_typename_string_T(oln::dpoint1d_); + oln_decl_typename_string_T(oln::point1d_); + oln_decl_typename_string_T(oln::image1d); + + oln_decl_typename_string(oln::grid1d); + oln_decl_typename_string(oln::point1d); + oln_decl_typename_string(oln::dpoint1d); + oln_decl_typename_string(oln::neighb1d); + oln_decl_typename_string(oln::window1d); + oln_decl_typename_string(oln::bbox1d); + oln_decl_typename_string(oln::topo1d); + oln_decl_typename_string(oln::fwd_piter1d); + oln_decl_typename_string(oln::bkd_piter1d); + oln_decl_typename_string(oln::fwd_qiter1d); + oln_decl_typename_string(oln::bkd_qiter1d); + oln_decl_typename_string(oln::point1df); + oln_decl_typename_string(oln::dpoint1df); + + + // From oln/core/2d/fwd_decls.hh + + oln_decl_typename_string_TT(oln::array2d); + oln_decl_typename_string_T(oln::dpoint2d_); + oln_decl_typename_string_T(oln::point2d_); + oln_decl_typename_string_T(oln::image2d); + + oln_decl_typename_string(oln::grid2d); + oln_decl_typename_string(oln::point2d); + oln_decl_typename_string(oln::dpoint2d); + oln_decl_typename_string(oln::neighb2d); + oln_decl_typename_string(oln::window2d); + oln_decl_typename_string(oln::bbox2d); + oln_decl_typename_string(oln::topo2d); + oln_decl_typename_string(oln::fwd_piter2d); + oln_decl_typename_string(oln::bkd_piter2d); + oln_decl_typename_string(oln::fwd_qiter2d); + oln_decl_typename_string(oln::bkd_qiter2d); + oln_decl_typename_string(oln::point2df); + oln_decl_typename_string(oln::dpoint2df); + + + // From oln/core/3d/fwd_decls.hh + + oln_decl_typename_string_TT(oln::array3d); + oln_decl_typename_string_T(oln::dpoint3d_); + oln_decl_typename_string_T(oln::point3d_); + oln_decl_typename_string_T(oln::image3d); + + oln_decl_typename_string(oln::grid3d); + oln_decl_typename_string(oln::point3d); + oln_decl_typename_string(oln::dpoint3d); + oln_decl_typename_string(oln::neighb3d); + oln_decl_typename_string(oln::window3d); + oln_decl_typename_string(oln::bbox3d); + oln_decl_typename_string(oln::topo3d); + oln_decl_typename_string(oln::fwd_piter3d); + oln_decl_typename_string(oln::bkd_piter3d); + oln_decl_typename_string(oln::fwd_qiter3d); + oln_decl_typename_string(oln::bkd_qiter3d); + oln_decl_typename_string(oln::point3df); + oln_decl_typename_string(oln::dpoint3df); + + + // From oln/morpher/fwd_decl.hh + + oln_decl_typename_string_T(oln::morpher::identity); + + oln_decl_typename_string_TT(oln::morpher::add_neighborhood); + oln_decl_typename_string_TT(oln::morpher::add_isubset); + oln_decl_typename_string_TT(oln::morpher::thru_fun); + oln_decl_typename_string_TT(oln::morpher::value_cast); + + + // From oln/core/gen/fwd_decls.hh + + oln_decl_typename_string_U(oln::grid_); + + oln_decl_typename_string_T(oln::bbox_); + oln_decl_typename_string_T(oln::bbox_fwd_piter_); + oln_decl_typename_string_T(oln::bbox_bkd_piter_); + + oln_decl_typename_string_T(oln::fwd_piter_bbox_); + oln_decl_typename_string_T(oln::bkd_piter_bbox_); + + oln_decl_typename_string_T(oln::window_); + oln_decl_typename_string_T(oln::fwd_qiter_win_); + oln_decl_typename_string_T(oln::bkd_qiter_win_); + + oln_decl_typename_string_T(oln::neighb_); + oln_decl_typename_string_T(oln::fwd_niter_neighb_); + oln_decl_typename_string_T(oln::bkd_niter_neighb_); + + oln_decl_typename_string_T(oln::topo_bbox_); + oln_decl_typename_string_T(oln::topo_lbbox_); + oln_decl_typename_string_TT(oln::topo_add_isubset); + oln_decl_typename_string_TT(oln::topo_add_nbh); + + oln_decl_typename_string_TT(oln::mapimage); + + + } // end of namespace oln::debug::internal + + } // end of namespace oln::debug + +} // end of namespace oln + + +#endif // ! OLN_DEBUG_TYPENAME_HH Index: oln/core/aliases.hh =================================================================== --- oln/core/aliases.hh (revision 0) +++ oln/core/aliases.hh (revision 0) @@ -0,0 +1,38 @@ +// Copyright (C) 2001, 2003, 2004, 2005, 2006 EPITA Research and +// Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_CORE_ALIASES_HH +# define OLN_CORE_ALIASES_HH + + +# include <oln/core/1d/aliases.hh> +# include <oln/core/2d/aliases.hh> +# include <oln/core/3d/aliases.hh> + + +#endif // ! OLN_CORE_ALIASES_HH Index: oln/core/typedefs.hh =================================================================== --- oln/core/typedefs.hh (revision 655) +++ oln/core/typedefs.hh (working copy) @@ -146,7 +146,6 @@ // -------------------------------------------------------------------- // mlc_decl_typedef(image_type); // -------------------------------------------------------------------- - mlc_decl_typedef(concrete_type); mlc_decl_typedef(delegated_type); mlc_decl_typedef(size_type); // FIXME: To be removed. @@ -216,6 +215,9 @@ # define oln_grid(T) oln_type_of(T, grid) # define oln_grid_(T) oln_type_of_(T, grid) +# define oln_topo(T) oln_type_of(T, topo) +# define oln_topo_(T) oln_type_of_(T, topo) + # define oln_point(T) oln_type_of(T, point) # define oln_point_(T) oln_type_of_(T, point) @@ -265,7 +267,20 @@ +# include <oln/core/type_fun/plain.hh> + +/// \{ +/// Shortcuts for functions. + +# define oln_plain(T) typename oln::type_fun::plain<T>::ret +# define oln_plain_(T) oln::type_fun::plain<T>::ret + +/// \} + + + + # include <oln/core/abstract/entry.hh> Index: oln/core/fwd_decls.hh =================================================================== --- oln/core/fwd_decls.hh (revision 0) +++ oln/core/fwd_decls.hh (revision 0) @@ -0,0 +1,51 @@ +// Copyright (C) 2006 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_CORE_FWD_DECLS +# define OLN_CORE_FWD_DECLS + +# include <oln/core/1d/fwd_decls.hh> +# include <oln/core/2d/fwd_decls.hh> +# include <oln/core/3d/fwd_decls.hh> +# include <oln/core/gen/fwd_decls.hh> + + +namespace oln +{ + + template <typename T> class image1d; + template <typename T> class image2d; + template <typename T> class image3d; + template <typename E> class image_entry; + template <typename E> class image_entry; + template <typename P, typename V> class mapimage; + +} // end of namespace oln + + + +#endif // ! OLN_CORE_FWD_DECLS Index: oln/core/type_fun/plain.hh =================================================================== --- oln/core/type_fun/plain.hh (revision 0) +++ oln/core/type_fun/plain.hh (revision 0) @@ -0,0 +1,130 @@ +// Copyright (C) 2006 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_CORE_TYPE_FUN_PLAIN_HH +# define OLN_CORE_TYPE_FUN_PLAIN_HH + +# include <oln/core/typedefs.hh> + +# include <oln/core/fwd_decls.hh> +# include <oln/morpher/fwd_decls.hh> + +# include <oln/core/type_fun/ch_value.hh> + + + +namespace oln +{ + + namespace type_fun + { + + template <typename T> + struct plain + { + typedef mlc::undefined ret; + }; + + + // image?d + + template <typename T> + struct plain< image1d<T> > + { + typedef image1d<T> ret; + }; + + template <typename T> + struct plain< image2d<T> > + { + typedef image2d<T> ret; + }; + + template <typename T> + struct plain< image3d<T> > + { + typedef image3d<T> ret; + }; + + + // morpher::add_neighborhood + + template <typename Image, typename Neighb> + struct plain< morpher::add_neighborhood<Image, Neighb> > + { + typedef typename plain<Image>::ret plain_Image; + typedef morpher::add_neighborhood<plain_Image, Neighb> ret; + }; + + + // add_isubset + + template <typename Image, typename Isubset> + struct plain< morpher::add_isubset<Image, Isubset> > + { + typedef typename plain<Image>::ret plain_Image; + typedef morpher::add_isubset<plain_Image, Isubset> ret; + }; + + + // identity + + template <typename Image> + struct plain< morpher::identity<Image> > + { + typedef typename plain<Image>::ret plain_Image; + typedef plain_Image ret; + }; + + + // thru_fun + + template <typename Image, typename Fun> + struct plain< morpher::thru_fun<Image, Fun> > + { + typedef morpher::thru_fun<Image, Fun> self_t; + typedef typename plain<Image>::ret plain_Image; + typedef typename ch_value<plain_Image, oln_value(self_t)>::ret ret; + }; + + + // value_cast + + template <typename Image, typename Value> + struct plain< morpher::value_cast<Image, Value> > + { + typedef typename plain<Image>::ret plain_Image; + typedef typename ch_value<plain_Image, Value>::ret ret; + }; + + + } // end of namespace oln::type_fun + +} // end of namespace oln + + +#endif // ! OLN_CORE_TYPE_FUN_PLAIN_HH Index: oln/core/type_fun/ch_value.hh =================================================================== --- oln/core/type_fun/ch_value.hh (revision 0) +++ oln/core/type_fun/ch_value.hh (revision 0) @@ -0,0 +1,124 @@ +// Copyright (C) 2006 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_CORE_TYPE_FUN_CH_VALUE_HH +# define OLN_CORE_TYPE_FUN_CH_VALUE_HH + +# include <mlc/flags.hh> + +# include <oln/core/fwd_decls.hh> +# include <oln/morpher/fwd_decls.hh> + + + +namespace oln +{ + + namespace type_fun + { + + template <typename Image, typename Value> + struct ch_value + { + typedef mlc::undefined ret; + }; + + + // image?d + + template <typename T, typename Value> + struct ch_value< image1d<T>, Value > + { + typedef image1d<Value> ret; + }; + + template <typename T, typename Value> + struct ch_value< image2d<T>, Value > + { + typedef image2d<Value> ret; + }; + + template <typename T, typename Value> + struct ch_value< image3d<T>, Value > + { + typedef image3d<Value> ret; + }; + + + // add_neighborhood. + + template <typename Image, typename Neighb, typename Value> + struct ch_value< morpher::add_neighborhood<Image, Neighb>, Value > + { + typedef typename ch_value<Image, Value>::ret ImageV; + typedef morpher::add_neighborhood<ImageV, Neighb> ret; + }; + + + // add_isubset. + + template <typename Image, typename Isubset, typename Value> + struct ch_value< morpher::add_isubset<Image, Isubset>, Value > + { + typedef typename ch_value<Image, Value>::ret ImageV; + typedef morpher::add_isubset<ImageV, Isubset> ret; + }; + + + // identity. + + template <typename Image, typename Value> + struct ch_value< morpher::identity<Image>, Value > + { + typedef typename ch_value<Image, Value>::ret ret; + }; + + + // thru_fun. + + template <typename Image, typename Fun, typename Value> + struct ch_value< morpher::thru_fun<Image, Fun>, Value > + { + typedef typename ch_value<Image, Value>::ret ret; + }; + + + // value_cast. + + template <typename Image, typename V, typename Value> + struct ch_value< morpher::value_cast<Image, V>, Value > + { + typedef typename ch_value<Image, Value>::ret ret; + }; + + + } // end of namespace type_fun + +} // end of namespace oln + + +#endif // ! OLN_CORE_TYPE_FUN_CH_VALUE_HH Index: oln/core/image_entry.hh =================================================================== --- oln/core/image_entry.hh (revision 655) +++ oln/core/image_entry.hh (working copy) @@ -31,8 +31,10 @@ # include <oln/core/abstract/entry.hh> # include <oln/core/abstract/image/all.hh> +# include <oln/core/type_fun/plain.hh> + namespace oln { @@ -83,8 +85,6 @@ // fwd_qiter_type: see below. // bkd_qiter_type: see below. - - typedef mlc::undefined concrete_type; /// \brief Morpher type. /// Index: oln/core/abstract/image.hh =================================================================== --- oln/core/abstract/image.hh (revision 655) +++ oln/core/abstract/image.hh (working copy) @@ -63,39 +63,24 @@ struct decl { -// oln_virtual_typedef(topo); -// oln_virtual_typedef(grid); + oln_virtual_typedef(topo); + oln_virtual_typedef(grid); + oln_virtual_typedef(coord); + oln_virtual_typedef(psite); + oln_virtual_typedef(point); -// oln_virtual_typedef(coord); + oln_virtual_typedef(fwd_piter); + oln_virtual_typedef(bkd_piter); -// oln_virtual_typedef(psite); -// oln_virtual_typedef(point); - -// // oln_virtual_typedef(piter); -// // oln_virtual_typedef(fwd_piter); -// // oln_virtual_typedef(bkd_piter); - oln_virtual_typedef(is_computed); + oln_virtual_typedef(value); + oln_virtual_typedef(rvalue); -// oln_virtual_typedef(value); -// oln_virtual_typedef(rvalue); + oln_virtual_typedef(morpher); -// oln_virtual_typedef(concrete); - -// oln_virtual_typedef(morpher); - decl(); }; - - private: - - /// Typedefs. - typedef oln_type_of(E, topo) topo_t; - typedef oln_type_of(E, psite) psite_t; - typedef oln_type_of(E, rvalue) rvalue_t; - - public: /*------------------* @@ -111,14 +96,14 @@ ** topo2d. */ - const topo_t& topo() const; + const oln_topo(E)& topo() const; /*! \brief Gives access to the value stored at \a p in the ** current image. */ - rvalue_t operator()(const psite_t& p) const; + oln_rvalue(E) operator()(const oln_psite(E)& p) const; protected: @@ -138,13 +123,14 @@ template <typename E> image<E>::decl::decl() { -// mlc::assert_< mlc_is_a(topo, abstract::topology) >::check(); -// mlc::assert_< mlc_is_a(grid, abstract::grid) >::check(); -// mlc::assert_< mlc_is_a(piter, abstract::iterator_on_points) >::check(); -// mlc::assert_< mlc_is_a(fwd_piter, abstract::iterator_on_points) >::check(); -// mlc::assert_< mlc_is_a(bkd_piter, abstract::iterator_on_points) >::check(); - // FIXME: Rec. - // mlc::assert_< mlc_is_a(concrete, abstract::image) >::check(); + mlc::assert_< mlc_is_a(topo, abstract::topology) >::check(); + mlc::assert_< mlc_is_a(grid, abstract::grid) >::check(); + mlc::assert_< mlc_is_a(point, abstract::point) >::check(); + mlc::assert_< mlc_is_a(fwd_piter, abstract::iterator_on_points) >::check(); + mlc::assert_< mlc_is_a(bkd_piter, abstract::iterator_on_points) >::check(); + + // FIXME: Rec. + // mlc::assert_< mlc_is_a(plain, abstract::image) >::check(); } template <typename E> @@ -159,15 +145,15 @@ } template <typename E> - const typename image<E>::topo_t& + const oln_topo(E)& image<E>::topo() const { return this->exact().impl_topo(); } template <typename E> - typename image<E>::rvalue_t - image<E>::operator()(const typename image<E>::psite_t& p) const + oln_rvalue(E) + image<E>::operator()(const oln_psite(E)& p) const { return this->exact().impl_op_read(p); } Index: oln/core/abstract/image/computability/hierarchy.hh =================================================================== --- oln/core/abstract/image/computability/hierarchy.hh (revision 655) +++ oln/core/abstract/image/computability/hierarchy.hh (working copy) @@ -50,6 +50,10 @@ struct computed_image : public virtual image<E> //, public automatic::get_impl< computed_image, E> { + public: + + oln_plain(E) plain() const; + protected: /// Constructor (protected, empty). @@ -77,6 +81,14 @@ } template <typename E> + oln_plain(E) + computed_image<E>::plain() const + { + oln_plain(E) tmp(this->topo()); + return tmp; + } + + template <typename E> plain_image<E>::plain_image() { } Index: oln/core/1d/image1d.hh =================================================================== --- oln/core/1d/image1d.hh (revision 655) +++ oln/core/1d/image1d.hh (working copy) @@ -61,8 +61,6 @@ typedef mlc::false_ is_computed_type; typedef T value_type; typedef T& lvalue_type; - - typedef image1d<T> real_type; }; Index: oln/core/1d/fwd_decls.hh =================================================================== --- oln/core/1d/fwd_decls.hh (revision 0) +++ oln/core/1d/fwd_decls.hh (revision 0) @@ -0,0 +1,44 @@ +// Copyright (C) 2006 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_CORE_1D_FWD_DECLS +# define OLN_CORE_1D_FWD_DECLS + + +namespace oln +{ + + template <typename V, typename C> class array1d; + template <typename C> class dpoint1d_; + template <typename C> class point1d_; + template <typename T> class image1d; + +} // end of namespace oln + + + +#endif // ! OLN_CORE_1D_FWD_DECLS Index: oln/core/2d/image2d.hh =================================================================== --- oln/core/2d/image2d.hh (revision 655) +++ oln/core/2d/image2d.hh (working copy) @@ -61,8 +61,6 @@ typedef mlc::false_ is_computed_type; typedef T value_type; typedef T& lvalue_type; - - typedef image2d<T> real_type; }; Index: oln/core/2d/fwd_decls.hh =================================================================== --- oln/core/2d/fwd_decls.hh (revision 0) +++ oln/core/2d/fwd_decls.hh (revision 0) @@ -0,0 +1,44 @@ +// Copyright (C) 2006 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_CORE_2D_FWD_DECLS +# define OLN_CORE_2D_FWD_DECLS + + +namespace oln +{ + + template <typename V, typename C> class array2d; + template <typename C> class dpoint2d_; + template <typename C> class point2d_; + template <typename T> class image2d; + +} // end of namespace oln + + + +#endif // ! OLN_CORE_2D_FWD_DECLS Index: oln/core/3d/image3d.hh =================================================================== --- oln/core/3d/image3d.hh (revision 655) +++ oln/core/3d/image3d.hh (working copy) @@ -61,8 +61,6 @@ typedef mlc::false_ is_computed_type; typedef T value_type; typedef T& lvalue_type; - - typedef image3d<T> real_type; }; Index: oln/core/3d/fwd_decls.hh =================================================================== --- oln/core/3d/fwd_decls.hh (revision 0) +++ oln/core/3d/fwd_decls.hh (revision 0) @@ -0,0 +1,44 @@ +// Copyright (C) 2006 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_CORE_3D_FWD_DECLS +# define OLN_CORE_3D_FWD_DECLS + + +namespace oln +{ + + template <typename V, typename C> class array3d; + template <typename C> class dpoint3d_; + template <typename C> class point3d_; + template <typename T> class image3d; + +} // end of namespace oln + + + +#endif // ! OLN_CORE_3D_FWD_DECLS Index: oln/core/gen/fwd_decls.hh =================================================================== --- oln/core/gen/fwd_decls.hh (revision 0) +++ oln/core/gen/fwd_decls.hh (revision 0) @@ -0,0 +1,64 @@ +// Copyright (C) 2006 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_CORE_GEN_FWD_DECLS +# define OLN_CORE_GEN_FWD_DECLS + + +namespace oln +{ + + template <unsigned D> struct grid_; + + template <typename P> class bbox_; + template <typename P> class bbox_fwd_piter_; + template <typename P> class bbox_bkd_piter_; + + template <typename P> class fwd_piter_bbox_; + template <typename P> class bkd_piter_bbox_; + + template <typename D> class window_; + template <typename P> class fwd_qiter_win_; + template <typename P> class bkd_qiter_win_; + + template <typename D> class neighb_; + template <typename P> class fwd_niter_neighb_; + template <typename P> class bkd_niter_neighb_; + + template <typename P> class topo_bbox_; + template <typename P> class topo_lbbox_; + template <typename topo, typename isubset> class topo_add_isubset; + template <typename topo, typename nbh> class topo_add_nbh; + + template <typename P, typename V> class mapimage; + + +} // end of namespace oln + + + +#endif // ! OLN_CORE_GEN_FWD_DECLS Index: oln/Makefile.am =================================================================== --- oln/Makefile.am (revision 655) +++ oln/Makefile.am (working copy) @@ -8,6 +8,7 @@ core/1d/aliases.hh \ core/1d/array1d.hh \ core/1d/dpoint1d.hh \ + core/1d/fwd_decls.hh \ core/1d/image1d.hh \ core/1d/neighb1d.hh \ core/1d/point1d.hh \ @@ -15,6 +16,7 @@ core/2d/aliases.hh \ core/2d/array2d.hh \ core/2d/dpoint2d.hh \ + core/2d/fwd_decls.hh \ core/2d/image2d.hh \ core/2d/neighb2d.hh \ core/2d/point2d.hh \ @@ -22,6 +24,7 @@ core/3d/aliases.hh \ core/3d/array3d.hh \ core/3d/dpoint3d.hh \ + core/3d/fwd_decls.hh \ core/3d/image3d.hh \ core/3d/neighb3d.hh \ core/3d/point3d.hh \ @@ -104,6 +107,7 @@ core/gen/bkd_niter_neighb.hh \ core/gen/bkd_piter_bbox.hh \ core/gen/bkd_qiter_win.hh \ + core/gen/fwd_decls.hh \ core/gen/fwd_niter_neighb.hh \ core/gen/fwd_piter_bbox.hh \ core/gen/fwd_qiter_win.hh \ @@ -119,6 +123,9 @@ core/spe/row.hh \ core/spe/slice.hh \ \ + core/type_fun/ch_value.hh \ + core/type_fun/plain.hh \ + \ core/internal/bbox_bkd_piter.hh \ core/internal/bbox_fwd_piter.hh \ core/internal/dpoint_nd.hh \ @@ -126,7 +133,9 @@ core/internal/topology_morpher.hh \ core/internal/tracked_ptr.hh \ \ + core/aliases.hh \ core/case.hh \ + core/fwd_decls.hh \ core/image_entry.hh \ core/iterator_vtypes.hh \ core/macros.hh \ @@ -139,6 +148,7 @@ core/type.hh \ \ debug/print.hh \ + debug/typename.hh \ \ io/pnm.hh \ \ @@ -148,6 +158,7 @@ morpher/internal/image_value_morpher.hh \ \ morpher/add_neighborhood.hh \ + morpher/fwd_decls.hh \ morpher/identity.hh \ morpher/tags.hh \ morpher/thru_fun.hh \ Index: oln/morpher/value_cast.hh =================================================================== --- oln/morpher/value_cast.hh (revision 655) +++ oln/morpher/value_cast.hh (working copy) @@ -74,8 +74,8 @@ /// 'Image thru Valuection' morpher. template <typename Image, typename Value> - class value_cast : public internal::image_value_morpher< Image, - value_cast<Image, Value> > + struct value_cast : public internal::image_value_morpher< Image, + value_cast<Image, Value> > { private: Index: oln/morpher/fwd_decls.hh =================================================================== --- oln/morpher/fwd_decls.hh (revision 0) +++ oln/morpher/fwd_decls.hh (revision 0) @@ -0,0 +1,50 @@ +// Copyright (C) 2006 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_MORPHER_FWD_DECLS +# define OLN_MORPHER_FWD_DECLS + + +namespace oln +{ + + namespace morpher + { + + template <typename Image, typename Neighb> struct add_neighborhood; + template <typename Image, typename Isubset> struct add_isubset; + template <typename Image> struct identity; + template <typename Image, typename Fun> struct thru_fun; + template <typename Image, typename Value> struct value_cast; + + } // end of namespace oln::morpher + +} // end of namespace oln + + + +#endif // ! OLN_MORPHER_FWD_DECLS
participants (1)
-
Thierry GERAUD