Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
656: Add forward declaration files + sketch the mechanism for 'plain' and 'ch_value'.
by Thierry GERAUD 17 Oct '06
by Thierry GERAUD 17 Oct '06
17 Oct '06
2006-10-17 Thierry GERAUD <theo(a)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
1
0
17 Oct '06
https://svn.lrde.epita.fr/svn/oln/trunk
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Configure new Makefiles of olena/tests. Add a bootstrap script.
* configure.ac (olena/tests/algorithms/Makefile)
(olena/tests/core/Makefile, olena/tests/io/Makefile)
(olena/tests/morphers/Makefile, olena/tests/value/Makefile):
Configure them.
* bootstrap: New. Stolen from the LRDE Tiger Compiler.
bootstrap | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
configure.ac | 5 ++
2 files changed, 106 insertions(+)
Index: configure.ac
--- configure.ac (revision 654)
+++ configure.ac (working copy)
@@ -77,9 +77,14 @@
])
# FIXME: Should be performed through oln.m4 macros.
AC_CONFIG_FILES([
+ olena/tests/algorithms/Makefile
olena/tests/check/Makefile
olena/tests/check/defs
+ olena/tests/core/Makefile
+ olena/tests/io/Makefile
+ olena/tests/morphers/Makefile
olena/tests/sanity/Makefile
+ olena/tests/value/Makefile
])
AC_CONFIG_FILES([olena/tests/sanity/check],
[chmod +x olena/tests/sanity/check])
Index: bootstrap
--- bootstrap (revision 0)
+++ bootstrap (revision 0)
@@ -0,0 +1,101 @@
+#!/bin/sh
+
+
+fatal ()
+{
+ echo >&2 "$0: $@"
+ exit 1
+}
+
+awk_strverscmp='
+ # Use only awk features that work with 7th edition Unix awk (1978).
+ # My, what an old awk you have, Mr. Solaris!
+ END {
+ while (length(v1) || length(v2)) {
+ # Set d1 to be the next thing to compare from v1, and likewise for d2.
+ # Normally this is a single character, but if v1 and v2 contain digits,
+ # compare them as integers and fractions as strverscmp does.
+ if (v1 ~ /^[0-9]/ && v2 ~ /^[0-9]/) {
+ # Split v1 and v2 into their leading digit string components d1 and d2,
+ # and advance v1 and v2 past the leading digit strings.
+ for (len1 = 1; substr(v1, len1 + 1) ~ /^[0-9]/; len1++) continue
+ for (len2 = 1; substr(v2, len2 + 1) ~ /^[0-9]/; len2++) continue
+ d1 = substr(v1, 1, len1); v1 = substr(v1, len1 + 1)
+ d2 = substr(v2, 1, len2); v2 = substr(v2, len2 + 1)
+ if (d1 ~ /^0/) {
+ if (d2 ~ /^0/) {
+ # Compare two fractions.
+ while (d1 ~ /^0/ && d2 ~ /^0/) {
+ d1 = substr(d1, 2); len1--
+ d2 = substr(d2, 2); len2--
+ }
+ if (len1 != len2 && ! (len1 && len2 && substr(d1, 1, 1) == substr(d2, 1, 1))) {
+ # The two components differ in length, and the common prefix
+ # contains only leading zeros. Consider the longer to be less.
+ d1 = -len1
+ d2 = -len2
+ } else {
+ # Otherwise, compare as strings.
+ d1 = "x" d1
+ d2 = "x" d2
+ }
+ } else {
+ # A fraction is less than an integer.
+ exit 1
+ }
+ } else {
+ if (d2 ~ /^0/) {
+ # An integer is greater than a fraction.
+ exit 2
+ } else {
+ # Compare two integers.
+ d1 += 0
+ d2 += 0
+ }
+ }
+ } else {
+ # The normal case, without worrying about digits.
+ if (v1 == "") d1 = v1; else { d1 = substr(v1, 1, 1); v1 = substr(v1,2) }
+ if (v2 == "") d2 = v2; else { d2 = substr(v2, 1, 1); v2 = substr(v2,2) }
+ }
+ if (d1 < d2) exit 1
+ if (d1 > d2) exit 2
+ }
+ }
+'
+
+version_compare ()
+{
+ awk "$awk_strverscmp" v1="$1" v2="$2" /dev/null
+ case $? in
+ 1) echo '<';;
+ 0) echo '=';;
+ 2) echo '>';;
+ esac
+}
+
+# require TOOL REQUIREMENT
+# ------------------------
+# Test that TOOL exists, and its version is at least REQUIREMENT.
+require ()
+{
+ local version=$($1 --version | sed -n 's/.*[^0-9.]\([0-9][0-9.]*\).*/\1/p;q')
+ test x"$version" != x ||
+ fatal "$1 is required"
+ case $(version_compare "$2" "$version") in
+ '>') fatal "$1 $2 or better is required: this is $1 $2";;
+ esac
+}
+
+# Failures do matter.
+set -e
+
+# Requirements over bootstrap tools.
+require autoconf 2.59
+require automake 1.9.4
+
+# Tell what's going on.
+set -x
+
+# Install the GNU Build System.
+autoreconf -f -v -i
Property changes on: bootstrap
___________________________________________________________________
Name: svn:executable
+ *
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Organize the tests into a hierarchy.
* tests/fill.cc: Move file...
* tests/algorithms/fill.cc: ...here.
* tests/at.cc, tests/dpoint2d.cc, tests/grid.cc, tests/image1d.cc,
* tests/image2d.cc, tests/image3d.cc, tests/image_entry.cc,
* tests/npoints.cc, tests/point2d.cc, tests/window2d.cc: Move
files...
* tests/core/at.cc, tests/core/dpoint2d.cc, tests/core/grid.cc,
* tests/core/image1d.cc, tests/core/image2d.cc,
* tests/core/image3d.cc, tests/core/image_entry.cc,
* tests/core/npoints.cc, tests/core/point2d.cc,
* tests/core/window2d.cc: ...here.
* tests/io_pnm.cc: Move file...
* tests/io/io_pnm.cc: ...here.
* tests/add_neighborhood_morpher.cc, tests/identity_morpher.cc,
* tests/morphers.cc, tests/value_cast.cc: Move files...
* tests/morphers/add_neighborhood_morpher.cc,
* tests/morphers/identity_morpher.cc, tests/morphers/morphers.cc,
* tests/morphers/value_cast.cc:: ...here.
* tests/grey.cc: Move file...
* tests/value/grey.cc: ...here.
* tests/algorithms/Makefile.am, tests/core/Makefile.am,
* tests/io/Makefile.am, tests/morphers/Makefile.am,
* tests/value/Makefile.am: New.
* tests/Makefile.am: Adjust.
* tests/sanity/Makefile.am (CPPFLAGS): Add `-I$(srcdir)/..'.
* oln/Makefile.am: Remove
core/automatic/image/image_being_mutable.hh.
Add core/automatic/image/mutable_image.hh.
oln/Makefile.am | 2 -
tests/Makefile.am | 75 +------------------------------------------
tests/algorithms/Makefile.am | 32 ++++++++++++++++++
tests/core/Makefile.am | 49 ++++++++++++++++++++++++++++
tests/io/Makefile.am | 28 ++++++++++++++++
tests/morphers/Makefile.am | 34 +++++++++++++++++++
tests/sanity/Makefile.am | 1
tests/value/Makefile.am | 28 ++++++++++++++++
8 files changed, 175 insertions(+), 74 deletions(-)
Index: tests/core/Makefile.am
--- tests/core/Makefile.am (revision 0)
+++ tests/core/Makefile.am (revision 0)
@@ -0,0 +1,49 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+## FIXME: Revamp (see Olena 0.10's test suite).
+
+AM_CPPFLAGS = \
+ -I$(srcdir)/.. -I$(srcdir)/../check \
+ -I$(top_srcdir)/olena -I$(top_srcdir)/extended \
+ -I$(top_srcdir)/static -I$(top_srcdir)/metalic \
+ -DOLN_IMG_DIR=\"$(top_srcdir)/olena/img\"
+
+# FIXME: Add
+#
+# AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_DEBUG)
+#
+# when oln.m4 is available in the distribution.
+# Meanwhile, alter CXXFLAGS to turn off any optimization (Automake will
+# warn against this, but that's OK).
+TESTS_CXXFLAGS = @TESTS_CXXFLAGS@
+CXXFLAGS += $(TESTS_CXXFLAGS)
+
+check_PROGRAMS = \
+ dpoint2d \
+ point2d \
+ grid \
+ image_entry \
+ image1d \
+ image2d \
+ image3d \
+ npoints \
+ window2d \
+ \
+ at
+
+# Images and auxiliary structures.
+dpoint2d_SOURCES = dpoint2d.cc
+point2d_SOURCES = point2d.cc
+grid_SOURCES = grid.cc
+image_entry_SOURCES = image_entry.cc
+image1d_SOURCES = image1d.cc
+image2d_SOURCES = image2d.cc
+image3d_SOURCES = image3d.cc
+npoints_SOURCES = npoints.cc
+window2d_SOURCES = window2d.cc
+
+# Methods.
+at_SOURCES = at.cc
+
+
+TESTS = $(check_PROGRAMS)
Index: tests/morphers/Makefile.am
--- tests/morphers/Makefile.am (revision 0)
+++ tests/morphers/Makefile.am (revision 0)
@@ -0,0 +1,34 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+## FIXME: Revamp (see Olena 0.10's test suite).
+
+AM_CPPFLAGS = \
+ -I$(srcdir)/.. -I$(srcdir)/../check \
+ -I$(top_srcdir)/olena -I$(top_srcdir)/extended \
+ -I$(top_srcdir)/static -I$(top_srcdir)/metalic \
+ -DOLN_IMG_DIR=\"$(top_srcdir)/olena/img\"
+
+# FIXME: Add
+#
+# AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_DEBUG)
+#
+# when oln.m4 is available in the distribution.
+# Meanwhile, alter CXXFLAGS to turn off any optimization (Automake will
+# warn against this, but that's OK).
+TESTS_CXXFLAGS = @TESTS_CXXFLAGS@
+CXXFLAGS += $(TESTS_CXXFLAGS)
+
+check_PROGRAMS = \
+ identity_morpher \
+ add_neighborhood_morpher \
+ value_cast \
+ morphers
+
+# Morphers.
+identity_morpher_SOURCES = identity_morpher.cc
+add_neighborhood_morpher_SOURCES = add_neighborhood_morpher.cc
+value_cast_SOURCES = value_cast.cc
+morphers_SOURCES = morphers.cc
+
+
+TESTS = $(check_PROGRAMS)
Index: tests/sanity/Makefile.am
--- tests/sanity/Makefile.am (revision 653)
+++ tests/sanity/Makefile.am (working copy)
@@ -11,6 +11,7 @@
STC_LOCAL_CPPFLAGS = -I$(top_srcdir)/static -I$(top_builddir)/static
MLC_LOCAL_CPPFLAGS = -I$(top_srcdir)/metalic -I$(top_builddir)/metalic
CPPFLAGS = \
+ -I$(srcdir)/.. \
$(OLN_LOCAL_CPPFLAGS) $(XTD_LOCAL_CPPFLAGS) \
$(STC_LOCAL_CPPFLAGS) $(MLC_LOCAL_CPPFLAGS)
Index: tests/io/Makefile.am
--- tests/io/Makefile.am (revision 0)
+++ tests/io/Makefile.am (revision 0)
@@ -0,0 +1,28 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+## FIXME: Revamp (see Olena 0.10's test suite).
+
+AM_CPPFLAGS = \
+ -I$(srcdir)/.. -I$(srcdir)/../check \
+ -I$(top_srcdir)/olena -I$(top_srcdir)/extended \
+ -I$(top_srcdir)/static -I$(top_srcdir)/metalic \
+ -DOLN_IMG_DIR=\"$(top_srcdir)/olena/img\"
+
+# FIXME: Add
+#
+# AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_DEBUG)
+#
+# when oln.m4 is available in the distribution.
+# Meanwhile, alter CXXFLAGS to turn off any optimization (Automake will
+# warn against this, but that's OK).
+TESTS_CXXFLAGS = @TESTS_CXXFLAGS@
+CXXFLAGS += $(TESTS_CXXFLAGS)
+
+check_PROGRAMS = \
+ io_pnm
+
+# I/O.
+io_pnm_SOURCES = io_pnm.cc
+
+
+TESTS = $(check_PROGRAMS)
Index: tests/Makefile.am
--- tests/Makefile.am (revision 653)
+++ tests/Makefile.am (working copy)
@@ -1,78 +1,7 @@
## Process this file through Automake to create Makefile.in -*- Makefile -*-
-SUBDIRS = check sanity
+## FIXME: Revamp (see Olena 0.10's test suite).
-# FIXME: Revamp (see Olena 0.10's test suite).
-
-AM_CPPFLAGS = \
- -I$(srcdir)/check \
- -I$(top_srcdir)/olena -I$(top_srcdir)/extended \
- -I$(top_srcdir)/static -I$(top_srcdir)/metalic \
- -DOLN_IMG_DIR=\"$(top_srcdir)/olena/img\"
-
-# FIXME: Add
-#
-# AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_DEBUG)
-#
-# when oln.m4 is available in the distribution.
-# Meanwhile, alter CXXFLAGS to turn off any optimization (Automake will
-# warn against this, but that's OK).
-TESTS_CXXFLAGS = @TESTS_CXXFLAGS@
-CXXFLAGS += $(TESTS_CXXFLAGS)
+SUBDIRS = check sanity core value io morphers algorithms
noinst_HEADERS = data.hh
-
-check_PROGRAMS = \
- dpoint2d \
- point2d \
- grid \
- image_entry \
- image1d \
- image2d \
- image3d \
- npoints \
- window2d \
- \
- at \
- \
- grey \
- io_pnm \
- \
- identity_morpher \
- add_neighborhood_morpher \
- value_cast \
- morphers \
- \
- fill
-
-# Images and auxiliary structures.
-dpoint2d_SOURCES = dpoint2d.cc
-point2d_SOURCES = point2d.cc
-grid_SOURCES = grid.cc
-image_entry_SOURCES = image_entry.cc
-image1d_SOURCES = image1d.cc
-image2d_SOURCES = image2d.cc
-image3d_SOURCES = image3d.cc
-npoints_SOURCES = npoints.cc
-window2d_SOURCES = window2d.cc
-
-# Methods.
-at_SOURCES = at.cc
-
-# I/O.
-io_pnm_SOURCES = io_pnm.cc
-
-# Value.
-grey_SOURCES = grey.cc
-
-# Morphers.
-identity_morpher_SOURCES = identity_morpher.cc
-add_neighborhood_morpher_SOURCES = add_neighborhood_morpher.cc
-value_cast_SOURCES = value_cast.cc
-morphers_SOURCES = morphers.cc
-
-# Algorithms.
-fill_SOURCES = fill.cc
-
-
-TESTS = $(check_PROGRAMS)
Index: tests/algorithms/Makefile.am
--- tests/algorithms/Makefile.am (revision 0)
+++ tests/algorithms/Makefile.am (revision 0)
@@ -0,0 +1,32 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+## FIXME: Don't forget to split olena/tests/algorithms to several
+## directories when the stock of algorithms grows (olena/tests/level,
+## olena/tests/morpho, etc.).
+
+## FIXME: Revamp (see Olena 0.10's test suite).
+
+AM_CPPFLAGS = \
+ -I$(srcdir)/.. -I$(srcdir)/../check \
+ -I$(top_srcdir)/olena -I$(top_srcdir)/extended \
+ -I$(top_srcdir)/static -I$(top_srcdir)/metalic \
+ -DOLN_IMG_DIR=\"$(top_srcdir)/olena/img\"
+
+# FIXME: Add
+#
+# AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_DEBUG)
+#
+# when oln.m4 is available in the distribution.
+# Meanwhile, alter CXXFLAGS to turn off any optimization (Automake will
+# warn against this, but that's OK).
+TESTS_CXXFLAGS = @TESTS_CXXFLAGS@
+CXXFLAGS += $(TESTS_CXXFLAGS)
+
+check_PROGRAMS = \
+ fill
+
+# Algorithms.
+fill_SOURCES = fill.cc
+
+
+TESTS = $(check_PROGRAMS)
Index: tests/value/Makefile.am
--- tests/value/Makefile.am (revision 0)
+++ tests/value/Makefile.am (revision 0)
@@ -0,0 +1,28 @@
+## Process this file through Automake to create Makefile.in -*- Makefile -*-
+
+## FIXME: Revamp (see Olena 0.10's test suite).
+
+AM_CPPFLAGS = \
+ -I$(srcdir)/.. -I$(srcdir)/../check \
+ -I$(top_srcdir)/olena -I$(top_srcdir)/extended \
+ -I$(top_srcdir)/static -I$(top_srcdir)/metalic \
+ -DOLN_IMG_DIR=\"$(top_srcdir)/olena/img\"
+
+# FIXME: Add
+#
+# AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_DEBUG)
+#
+# when oln.m4 is available in the distribution.
+# Meanwhile, alter CXXFLAGS to turn off any optimization (Automake will
+# warn against this, but that's OK).
+TESTS_CXXFLAGS = @TESTS_CXXFLAGS@
+CXXFLAGS += $(TESTS_CXXFLAGS)
+
+check_PROGRAMS = \
+ grey
+
+# Value.
+grey_SOURCES = grey.cc
+
+
+TESTS = $(check_PROGRAMS)
Index: oln/Makefile.am
--- oln/Makefile.am (revision 653)
+++ oln/Makefile.am (working copy)
@@ -88,7 +88,7 @@
core/automatic/image/image1d.hh \
core/automatic/image/image2d.hh \
core/automatic/image/image3d.hh \
- core/automatic/image/image_being_mutable.hh \
+ core/automatic/image/mutable_image.hh \
core/automatic/image/image_being_random_accessible.hh \
core/automatic/image/image_having_neighborhood.hh \
core/automatic/image/image_having_neighborhood.hh \
1
0
653: Add basic function to remove '*', '&', "const", and "[]" from types.
by Thierry GERAUD 17 Oct '06
by Thierry GERAUD 17 Oct '06
17 Oct '06
2006-10-17 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add basic function to remove '*', '&', "const", and "[]" from
types.
* mlc/basic.hh: New.
* mlc/is_a.hh (mlc_is_a, mlc_is_a_): Use basic_ for T.
(mlc_is_not_a, mlc_is_not_a_): Likewise.
Index: mlc/basic.hh
===================================================================
--- mlc/basic.hh (revision 0)
+++ mlc/basic.hh (revision 653)
@@ -0,0 +1,78 @@
+// Copyright (C) 2001, 2002, 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 MLC_BASIC_HH
+# define MLC_BASIC_HH
+
+
+/** \def mlc_basic(Type)
+ ** \brief Remove '*', '&', "const", and "[]" from \a Type.
+ **
+ */
+# define mlc_basic(Type) typename mlc::basic_< Type >::ret
+/// Likewise, without the leading \c typename keyword.
+# define mlc_basic_(Type) mlc::basic_< Type >::ret
+
+
+
+namespace mlc
+{
+
+ template <typename T>
+ struct basic_
+ {
+ typedef T ret;
+ };
+
+ template <typename T>
+ struct basic_ < T* >
+ {
+ typedef typename basic_<T>::ret ret;
+ };
+
+ template <typename T>
+ struct basic_< T& >
+ {
+ typedef typename basic_<T>::ret ret;
+ };
+
+ template <typename T>
+ struct basic_< const T >
+ {
+ typedef typename basic_<T>::ret ret;
+ };
+
+ template <typename T>
+ struct basic_< T[] >
+ {
+ typedef typename basic_<T>::ret ret;
+ };
+
+} // end of namespace mlc
+
+
+#endif // ! MLC_BASIC_HH
Index: mlc/is_a.hh
===================================================================
--- mlc/is_a.hh (revision 652)
+++ mlc/is_a.hh (revision 653)
@@ -31,6 +31,7 @@
# include <mlc/bool.hh>
# include <mlc/bexpr.hh>
# include <mlc/wrap.hh>
+# include <mlc/basic.hh>
// private macro so do _not_ use it
@@ -202,7 +203,6 @@
{};
};
-
} // end of namespace mlc
@@ -238,13 +238,13 @@
** template < template < class, class > class > class
*/
-# define mlc_is_a(T, U) \
-mlc::wrap_< \
- typename mlc::is_a_< sizeof(mlc::form::of< U >()) >::template ret< T, U > \
+# define mlc_is_a(T, U) \
+mlc::wrap_< \
+ typename mlc::is_a_< sizeof(mlc::form::of< U >()) >::template ret< typename mlc::basic_<T>::ret, U > \
>
# define mlc_is_a_(T, U) \
-mlc::is_a_< sizeof(mlc::form::of< U >()) >::ret< T, U >
+mlc::is_a_< sizeof(mlc::form::of< U >()) >::ret< mlc::basic_<T>::ret, U >
/*! \def mlc_is_not_a(T, U)
@@ -255,13 +255,13 @@
** \see mlc_is_a(T, U)
*/
-# define mlc_is_not_a(T, U) \
-mlc::not_< \
- typename mlc::is_a_<sizeof(mlc::form::of<U >())>::template ret< T, U > \
+# define mlc_is_not_a(T, U) \
+mlc::not_< \
+ typename mlc::is_a_<sizeof(mlc::form::of<U >())>::template ret< typename mlc::basic_<T>::ret, U > \
>
# define mlc_is_not_a_(T, U) \
-mlc::not_< mlc::is_a_< sizeof(mlc::form::of<U >())>::ret< T, U > >
+mlc::not_< mlc::is_a_< sizeof(mlc::form::of<U >())>::ret< mlc::basic_<T>::ret, U > >
#endif // ! MLC_IS_A_HH
1
0
17 Oct '06
2006-10-17 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Replace the 'is_mutable' property by checking the 'lvalue' type.
* oln/core/automatic/image/image_being_mutable.hh: Rename as...
* oln/core/automatic/image/mutable_image.hh: ...this.
(image_being_mutable): Rename as...
(mutable_image): ...this.
* oln/level/fill.hh: Update.
* oln/core/typedefs.hh (is_mutable_type): Remove; obsolete.
* oln/core/abstract/image/mutability/hierarchy.hh
(include) : Update.
(image_being_mutable): Rename as...
(mutable_image): ...this.
(case_): Rely now on mlc_is_ok(oln_lvalue(E)).
* oln/core/1d/image1d.hh: Update.
* oln/core/2d/image2d.hh: Update.
* oln/core/3d/image3d.hh: Update.
* oln/core/gen/mapimage.hh: Update.
* oln/morpher/value_cast.hh: Update.
* oln/morpher/thru_fun.hh: Update.
* oln/morpher/internal/image_value_morpher.hh: Update.
Index: oln/level/fill.hh
===================================================================
--- oln/level/fill.hh (revision 651)
+++ oln/level/fill.hh (working copy)
@@ -34,7 +34,7 @@
# include <oln/core/abstract/image.hh>
# include <oln/core/abstract/iterator.hh>
-# include <oln/core/automatic/image/image_being_mutable.hh>
+# include <oln/core/automatic/image/mutable_image.hh>
namespace oln
@@ -50,7 +50,7 @@
/// Fwd decl.
template <typename I>
- void fill(abstract::image<I>& input, const oln_type_of(I, value)& val);
+ void fill(abstract::mutable_image<I>& input, const oln_value(I)& val);
# ifndef OLN_INCLUDE_ONLY
@@ -60,10 +60,9 @@
/// Generic version.
template <typename I>
- void fill(abstract::image_being_mutable<I>& input,
- const oln_type_of(I, value)& val)
+ void fill(abstract::mutable_image<I>& input, const oln_value(I)& val)
{
- oln_type_of(I, piter) p(input.topo());
+ oln_piter(I) p(input.topo());
for_all(p)
input(p) = val;
}
@@ -73,14 +72,8 @@
/// Facade.
template <typename I>
- void fill(abstract::image<I>& input, const oln_value(I)& val)
+ void fill(abstract::mutable_image<I>& input, const oln_value(I)& val)
{
- // Precondition.
- mlc::assert_<
- mlc_is_a(I, abstract::image_being_mutable),
- ERROR::FIRST_ARGUMENT_OF_oln_level_fill_IS_NOT_MUTABLE
- >::check();
-
impl::fill(input.exact(), val);
}
Index: oln/core/typedefs.hh
===================================================================
--- oln/core/typedefs.hh (revision 651)
+++ oln/core/typedefs.hh (working copy)
@@ -127,7 +127,6 @@
mlc_decl_typedef(value_type);
mlc_decl_typedef(rvalue_type);
mlc_decl_typedef(lvalue_type);
- mlc_decl_typedef(is_mutable_type);
// --------------------------------------------------------------------
// FIXME: To be enabled later.
Index: oln/core/automatic/image/mutable_image.hh
===================================================================
--- oln/core/automatic/image/mutable_image.hh (revision 650)
+++ oln/core/automatic/image/mutable_image.hh (working copy)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef OLN_CORE_AUTOMATIC_IMAGE_IMAGE_BEING_MUTABLE_HH
-# define OLN_CORE_AUTOMATIC_IMAGE_IMAGE_BEING_MUTABLE_HH
+#ifndef OLN_CORE_AUTOMATIC_IMAGE_MUTABLE_IMAGE_HH
+# define OLN_CORE_AUTOMATIC_IMAGE_MUTABLE_IMAGE_HH
# include <oln/core/automatic/impl.hh>
# include <oln/morpher/tags.hh>
@@ -37,7 +37,7 @@
// Forward declaration.
namespace abstract
{
- template <typename E> class image_being_mutable;
+ template <typename E> class mutable_image;
} // end of namespace oln::abstract
@@ -45,9 +45,9 @@
namespace automatic
{
/// Implementation corresponding to the interface
- /// oln::abstract::image_being_mutable for an identity morpher.
+ /// oln::abstract::mutable_image for an identity morpher.
template <typename E>
- class set_impl<abstract::image_being_mutable, morpher::tag::identity, E> :
+ class set_impl<abstract::mutable_image, morpher::tag::identity, E> :
public virtual stc::any__simple<E>
{
public:
@@ -59,7 +59,7 @@
template <typename E>
oln_lvalue(E)
- set_impl<abstract::image_being_mutable, morpher::tag::identity, E>
+ set_impl<abstract::mutable_image, morpher::tag::identity, E>
::impl_op_readwrite(const oln_psite(E)& p)
{
return this->exact().delegate().operator()(p);
@@ -71,4 +71,4 @@
} // end of namespace oln
-#endif // ! OLN_CORE_AUTOMATIC_IMAGE_IMAGE_BEING_MUTABLE_HH
+#endif // ! OLN_CORE_AUTOMATIC_IMAGE_MUTABLE_IMAGE_HH
Index: oln/core/automatic/image/image_being_mutable.hh
===================================================================
--- oln/core/automatic/image/image_being_mutable.hh (revision 651)
+++ oln/core/automatic/image/image_being_mutable.hh (working copy)
@@ -1,74 +0,0 @@
-// 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_AUTOMATIC_IMAGE_IMAGE_BEING_MUTABLE_HH
-# define OLN_CORE_AUTOMATIC_IMAGE_IMAGE_BEING_MUTABLE_HH
-
-# include <oln/core/automatic/impl.hh>
-# include <oln/morpher/tags.hh>
-
-
-namespace oln
-{
- // Forward declaration.
- namespace abstract
- {
- template <typename E> class image_being_mutable;
-
- } // end of namespace oln::abstract
-
-
- namespace automatic
- {
- /// Implementation corresponding to the interface
- /// oln::abstract::image_being_mutable for an identity morpher.
- template <typename E>
- class set_impl<abstract::image_being_mutable, morpher::tag::identity, E> :
- public virtual stc::any__simple<E>
- {
- public:
- /// Accessor delegation.
- oln_lvalue(E) impl_op_readwrite(const oln_psite(E)& p);
- };
-
-# ifndef OLN_INCLUDE_ONLY
-
- template <typename E>
- oln_lvalue(E)
- set_impl<abstract::image_being_mutable, morpher::tag::identity, E>
- ::impl_op_readwrite(const oln_psite(E)& p)
- {
- return this->exact().delegate().operator()(p);
- }
-
-# endif
-
- } // end of namespace oln::automatic
-
-} // end of namespace oln
-
-#endif // ! OLN_CORE_AUTOMATIC_IMAGE_IMAGE_BEING_MUTABLE_HH
Index: oln/core/abstract/image/mutability/hierarchy.hh
===================================================================
--- oln/core/abstract/image/mutability/hierarchy.hh (revision 651)
+++ oln/core/abstract/image/mutability/hierarchy.hh (working copy)
@@ -30,7 +30,7 @@
# include <oln/core/abstract/image.hh>
# include <oln/core/abstract/image/hierarchies.hh>
-# include <oln/core/automatic/image/image_being_mutable.hh>
+# include <oln/core/automatic/image/mutable_image.hh>
@@ -46,15 +46,10 @@
/// Image being mutable.
template <typename E>
- struct image_being_mutable :
+ struct mutable_image :
public virtual image<E>,
- public automatic::get_impl<image_being_mutable, E>
+ public automatic::get_impl<mutable_image, E>
{
- private:
-
- typedef oln_type_of(E, lvalue) lvalue_t;
- typedef oln_type_of(E, psite) psite_t;
-
public:
struct decl
@@ -68,15 +63,15 @@
using image<E>::operator();
- lvalue_t operator()(const psite_t& p);
+ oln_lvalue(E) operator()(const oln_psite(E)& p);
protected:
/// Constructor (protected, empty).
- image_being_mutable();
+ mutable_image();
/// Destructor (protected).
- ~image_being_mutable();
+ ~mutable_image();
};
@@ -84,19 +79,19 @@
# ifndef OLN_INCLUDE_ONLY
template <typename E>
- typename image_being_mutable<E>::lvalue_t
- image_being_mutable<E>::operator()(const typename image_being_mutable<E>::psite_t& p)
+ oln_lvalue(E)
+ mutable_image<E>::operator()(const oln_psite(E)& p)
{
return this->exact().impl_op_readwrite(p);
}
template <typename E>
- image_being_mutable<E>::image_being_mutable()
+ mutable_image<E>::mutable_image()
{
}
template <typename E>
- image_being_mutable<E>::~image_being_mutable()
+ mutable_image<E>::~mutable_image()
{
decl();
}
@@ -113,9 +108,9 @@
/// With mutability.
template <typename E>
struct case_< image_hierarchy_wrt_mutability, E, 1 > :
- where_< mlc::eq_< oln_type_of(E, is_mutable), mlc::true_ > >
+ where_< mlc_is_ok(oln_lvalue(E)) >
{
- typedef abstract::image_being_mutable<E> ret;
+ typedef abstract::mutable_image<E> ret;
};
} // end of namespace oln
Index: oln/core/1d/image1d.hh
===================================================================
--- oln/core/1d/image1d.hh (revision 651)
+++ oln/core/1d/image1d.hh (working copy)
@@ -61,7 +61,6 @@
typedef mlc::false_ is_computed_type;
typedef T value_type;
typedef T& lvalue_type;
- typedef mlc::true_ is_mutable_type;
typedef image1d<T> real_type;
};
Index: oln/core/2d/image2d.hh
===================================================================
--- oln/core/2d/image2d.hh (revision 651)
+++ oln/core/2d/image2d.hh (working copy)
@@ -61,7 +61,6 @@
typedef mlc::false_ is_computed_type;
typedef T value_type;
typedef T& lvalue_type;
- typedef mlc::true_ is_mutable_type;
typedef image2d<T> real_type;
};
Index: oln/core/3d/image3d.hh
===================================================================
--- oln/core/3d/image3d.hh (revision 651)
+++ oln/core/3d/image3d.hh (working copy)
@@ -61,7 +61,6 @@
typedef mlc::false_ is_computed_type;
typedef T value_type;
typedef T& lvalue_type;
- typedef mlc::true_ is_mutable_type;
typedef image3d<T> real_type;
};
Index: oln/core/gen/mapimage.hh
===================================================================
--- oln/core/gen/mapimage.hh (revision 651)
+++ oln/core/gen/mapimage.hh (working copy)
@@ -57,8 +57,6 @@
typedef mlc::false_ is_computed_type;
typedef value_t value_type;
-
- typedef mlc::true_ is_mutable_type;
typedef value_t& lvalue_type;
typedef void real_type; // FIXME
Index: oln/morpher/value_cast.hh
===================================================================
--- oln/morpher/value_cast.hh (revision 651)
+++ oln/morpher/value_cast.hh (working copy)
@@ -59,7 +59,6 @@
{
typedef mlc::true_ is_computed_type;
typedef Value value_type;
- typedef mlc::false_ is_mutable_type;
};
template <typename Image, typename Value>
Index: oln/morpher/thru_fun.hh
===================================================================
--- oln/morpher/thru_fun.hh (revision 651)
+++ oln/morpher/thru_fun.hh (working copy)
@@ -62,7 +62,6 @@
public:
typedef mlc::true_ is_computed_type;
typedef xtd_res_1(Fun, old_value_type) value_type;
- typedef mlc::false_ is_mutable_type;
};
Index: oln/morpher/internal/image_value_morpher.hh
===================================================================
--- oln/morpher/internal/image_value_morpher.hh (revision 651)
+++ oln/morpher/internal/image_value_morpher.hh (working copy)
@@ -68,7 +68,6 @@
typedef mlc::undefined is_computed_type;
typedef mlc::undefined lvalue_type;
typedef mlc::undefined value_type;
- typedef mlc::undefined is_mutable_type;
};
template <typename Image, typename Exact>
1
0
2006-10-17 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add computability image hierarchy.
* oln/core/abstract/image/computability: New.
* oln/core/abstract/image/computability/hierarchy.hh: New.
* oln/core/typedefs.hh (is_computed_type): New.
* oln/core/image_entry.hh (is_computed_type): New in vtypes.
* oln/core/abstract/image.hh (decl): Update.
* oln/core/abstract/image/hierarchies.hh
(image_hierarchy_wrt_computability): New.
(hierarchy): Update ids.
* oln/core/abstract/image/all.hh
(include): Add computability/hierarchy.hh.
* oln/core/1d/image1d.hh: Update.
* oln/core/2d/image2d.hh: Likewise.
* oln/core/3d/image3d.hh: Likewise.
* oln/core/gen/mapimage.hh: Likewise.
* oln/morpher/value_cast.hh: Likewise.
* oln/morpher/thru_fun.hh: Likewise.
* oln/morpher/internal/image_value_morpher.hh: Likewise.
Index: oln/core/typedefs.hh
===================================================================
--- oln/core/typedefs.hh (revision 649)
+++ oln/core/typedefs.hh (working copy)
@@ -123,6 +123,7 @@
// --------------------------------------------------------------------
// mlc_decl_typedef(data_type);
// --------------------------------------------------------------------
+ mlc_decl_typedef(is_computed_type);
mlc_decl_typedef(value_type);
mlc_decl_typedef(rvalue_type);
mlc_decl_typedef(lvalue_type);
Index: oln/core/image_entry.hh
===================================================================
--- oln/core/image_entry.hh (revision 649)
+++ oln/core/image_entry.hh (working copy)
@@ -71,6 +71,8 @@
// psite_type: see below.
typedef mlc::undefined point_type;
+
+ typedef mlc::undefined is_computed_type;
typedef mlc::undefined value_type;
// rvalue_type: see below.
Index: oln/core/abstract/image.hh
===================================================================
--- oln/core/abstract/image.hh (revision 649)
+++ oln/core/abstract/image.hh (working copy)
@@ -75,6 +75,8 @@
// // oln_virtual_typedef(fwd_piter);
// // oln_virtual_typedef(bkd_piter);
+ oln_virtual_typedef(is_computed);
+
// oln_virtual_typedef(value);
// oln_virtual_typedef(rvalue);
Index: oln/core/abstract/image/hierarchies.hh
===================================================================
--- oln/core/abstract/image/hierarchies.hh (revision 649)
+++ oln/core/abstract/image/hierarchies.hh (working copy)
@@ -40,13 +40,14 @@
typedef hierarchy<abstract::image, 4> image_hierarchy_wrt_bbox;
typedef hierarchy<abstract::image, 5> image_hierarchy_wrt_accessibility;
typedef hierarchy<abstract::image, 6> image_hierarchy_wrt_mutability;
+ typedef hierarchy<abstract::image, 7> image_hierarchy_wrt_computability;
- typedef hierarchy<abstract::image, 7> image_hybrid_hierarchy_wrt_classical;
+ typedef hierarchy<abstract::image, 8> image_hybrid_hierarchy_wrt_classical;
// FIXME: To be continued.
#if 0
- typedef hierarchy<abstract::image, 8> image_hierarchy_wrt_value;
- typedef hierarchy<abstract::image, 9> image_hierarchy_wrt_data_retrieval;
+ typedef hierarchy<abstract::image, 9> image_hierarchy_wrt_value;
+ typedef hierarchy<abstract::image, 10> image_hierarchy_wrt_data_retrieval;
// ...
#endif
Index: oln/core/abstract/image/computability/hierarchy.hh
===================================================================
--- oln/core/abstract/image/computability/hierarchy.hh (revision 0)
+++ oln/core/abstract/image/computability/hierarchy.hh (revision 0)
@@ -0,0 +1,111 @@
+// 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_ABSTRACT_IMAGE_COMPUTABILITY_HIERARCHY_HH
+# define OLN_CORE_ABSTRACT_IMAGE_COMPUTABILITY_HIERARCHY_HH
+
+# include <oln/core/abstract/image.hh>
+# include <oln/core/abstract/image/hierarchies.hh>
+// # include <oln/core/automatic/image/computed_image.hh>
+// # include <oln/core/automatic/image/plain_image.hh>
+
+
+
+namespace oln
+{
+
+ /*--------------.
+ | Abstraction. |
+ `---------------*/
+
+ namespace abstract
+ {
+
+ /// Image whose data are computed.
+ template <typename E>
+ struct computed_image :
+ public virtual image<E> //, public automatic::get_impl< computed_image, E>
+ {
+ protected:
+
+ /// Constructor (protected, empty).
+ computed_image();
+ };
+
+
+ /// Image whose data are *not* computed so they are *plain*.
+ template <typename E>
+ struct plain_image :
+ public virtual image<E> //, public automatic::get_impl< plain_image, E>
+ {
+ protected:
+
+ /// Constructor (protected, empty).
+ plain_image();
+ };
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename E>
+ computed_image<E>::computed_image()
+ {
+ }
+
+ template <typename E>
+ plain_image<E>::plain_image()
+ {
+ }
+
+# endif
+
+ } // end of namespace oln::abstract
+
+
+ /*--------------------.
+ | Computability switch. |
+ `--------------------*/
+
+ /// With computability.
+ template <typename E>
+ struct case_< image_hierarchy_wrt_computability, E, 1 > :
+ where_< mlc::eq_< oln_type_of(E, is_computed), mlc::true_ > >
+ {
+ typedef abstract::computed_image<E> ret;
+ };
+
+ template <typename E>
+ struct case_< image_hierarchy_wrt_computability, E, 2 > :
+ where_< mlc::eq_< oln_type_of(E, is_computed), mlc::false_ > >
+ {
+ typedef abstract::plain_image<E> ret;
+ };
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_ABSTRACT_IMAGE_COMPUTABILITY_HIERARCHY_HH
Index: oln/core/abstract/image/all.hh
===================================================================
--- oln/core/abstract/image/all.hh (revision 649)
+++ oln/core/abstract/image/all.hh (working copy)
@@ -44,7 +44,10 @@
# include <oln/core/abstract/image/accessibility/hierarchy.hh>
// Hierarchy 6: image w.r.t. data mutability.
# include <oln/core/abstract/image/mutability/hierarchy.hh>
-// Hybrid hierarchy 7: image w.r.t. classical features.
+// Hierarchy 7: image w.r.t. computability.
+# include <oln/core/abstract/image/computability/hierarchy.hh>
+
+// Hybrid hierarchy 8: image w.r.t. classical features.
# include <oln/core/abstract/image/hybrid/classical.hh>
#endif // ! OLN_CORE_ABSTRACT_IMAGE_ALL_HH
Index: oln/core/1d/image1d.hh
===================================================================
--- oln/core/1d/image1d.hh (revision 650)
+++ oln/core/1d/image1d.hh (working copy)
@@ -58,6 +58,7 @@
typedef point1d point_type;
+ typedef mlc::false_ is_computed_type;
typedef T value_type;
typedef T& lvalue_type;
typedef mlc::true_ is_mutable_type;
Index: oln/core/2d/image2d.hh
===================================================================
--- oln/core/2d/image2d.hh (revision 650)
+++ oln/core/2d/image2d.hh (working copy)
@@ -58,6 +58,7 @@
typedef point2d point_type;
+ typedef mlc::false_ is_computed_type;
typedef T value_type;
typedef T& lvalue_type;
typedef mlc::true_ is_mutable_type;
Index: oln/core/3d/image3d.hh
===================================================================
--- oln/core/3d/image3d.hh (revision 650)
+++ oln/core/3d/image3d.hh (working copy)
@@ -58,6 +58,7 @@
typedef point3d point_type;
+ typedef mlc::false_ is_computed_type;
typedef T value_type;
typedef T& lvalue_type;
typedef mlc::true_ is_mutable_type;
Index: oln/core/gen/mapimage.hh
===================================================================
--- oln/core/gen/mapimage.hh (revision 650)
+++ oln/core/gen/mapimage.hh (working copy)
@@ -55,6 +55,7 @@
typedef fwd_piter_bbox_<topo_type> fwd_piter_type;
typedef bkd_piter_bbox_<topo_type> bkd_piter_type;
+ typedef mlc::false_ is_computed_type;
typedef value_t value_type;
typedef mlc::true_ is_mutable_type;
Index: oln/morpher/value_cast.hh
===================================================================
--- oln/morpher/value_cast.hh (revision 649)
+++ oln/morpher/value_cast.hh (working copy)
@@ -57,6 +57,7 @@
template <typename Image, typename Value>
struct vtypes< morpher::value_cast<Image, Value> >
{
+ typedef mlc::true_ is_computed_type;
typedef Value value_type;
typedef mlc::false_ is_mutable_type;
};
Index: oln/morpher/thru_fun.hh
===================================================================
--- oln/morpher/thru_fun.hh (revision 649)
+++ oln/morpher/thru_fun.hh (working copy)
@@ -59,7 +59,8 @@
{
private:
typedef oln_type_of(Image, rvalue) old_value_type;
- public:
+ public:
+ typedef mlc::true_ is_computed_type;
typedef xtd_res_1(Fun, old_value_type) value_type;
typedef mlc::false_ is_mutable_type;
};
Index: oln/morpher/internal/image_value_morpher.hh
===================================================================
--- oln/morpher/internal/image_value_morpher.hh (revision 649)
+++ oln/morpher/internal/image_value_morpher.hh (working copy)
@@ -64,8 +64,11 @@
{
// Morpher type.
typedef oln::morpher::tag::identity morpher_type; // FIXME: Wrong!
+
+ typedef mlc::undefined is_computed_type;
typedef mlc::undefined lvalue_type;
typedef mlc::undefined value_type;
+ typedef mlc::undefined is_mutable_type;
};
template <typename Image, typename Exact>
1
0
2006-10-17 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Adjust lvalue so that it handles a '&' when needed.
* oln/core/automatic/image/image1d.hh (impl_at): Adjust.
* oln/core/automatic/image/image2d.hh: Likewise.
* oln/core/automatic/image/image3d.hh: Likewise.
* oln/core/automatic/image/image_being_mutable.hh: Likewise.
* oln/core/abstract/image/mutability/hierarchy.hh: Likewise.
* oln/core/abstract/image/dimension/1d.hh: Likewise.
* oln/core/abstract/image/dimension/2d.hh: Likewise.
* oln/core/abstract/image/dimension/3d.hh: Likewise.
* oln/core/1d/image1d.hh: Likewise.
* oln/core/2d/image2d.hh: Likewise.
* oln/core/3d/image3d.hh: Likewise.
* oln/core/gen/mapimage.hh: Likewise.
* oln/core/abstract/image/type/integre.hh: Fix case number wrt
those defined in hierarchy.hh.
Index: oln/core/automatic/image/image1d.hh
===================================================================
--- oln/core/automatic/image/image1d.hh (revision 649)
+++ oln/core/automatic/image/image1d.hh (working copy)
@@ -58,7 +58,7 @@
oln_rvalue(E) impl_at(const oln_coord(E)& index) const;
// FIXME: Hack.
- oln_lvalue(E)& impl_at(const oln_coord(E)& index);
+ oln_lvalue(E) impl_at(const oln_coord(E)& index);
bool impl_has_at(const oln_coord(E)& index) const;
};
@@ -76,7 +76,7 @@
oln_rvalue(E) impl_at(const oln_coord(E)& index) const;
// FIXME: Hack.
- oln_lvalue(E)& impl_at(const oln_coord(E)& index);
+ oln_lvalue(E) impl_at(const oln_coord(E)& index);
bool impl_has_at(const oln_coord(E)& index) const;
};
@@ -98,7 +98,7 @@
}
template <typename E, typename tag>
- oln_lvalue(E)&
+ oln_lvalue(E)
set_impl<abstract::image1d, tag, E>
::impl_at(const oln_coord(E)& index)
{
@@ -127,7 +127,7 @@
}
template <typename E>
- oln_lvalue(E)&
+ oln_lvalue(E)
set_impl<abstract::image1d, morpher::tag::identity, E>
::impl_at(const oln_coord(E)& index)
{
Index: oln/core/automatic/image/image2d.hh
===================================================================
--- oln/core/automatic/image/image2d.hh (revision 649)
+++ oln/core/automatic/image/image2d.hh (working copy)
@@ -58,7 +58,7 @@
oln_rvalue(E) impl_at(const oln_coord(E)& row, const oln_coord(E)& col) const;
// FIXME: Hack.
- oln_lvalue(E)& impl_at(const oln_coord(E)& row, const oln_coord(E)& col);
+ oln_lvalue(E) impl_at(const oln_coord(E)& row, const oln_coord(E)& col);
bool impl_has_at(const oln_coord(E)& row, const oln_coord(E)& col) const;
};
@@ -76,7 +76,7 @@
oln_rvalue(E) impl_at(const oln_coord(E)& row, const oln_coord(E)& col) const;
// FIXME: Hack.
- oln_lvalue(E)& impl_at(const oln_coord(E)& row, const oln_coord(E)& col);
+ oln_lvalue(E) impl_at(const oln_coord(E)& row, const oln_coord(E)& col);
bool impl_has_at(const oln_coord(E)& row, const oln_coord(E)& col) const;
};
@@ -98,7 +98,7 @@
}
template <typename E, typename tag>
- oln_lvalue(E)&
+ oln_lvalue(E)
set_impl<abstract::image2d, tag, E>
::impl_at(const oln_coord(E)& row, const oln_coord(E)& col)
{
@@ -127,7 +127,7 @@
}
template <typename E>
- oln_lvalue(E)&
+ oln_lvalue(E)
set_impl<abstract::image2d, morpher::tag::identity, E>
::impl_at(const oln_coord(E)& row, const oln_coord(E)& col)
{
Index: oln/core/automatic/image/image3d.hh
===================================================================
--- oln/core/automatic/image/image3d.hh (revision 649)
+++ oln/core/automatic/image/image3d.hh (working copy)
@@ -60,9 +60,9 @@
const oln_coord(E)& col) const;
// FIXME: Hack.
- oln_lvalue(E)& impl_at(const oln_coord(E)& slice,
- const oln_coord(E)& row,
- const oln_coord(E)& col);
+ oln_lvalue(E) impl_at(const oln_coord(E)& slice,
+ const oln_coord(E)& row,
+ const oln_coord(E)& col);
bool impl_has_at(const oln_coord(E)& slice,
const oln_coord(E)& row,
const oln_coord(E)& col) const;
@@ -84,9 +84,9 @@
const oln_coord(E)& col) const;
// FIXME: Hack.
- oln_lvalue(E)& impl_at(const oln_coord(E)& slice,
- const oln_coord(E)& row,
- const oln_coord(E)& col);
+ oln_lvalue(E) impl_at(const oln_coord(E)& slice,
+ const oln_coord(E)& row,
+ const oln_coord(E)& col);
bool impl_has_at(const oln_coord(E)& slice,
const oln_coord(E)& row,
const oln_coord(E)& col) const;
@@ -112,7 +112,7 @@
}
template <typename E, typename tag>
- oln_lvalue(E)&
+ oln_lvalue(E)
set_impl<abstract::image3d, tag, E>
::impl_at(const oln_coord(E)& slice,
const oln_coord(E)& row,
@@ -147,7 +147,7 @@
}
template <typename E>
- oln_lvalue(E)&
+ oln_lvalue(E)
set_impl<abstract::image3d, morpher::tag::identity, E>
::impl_at(const oln_coord(E)& slice,
const oln_coord(E)& row,
Index: oln/core/automatic/image/image_being_mutable.hh
===================================================================
--- oln/core/automatic/image/image_being_mutable.hh (revision 649)
+++ oln/core/automatic/image/image_being_mutable.hh (working copy)
@@ -52,13 +52,13 @@
{
public:
/// Accessor delegation.
- oln_lvalue(E)& impl_op_readwrite(const oln_psite(E)& p);
+ oln_lvalue(E) impl_op_readwrite(const oln_psite(E)& p);
};
# ifndef OLN_INCLUDE_ONLY
template <typename E>
- oln_lvalue(E)&
+ oln_lvalue(E)
set_impl<abstract::image_being_mutable, morpher::tag::identity, E>
::impl_op_readwrite(const oln_psite(E)& p)
{
Index: oln/core/abstract/image/type/integre.hh
===================================================================
--- oln/core/abstract/image/type/integre.hh (revision 649)
+++ oln/core/abstract/image/type/integre.hh (working copy)
@@ -96,7 +96,7 @@
/// Binary case.
template <typename E>
- struct case_< image_hierarchy_wrt_type, E, 3 > :
+ struct case_< image_hierarchy_wrt_type, E, 5 > :
where_< mlc::or_list_< mlc::eq_<oln_type_of(E, value), ntg::bin>,
ntg::eq_<ntg::int_u, 1, oln_type_of(E, value)>,
ntg::eq_<ntg::int_s, 1, oln_type_of(E, value)> > >
@@ -107,7 +107,7 @@
/// Grey-level case.
template <typename E>
- struct case_< image_hierarchy_wrt_type, E, 4 > :
+ struct case_< image_hierarchy_wrt_type, E, 6 > :
where_< mlc_is_a( oln_type_of(E, value), ntg::real_value ) >
{
// Definition of the super class corresponding to this case
@@ -118,7 +118,7 @@
/// Label case.
template <typename E>
- struct case_< image_hierarchy_wrt_type, E, 5 > :
+ struct case_< image_hierarchy_wrt_type, E, 7 > :
where_< mlc_is_a( oln_type_of(E, value), ntg::enum_value ) >
{
// Definition of the super class corresponding to this case
@@ -129,7 +129,7 @@
/// Color case.
template <typename E>
- struct case_< image_hierarchy_wrt_type, E, 6 > :
+ struct case_< image_hierarchy_wrt_type, E, 8 > :
where_< mlc_is_a( oln_type_of(E, value), ntg::color_value ) >
{
// Definition of the super class corresponding to this case
Index: oln/core/abstract/image/mutability/hierarchy.hh
===================================================================
--- oln/core/abstract/image/mutability/hierarchy.hh (revision 649)
+++ oln/core/abstract/image/mutability/hierarchy.hh (working copy)
@@ -68,7 +68,7 @@
using image<E>::operator();
- lvalue_t& operator()(const psite_t& p);
+ lvalue_t operator()(const psite_t& p);
protected:
@@ -84,7 +84,7 @@
# ifndef OLN_INCLUDE_ONLY
template <typename E>
- typename image_being_mutable<E>::lvalue_t&
+ typename image_being_mutable<E>::lvalue_t
image_being_mutable<E>::operator()(const typename image_being_mutable<E>::psite_t& p)
{
return this->exact().impl_op_readwrite(p);
Index: oln/core/abstract/image/dimension/1d.hh
===================================================================
--- oln/core/abstract/image/dimension/1d.hh (revision 649)
+++ oln/core/abstract/image/dimension/1d.hh (working copy)
@@ -49,7 +49,7 @@
oln_rvalue(E) at(const oln_coord(E)& index) const;
// FIXME: Hack (should be elsewhere)!
- oln_lvalue(E)& at(const oln_coord(E)& index);
+ oln_lvalue(E) at(const oln_coord(E)& index);
bool has_at(const oln_coord(E)& index) const;
protected:
@@ -73,7 +73,7 @@
}
template <typename E>
- oln_lvalue(E)&
+ oln_lvalue(E)
image1d<E>::at(const oln_coord(E)& index)
{
return this->exact().impl_at(index);
Index: oln/core/abstract/image/dimension/2d.hh
===================================================================
--- oln/core/abstract/image/dimension/2d.hh (revision 649)
+++ oln/core/abstract/image/dimension/2d.hh (working copy)
@@ -49,7 +49,7 @@
oln_rvalue(E) at(const oln_coord(E)& row, const oln_coord(E)& col) const;
// FIXME: Hack (should be elsewhere)!
- oln_lvalue(E)& at(const oln_coord(E)& row, const oln_coord(E)& col);
+ oln_lvalue(E) at(const oln_coord(E)& row, const oln_coord(E)& col);
bool has_at(const oln_coord(E)& row, const oln_coord(E)& col) const;
protected:
@@ -73,7 +73,7 @@
}
template <typename E>
- oln_lvalue(E)&
+ oln_lvalue(E)
image2d<E>::at(const oln_coord(E)& row, const oln_coord(E)& col)
{
return this->exact().impl_at(row, col);
Index: oln/core/abstract/image/dimension/3d.hh
===================================================================
--- oln/core/abstract/image/dimension/3d.hh (revision 649)
+++ oln/core/abstract/image/dimension/3d.hh (working copy)
@@ -51,9 +51,9 @@
const oln_coord(E)& col) const;
// FIXME: Hack (should be elsewhere)!
- oln_lvalue(E)& at(const oln_coord(E)& slice,
- const oln_coord(E)& row,
- const oln_coord(E)& col);
+ oln_lvalue(E) at(const oln_coord(E)& slice,
+ const oln_coord(E)& row,
+ const oln_coord(E)& col);
bool has_at(const oln_coord(E)& slice,
const oln_coord(E)& row,
const oln_coord(E)& col) const;
@@ -81,7 +81,7 @@
}
template <typename E>
- oln_lvalue(E)&
+ oln_lvalue(E)
image3d<E>::at(const oln_coord(E)& slice,
const oln_coord(E)& row,
const oln_coord(E)& col)
Index: oln/core/1d/image1d.hh
===================================================================
--- oln/core/1d/image1d.hh (revision 649)
+++ oln/core/1d/image1d.hh (working copy)
@@ -59,7 +59,7 @@
typedef point1d point_type;
typedef T value_type;
- typedef T lvalue_type;
+ typedef T& lvalue_type;
typedef mlc::true_ is_mutable_type;
typedef image1d<T> real_type;
Index: oln/core/2d/image2d.hh
===================================================================
--- oln/core/2d/image2d.hh (revision 649)
+++ oln/core/2d/image2d.hh (working copy)
@@ -59,7 +59,7 @@
typedef point2d point_type;
typedef T value_type;
- typedef T lvalue_type;
+ typedef T& lvalue_type;
typedef mlc::true_ is_mutable_type;
typedef image2d<T> real_type;
Index: oln/core/3d/image3d.hh
===================================================================
--- oln/core/3d/image3d.hh (revision 649)
+++ oln/core/3d/image3d.hh (working copy)
@@ -59,7 +59,7 @@
typedef point3d point_type;
typedef T value_type;
- typedef T lvalue_type;
+ typedef T& lvalue_type;
typedef mlc::true_ is_mutable_type;
typedef image3d<T> real_type;
Index: oln/core/gen/mapimage.hh
===================================================================
--- oln/core/gen/mapimage.hh (revision 649)
+++ oln/core/gen/mapimage.hh (working copy)
@@ -58,7 +58,7 @@
typedef value_t value_type;
typedef mlc::true_ is_mutable_type;
- typedef value_t lvalue_type;
+ typedef value_t& lvalue_type;
typedef void real_type; // FIXME
};
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Adjust tests.
* tests/window2d.cc: Disable display.
* tests/image_entry.cc, tests/identity_morpher.cc,
* tests/add_neighborhood_morpher.cc, tests/morphers.cc:
Remove mlc_is_a tests w.r.t to oln::abstract::grey_level_image,
since its definition has changed.
add_neighborhood_morpher.cc | 4 ----
identity_morpher.cc | 4 ----
image_entry.cc | 3 ---
morphers.cc | 2 --
window2d.cc | 14 ++++++++++++++
5 files changed, 14 insertions(+), 13 deletions(-)
Index: tests/window2d.cc
--- tests/window2d.cc (revision 648)
+++ tests/window2d.cc (working copy)
@@ -45,10 +45,21 @@
oln_qiter(I) q(p, win);
for_all(p)
{
+#if 0
+ // Disable the display to speed up the test.
std::cout << unsigned(ima(p)) << ": ";
+#endif
for_all(q)
+ {
+#if 0
+ // Likewise.
std::cout << unsigned(ima(q)) << " ";
+#endif
+ }
+#if 0
+ // Likewise.
std::cout << std::endl;
+#endif
}
}
@@ -60,7 +71,10 @@
using namespace oln;
image2d<unsigned char> ima = io::load_pgm(rdata("lena32.pgm"));
+#if 0
+ // Disable the display to speed up the test.
debug::println(ima);
+#endif
window2d win;
win
Index: tests/morphers.cc
--- tests/morphers.cc (revision 648)
+++ tests/morphers.cc (working copy)
@@ -48,8 +48,6 @@
// Sanity check: abstractions realized by oln::image2d.
mlc::assert_< mlc_is_a_(image_t, oln::abstract::image2d) >::check();
- mlc::assert_< mlc_is_a_(image_t,
- oln::abstract::grey_level_image) >::check();
image_t ima(42, 51);
Index: tests/image_entry.cc
--- tests/image_entry.cc (revision 648)
+++ tests/image_entry.cc (working copy)
@@ -94,9 +94,6 @@
// Check its image dimension abstraction.
mlc::assert_< mlc_is_a_(my::image, oln::abstract::image2d) >::check();
- // Check its image type abstraction.
- mlc::assert_< mlc_is_a_(my::image,
- oln::abstract::grey_level_image) >::check();
// Ensure we can instantiate it.
my::image i;
Index: tests/add_neighborhood_morpher.cc
--- tests/add_neighborhood_morpher.cc (revision 648)
+++ tests/add_neighborhood_morpher.cc (working copy)
@@ -46,8 +46,6 @@
// Sanity check: interfaces realized by oln::image2d.
mlc::assert_< mlc_is_a_(image_t, oln::abstract::image2d) >::check();
- mlc::assert_< mlc_is_a_(image_t,
- oln::abstract::grey_level_image) >::check();
image_t ima(42, 51);
@@ -62,8 +60,6 @@
// Check that the instantiated add_neighborhood morpher realizes the
// same interfaces as the underlying morphed image.
mlc::assert_< mlc_is_a_(image_with_nbh_t, oln::abstract::image2d) >::check();
- mlc::assert_< mlc_is_a_(image_with_nbh_t,
- oln::abstract::grey_level_image) >::check();
// Check the type of neighborhood.
mlc::assert_< mlc_eq(oln_type_of_(image_with_nbh_t, neighborhood),
oln::neighb2d) >::check();
Index: tests/identity_morpher.cc
--- tests/identity_morpher.cc (revision 648)
+++ tests/identity_morpher.cc (working copy)
@@ -46,8 +46,6 @@
// Sanity check: interfaces realized by oln::image2d.
mlc::assert_< mlc_is_a_(image_t, oln::abstract::image2d) >::check();
- mlc::assert_< mlc_is_a_(image_t,
- oln::abstract::grey_level_image) >::check();
image_t ima(42, 51);
@@ -61,8 +59,6 @@
// Check that the instantiated identity morpher realizes the same
// interfaces as the underlying morphed image.
mlc::assert_< mlc_is_a_(image_id_t, oln::abstract::image2d) >::check();
- mlc::assert_< mlc_is_a_(image_id_t,
- oln::abstract::grey_level_image) >::check();
image_id_t ima_id(ima);
}
1
0
16 Oct '06
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Polish the accesses to bbox_<point> as a virtual type.
* oln/core/gen/bbox.hh (oln::bbox_::self_t): Rename as...
(oln::bbox_::self_type): ...this.
Make it public.
(oln::bbox_::super_t): Adjust.
* oln/core/gen/topo_lbbox.hh
(vtypes< topo_lbbox_<point> >::bbox_type): Adjust.
* oln/core/gen/topo_bbox.hh (oln::vtypes< topo_lbbox_<point> >):
Define this virtul type using `bbox_<point>::self_t' instead of
just `bbox_<point>' to force the instiantiation of
oln::bbox_<point> at this point.
(oln::topo_bbox_<point>::bbox_t): Use oln_type_of to define it.
bbox.hh | 9 +++++++--
topo_bbox.hh | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
topo_lbbox.hh | 2 +-
3 files changed, 62 insertions(+), 5 deletions(-)
Index: oln/core/gen/bbox.hh
--- oln/core/gen/bbox.hh (revision 647)
+++ oln/core/gen/bbox.hh (working copy)
@@ -72,8 +72,13 @@
class bbox_ : public point_set_entry< bbox_<point_t> >,
private mlc::assert_< mlc_is_a(point_t, abstract::point) >
{
- typedef bbox_<point_t> self_t;
- typedef point_set_entry<self_t> super_t;
+ // Make self_type public so that is can be used to define a
+ // virtual type of oln::topo_bbox_ and oln::topo_lbbox_.
+ public:
+ typedef bbox_<point_t> self_type;
+
+ private:
+ typedef point_set_entry<self_type> super_t;
typedef oln_type_of(point_t, coord) coord_t;
Index: oln/core/gen/topo_bbox.hh
--- oln/core/gen/topo_bbox.hh (revision 647)
+++ oln/core/gen/topo_bbox.hh (working copy)
@@ -52,7 +52,59 @@
template <typename point>
struct vtypes< topo_bbox_<point> >
{
- typedef bbox_<point> bbox_type;
+ /* Trick to force the instantiation of bbox_<point>.
+
+ As bbox_<point> is a template type used to define the `bbox'
+ virtual type of topo_bbox_<point>, it requires some attention
+ regarding its instantiation.
+
+
+ Metalic's mlc_is_a is used by the static hierarchy mechanism of
+ Static. mlc_is_a performs a static typedef introspection,
+ taking advantage of the SFINAE rule. However, there two
+ phenomena seem to happen here (probably due to the very nature
+ of SFINAE):
+
+ 1. the statement `mlc_is_a(B, A)' requires the knowledge of the
+ entire declaration of the inspected class to answer
+ positively if a `B' actually *is a* `A'. If B is a template
+ class, this implies that B must have been instantiated for
+ mlc_is_a to be able to inspect it;
+
+ 2. mlc_is_a does *not* trigger the instantiation of the
+ inspected type (probably to prevent any error, in accordance
+ to the SFINAE rule).
+
+ When a template type is used to define a virtual type, it
+ *must* have been instantiated, because it might be used during
+ the construction of the base classes of the class it belongs
+ to. That is the case of bbox_<point> here.
+
+ So, how one can trigger such an instantiation? We used to
+ address this problem by using explicit template instantiations
+ placed before the definition of the class holding the template
+ type used a virtual type :
+
+ template class bbox_<point1d>;
+ template class bbox_<point2d>;
+ template class bbox_<point3d>;
+
+ And so on. But this is not good w.r.t. software engineering:
+ one must take care of the correct explicit instantiations at
+ the right place, which is error-prone --and the C++ compiler
+ won't produces easily understandable messages!-- and requires a
+ manual addition for each instantiation of the template type
+ potentially used as a definition of a virtual type.
+
+ A better solution is to force the compiler to instantiate the
+ type at the definition site of the virtual type (here, as for
+ bbox_<point>). Such an instantiation can be triggered by
+ requesting the use of a typedef contained within this type. As
+ many template types define a typedef `self_t' to refer to
+ themselves, we use this typename to both trigger the
+ instantiation of bbox_<point>, and to define
+ `vtypes< topo_bbox_<point> >::bbox_type'. */
+ typedef typename bbox_<point>::self_t bbox_type;
typedef point point_type;
typedef mlc::true_ is_random_accessible_type;
};
@@ -66,7 +118,7 @@
{
typedef topo_bbox_<point> self_t;
typedef topology_entry<self_t> super_t;
- typedef bbox_<point> bbox_t;
+ typedef oln_type_of(self_t, bbox) bbox_t;
public:
Index: oln/core/gen/topo_lbbox.hh
--- oln/core/gen/topo_lbbox.hh (revision 647)
+++ oln/core/gen/topo_lbbox.hh (working copy)
@@ -106,7 +106,7 @@
themselves, we use this typename to both trigger the
instantiation of bbox_<point>, and to define
`vtypes< topo_lbbox_<point> >::bbox_type'. */
- typedef typename bbox_<point>::self_t bbox_type;
+ typedef typename bbox_<point>::self_type bbox_type;
typedef point point_type;
typedef mlc::true_ is_random_accessible_type;
};
1
0
2006-10-16 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add value cast image morpher.
* tests/value_cast.cc: New.
* tests/Makefile.am: Update.
* oln/morpher/value_cast.hh: New.
* oln/Makefile.am: Update.
* oln/morpher/internal/image_value_morpher.hh (lvalue): Change
definition mode from single_vtype to vtypes.
Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am (revision 646)
+++ tests/Makefile.am (working copy)
@@ -40,6 +40,7 @@
\
identity_morpher \
add_neighborhood_morpher \
+ value_cast \
morphers \
\
fill
@@ -67,6 +68,7 @@
# Morphers.
identity_morpher_SOURCES = identity_morpher.cc
add_neighborhood_morpher_SOURCES = add_neighborhood_morpher.cc
+value_cast_SOURCES = value_cast.cc
morphers_SOURCES = morphers.cc
# Algorithms.
Index: tests/value_cast.cc
===================================================================
--- tests/value_cast.cc (revision 0)
+++ tests/value_cast.cc (revision 0)
@@ -0,0 +1,85 @@
+// 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.
+
+/// Test oln::value_cast.cc.
+
+#include <iostream>
+
+#include <oln/basics2d.hh>
+#include <oln/value/all.hh>
+#include <oln/morpher/value_cast.hh>
+
+
+template <typename T>
+void print(T)
+{
+ std::cout << "?" << std::endl;
+}
+
+
+void print(int)
+{
+ std::cout << "int" << std::endl;
+}
+
+void print(float)
+{
+ std::cout << "float" << std::endl;
+}
+
+void print(unsigned char)
+{
+ std::cout << "unsigned char" << std::endl;
+}
+
+
+
+
+int main()
+{
+ using namespace oln;
+
+ using oln::value::gl8;
+
+ point2d p(0,0);
+
+ {
+ image2d<int> ima(1,1);
+ print( value_cast<float>(ima)(p) );
+ }
+
+ {
+ image2d<bool> ima(1,1);
+ print( value_cast<int>(ima)(p) );
+ }
+
+ {
+ image2d<gl8> ima(1,1);
+ print( value_cast<unsigned char>(ima)(p) );
+ }
+
+}
Index: oln/Makefile.am
===================================================================
--- oln/Makefile.am (revision 646)
+++ oln/Makefile.am (working copy)
@@ -151,6 +151,7 @@
morpher/identity.hh \
morpher/tags.hh \
morpher/thru_fun.hh \
+ morpher/value_cast.hh \
\
value/all.hh \
value/default.hh \
Index: oln/morpher/value_cast.hh
===================================================================
--- oln/morpher/value_cast.hh (revision 0)
+++ oln/morpher/value_cast.hh (revision 0)
@@ -0,0 +1,129 @@
+// 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_VALUE_CAST
+# define OLN_MORPHER_VALUE_CAST
+
+# include <xtd/abstract/open_nary_fun.hh>
+# include <xtd/res.hh>
+# include <oln/morpher/internal/image_value_morpher.hh>
+
+
+
+namespace oln
+{
+
+ namespace morpher
+ {
+ // Forward declaration.
+ template <typename Image, typename Value> struct value_cast;
+
+ } // end of namespace oln::morpher
+
+
+ /// Super type.
+ template <typename Image, typename Value>
+ struct set_super_type< morpher::value_cast<Image, Value> >
+ {
+ typedef morpher::value_cast<Image, Value> self_t;
+ typedef morpher::internal::image_value_morpher<Image, self_t> ret;
+ };
+
+
+ template <typename Image, typename Value>
+ struct vtypes< morpher::value_cast<Image, Value> >
+ {
+ typedef Value value_type;
+ typedef mlc::false_ is_mutable_type;
+ };
+
+ template <typename Image, typename Value>
+ struct single_vtype< morpher::value_cast<Image, Value>, typedef_::rvalue_type >
+ {
+ typedef Value ret;
+ };
+
+
+
+ namespace morpher
+ {
+
+ /// 'Image thru Valuection' morpher.
+ template <typename Image, typename Value>
+ class value_cast : public internal::image_value_morpher< Image,
+ value_cast<Image, Value> >
+ {
+ private:
+
+ typedef value_cast<Image, Value> self_t;
+ typedef internal::image_value_morpher<Image, self_t> super_t;
+
+ typedef oln_type_of(self_t, psite) psite_t;
+ typedef oln_type_of(self_t, rvalue) rvalue_t;
+
+ public:
+
+ value_cast(const Image& image);
+ };
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename Image, typename Value>
+ value_cast<Image, Value>::value_cast(const Image& image) :
+ super_t(image)
+ {
+ }
+
+# endif
+
+ } // end of namespace oln::morpher
+
+
+ template <typename Value, typename I>
+ morpher::value_cast<I, Value>
+ value_cast(const abstract::image<I>& ima);
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename Value, typename I>
+ morpher::value_cast<I, Value>
+ value_cast(const abstract::image<I>& ima)
+ {
+ morpher::value_cast<I, Value> tmp(ima.exact());
+ return tmp;
+ }
+
+# endif
+
+
+} // end of namespace oln
+
+
+
+#endif // ! OLN_MORPHER_VALUE_CAST
Index: oln/morpher/internal/image_value_morpher.hh
===================================================================
--- oln/morpher/internal/image_value_morpher.hh (revision 646)
+++ oln/morpher/internal/image_value_morpher.hh (working copy)
@@ -64,7 +64,7 @@
{
// Morpher type.
typedef oln::morpher::tag::identity morpher_type; // FIXME: Wrong!
-
+ typedef mlc::undefined lvalue_type;
typedef mlc::undefined value_type;
};
@@ -75,14 +75,7 @@
typedef mlc::undefined ret;
};
- template <typename Image, typename Exact>
- struct single_vtype< morpher::internal::image_value_morpher<Image, Exact>,
- typedef_::lvalue_type >
- {
- typedef mlc::undefined ret;
- };
-
namespace morpher
{
namespace internal
1
0