https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Add a slice morpher.
* oln/morpher/tags.hh (oln::morpher::tag::slice): New tag.
* oln/morpher/slice.hh: New file (new morpher).
* oln/core/type_fun/slice.hh: New.
* oln/core/iterator_vtypes.hh: Include it.
(oln::single_vtype<morpher::slice<Image>, typedef_::fwd_piter_type>)
(oln::single_vtype<morpher::slice<Image>, typedef_::bkd_piter_type>):
New.
* oln/core/1d/topo1d.hh, oln/core/2d/topo2d.hh,
* oln/core/3d/topo3d.hh: New (shortcuts).
* oln/core/gen/topo_lbbox.hh (oln::vtypes< topo_lbbox_<point> >:
Reduce the explanation to a reference to the virtual types of
oln::topo_bbox_.
(topo_lbbox::topo_lbbox_(const point&, const point&, unsigned)):
New ctor.
(topo_lbbox::border): New method.
* oln/core/gen/topo_bbox.hh
(topo_bbox::topo_bbox_(const point&, const point&)): New ctor.
* oln/Makefile.am (nobase_oln_HEADERS): Add
core/1d/topo1d.hh, core/2d/topo2d.hh, core/3d/topo3d.hh,
core/gen/piter_isubset.hh, core/type_fun/slice_piter.hh and
morpher/slice.hh.
* tests/morphers/slice_morpher.cc: New test.
* tests/morphers/Makefile.am (check_PROGRAMS): Add slice_morpher.
(slice_morpher_SOURCES): New.
* oln/core/gen/bbox_fwd_piter.hh, oln/core/gen/bbox_bkd_piter.hh,
* tests/morphers/add_neighborhood_morpher.cc: Fix a comment.
oln/Makefile.am | 7
oln/core/1d/topo1d.hh | 38 +++
oln/core/2d/topo2d.hh | 38 +++
oln/core/3d/topo3d.hh | 38 +++
oln/core/gen/bbox_bkd_piter.hh | 2
oln/core/gen/bbox_fwd_piter.hh | 2
oln/core/gen/topo_bbox.hh | 10 -
oln/core/gen/topo_lbbox.hh | 76 ++-----
oln/core/iterator_vtypes.hh | 43 ++++
oln/core/type_fun/slice.hh | 280 +++++++++++++++++++++++++++++
oln/morpher/slice.hh | 206 +++++++++++++++++++++
oln/morpher/tags.hh | 2
tests/morphers/Makefile.am | 4
tests/morphers/add_neighborhood_morpher.cc | 6
tests/morphers/slice_morpher.cc | 92 +++++++++
15 files changed, 780 insertions(+), 64 deletions(-)
Index: tests/morphers/add_neighborhood_morpher.cc
--- tests/morphers/add_neighborhood_morpher.cc (revision 659)
+++ tests/morphers/add_neighborhood_morpher.cc (working copy)
@@ -50,9 +50,9 @@
image_t ima(42, 51);
- /*------------------------------------.
- | add_neighborhood< image2d<char> >. |
- `------------------------------------*/
+ /*---------------------------------------------------.
+ | add_neighborhood< image2d<char>, oln::neighb2d >. |
+ `---------------------------------------------------*/
typedef oln::neighb2d neighb_t;
typedef oln::morpher::add_neighborhood<image_t, neighb_t> image_with_nbh_t;
Index: tests/morphers/slice_morpher.cc
--- tests/morphers/slice_morpher.cc (revision 0)
+++ tests/morphers/slice_morpher.cc (revision 0)
@@ -0,0 +1,92 @@
+// 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 the identity morpher.
+
+#include <cassert>
+
+#include <mlc/assert.hh>
+#include <mlc/is_a.hh>
+
+// FIXME: We should not include oln/basics2d.hh and oln/basics3d.hh,
+// but only oln/core/2d/image2d.hh and oln/core/3d/image3d.hh.
+#include <oln/basics2d.hh>
+#include <oln/basics3d.hh>
+#include <oln/morpher/slice.hh>
+
+#include <oln/level/fill.hh>
+
+
+int
+main()
+{
+ /*---------------.
+ | image2d<int>. |
+ `---------------*/
+
+ typedef oln::image3d<int> image_t;
+
+ // Sanity check: interfaces realized by oln::image2d.
+ mlc::assert_< mlc_is_a_(image_t, oln::abstract::image3d) >::check();
+
+ image_t ima(3, 4, 5);
+ oln::level::fill (ima, 42);
+
+
+ /*----------------------------.
+ | add_slice< image2d<int> >. |
+ `----------------------------*/
+
+ typedef oln::morpher::slice<image_t> slice_t;
+
+ // Check that the instantiated slice morpher realizes the suited
+ // interfaces.
+ mlc::assert_< mlc::eq_<oln_type_of_(slice_t, grid), oln::grid2d> >::check();
+ mlc::assert_< mlc_is_a_(slice_t, oln::abstract::image2d) >::check();
+ mlc::assert_< mlc_is_a_(slice_t, oln::abstract::mutable_image) >::check();
+
+ // Create a slice of \a ima along the 2nd axis (which the ``row''
+ // axis, numbered 1), and check its peoperties.
+ int slice_row = 2;
+ slice_t ima_with_nbh(ima, 1, slice_row);
+ assert(ima_with_nbh.bbox().nrows() == 3);
+ assert(ima_with_nbh.bbox().ncols() == 5);
+ // Fill a slice of \a ima by filling \a ima_with_nbh.
+ oln::level::fill (ima_with_nbh, 51);
+
+ // Check that \a ima has been altered, by comapring it to a similar
+ // 3D image.
+ image_t ref(3, 4, 5);
+ oln::level::fill (ref, 42);
+ for (unsigned s = 0; s < ima.bbox().nslices(); ++s)
+ for (unsigned c = 0; c < ima.bbox().ncols(); ++c)
+ ref.at(s, slice_row, c) = 51;
+ // FIXME: Implement equality on images.
+ oln_type_of_(image_t, piter) p (ima.topo());
+ for_all (p)
+ assert(ima(p) == ref(p));
+}
Index: tests/morphers/Makefile.am
--- tests/morphers/Makefile.am (revision 659)
+++ tests/morphers/Makefile.am (working copy)
@@ -21,13 +21,17 @@
check_PROGRAMS = \
identity_morpher \
add_neighborhood_morpher \
+ slice_morpher \
value_cast \
+ \
morphers
# Morphers.
identity_morpher_SOURCES = identity_morpher.cc
add_neighborhood_morpher_SOURCES = add_neighborhood_morpher.cc
+slice_morpher_SOURCES = slice_morpher.cc
value_cast_SOURCES = value_cast.cc
+
morphers_SOURCES = morphers.cc
Index: oln/core/type_fun/slice.hh
--- oln/core/type_fun/slice.hh (revision 0)
+++ oln/core/type_fun/slice.hh (revision 0)
@@ -0,0 +1,280 @@
+// 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_SLICE_HH
+# define OLN_CORE_TYPE_FUN_SLICE_HH
+
+# include <mlc/flags.hh>
+
+# include <oln/core/1d/point1d.hh>
+# include <oln/core/1d/topo1d.hh>
+
+# include <oln/core/2d/point2d.hh>
+# include <oln/core/2d/topo2d.hh>
+
+# include <oln/core/3d/point3d.hh>
+# include <oln/core/3d/topo3d.hh>
+
+
+namespace oln
+{
+
+ /*-----------------------------------.
+ | Point translation during slicing. |
+ `-----------------------------------*/
+
+ // FIXME: To be moved elsewhere (these are function on values, not
+ // on types).
+
+ // FIXME: Can't we rewrite this in a more generic way?
+
+ // --------- //
+ // Slicing. //
+ // --------- //
+
+ /// Translate an image point to a slice point.
+ /// \{
+
+ /// 2D to 1D version.
+ point1d slice_point(const point2d& p, unsigned slice_dim)
+ {
+ switch (slice_dim)
+ {
+ case 0:
+ return point1d(p.col());
+ break;
+ case 1:
+ return point1d(p.row());
+ break;
+ default:
+ abort();
+ }
+ }
+
+ /// 3D to 2D version.
+ point2d slice_point(const point3d& p, unsigned slice_dim)
+ {
+ switch (slice_dim)
+ {
+ case 0:
+ return point2d(p.row(), p.col());
+ break;
+ case 1:
+ return point2d(p.slice(), p.col());
+ break;
+ case 2:
+ return point2d(p.slice(), p.row());
+ break;
+ default:
+ abort();
+ }
+ }
+
+ /// \}
+
+
+ // ----------- //
+ // Unslicing. //
+ // ----------- //
+
+ /// Translate a slice point to an image point.
+ /// \{
+
+ /// 1D to 2D version.
+ point2d unslice_point(const point1d& p, unsigned slice_dim, int slice_coord)
+ {
+ switch (slice_dim)
+ {
+ case 0:
+ return point2d(slice_coord, p.index());
+ break;
+ case 1:
+ return point2d(p.index(), slice_coord);
+ break;
+ default:
+ abort();
+ }
+ }
+
+ /// 2D to 3D version.
+ point3d unslice_point(const point2d& p, unsigned slice_dim, int slice_coord)
+ {
+ switch (slice_dim)
+ {
+ case 0:
+ return point3d(slice_coord, p.row(), p.col());
+ break;
+ case 1:
+ return point3d(p.row(), slice_coord, p.col());
+ break;
+ case 2:
+ return point3d(p.row(), p.col(), slice_coord);
+ break;
+ default:
+ abort();
+ }
+ }
+
+ /// \}
+
+
+ /// Error messages raised by static assertions/abortions.
+ namespace ERROR
+ {
+ struct TYPE_FUNCTION_slice_piter_NOT_DEFINED_FOR_THIS_PARAMETER;
+ struct TYPE_FUNCTION_slice_topo_NOT_DEFINED_FOR_THIS_PARAMETER;
+ }
+
+
+ namespace type_fun
+ {
+
+ /*------------------------.
+ | type_fun::slice_piter. |
+ `------------------------*/
+
+ /// Type function returning the ``sliced'' piter corresponding to
+ /// \a Piter
+ /// \{
+
+ /// Default version, undefined.
+ template <typename Piter>
+ struct slice_piter :
+ public mlc::abort_<
+ Piter,
+ oln::ERROR::TYPE_FUNCTION_slice_piter_NOT_DEFINED_FOR_THIS_PARAMETER
+ >
+ {
+ typedef mlc::undefined ret;
+ };
+
+
+ // --------- //
+ // image2d. //
+ // --------- //
+
+ template <>
+ struct slice_piter<fwd_piter2d>
+ {
+ typedef fwd_piter1d ret;
+ };
+
+ template <>
+ struct slice_piter<bkd_piter2d>
+ {
+ typedef bkd_piter1d ret;
+ };
+
+
+ // --------- //
+ // image3d. //
+ // --------- //
+
+ template <>
+ struct slice_piter<fwd_piter3d>
+ {
+ typedef fwd_piter2d ret;
+ };
+
+ template <>
+ struct slice_piter<bkd_piter3d>
+ {
+ typedef bkd_piter2d ret;
+ };
+
+ /// \}
+
+
+ /// Type function returning the ``sliced'' topo corresponding to
+ /// \a Topo
+ /// \{
+
+ /// Default version, undefined.
+ template <typename Topo>
+ struct slice_topo :
+ public mlc::abort_<
+ Topo,
+ oln::ERROR::TYPE_FUNCTION_slice_topo_NOT_DEFINED_FOR_THIS_PARAMETER
+ >
+ {
+ typedef mlc::undefined ret;
+ };
+
+
+ // --------- //
+ // image2d. //
+ // --------- //
+
+ // FIXME: slice_topo<topo2d> is more than a function on type,
+ // because of convert(). (Where should me move this?)
+
+ template <>
+ struct slice_topo<topo2d>
+ {
+ typedef topo1d ret;
+
+ /// Convert a topo2d to a topo1d.
+ static topo1d convert (const topo2d& topo, unsigned slice_dim)
+ {
+ return topo1d(slice_point(topo.bbox().pmin(), slice_dim),
+ slice_point(topo.bbox().pmax(), slice_dim),
+ topo.border());
+ }
+ };
+
+
+ // --------- //
+ // image3d. //
+ // --------- //
+
+ // FIXME: slice_topo<topo3d> is more than a function on type,
+ // because of convert(). (Where should me move this?)
+
+ template <>
+ struct slice_topo<topo3d>
+ {
+
+ typedef topo2d ret;
+
+ /* FIXME: slice_topo<topo3d>::convert() is almost the same as
+ slice_topo<topo2d>::convert(). */
+
+ /// Convert a topo2d to a topo1d.
+ static topo2d convert (const topo3d& topo, unsigned slice_dim)
+ {
+ return topo2d(slice_point(topo.bbox().pmin(), slice_dim),
+ slice_point(topo.bbox().pmax(), slice_dim),
+ topo.border());
+ }
+ };
+
+ } // end of namespace oln::type_fun
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_TYPE_FUN_SLICE_HH
Index: oln/core/iterator_vtypes.hh
--- oln/core/iterator_vtypes.hh (revision 659)
+++ oln/core/iterator_vtypes.hh (working copy)
@@ -33,6 +33,7 @@
# include <oln/core/1d/aliases.hh>
# include <oln/core/2d/aliases.hh>
# include <oln/core/3d/aliases.hh>
+# include <oln/core/type_fun/slice.hh>
namespace oln
@@ -169,7 +170,8 @@
`--------------------------------------------*/
// Forward declarations.
- namespace morpher {
+ namespace morpher
+ {
template <typename Image, typename Isubset> struct add_isubset;
}
template <typename piter_t, typename isubset_t> class piter_isubset_;
@@ -237,7 +239,8 @@
`-------------------------------------------------*/
// Forward declarations.
- namespace morpher {
+ namespace morpher
+ {
template <typename Image, typename Neighb> struct add_neighborhood;
}
template <typename point_t> class fwd_niter_neighb_;
@@ -269,6 +272,42 @@
};
+ /*-----------------------------.
+ | oln::morpher::slice<Image>. |
+ `-----------------------------*/
+
+ // Forward declarations.
+ namespace morpher
+ {
+ template <typename Image> struct slice;
+ }
+ template <typename Piter, typename Topo> class piter_slice_;
+
+
+ /// fwd_piter vtype of morpher::slice.
+ template <typename Image>
+ struct single_vtype< morpher::slice<Image>, typedef_::fwd_piter_type >
+ {
+ private:
+ typedef oln_type_of(Image, fwd_piter) orig_fwd_piter;
+ public:
+ typedef typename type_fun::slice_piter<orig_fwd_piter>::ret ret;
+ };
+
+ /// bkd_piter vtype of morpher::slice.
+ template <typename Image>
+ struct single_vtype< morpher::slice<Image>, typedef_::bkd_piter_type >
+ {
+ private:
+ typedef oln_type_of(Image, bkd_piter) orig_bkd_piter;
+ public:
+ typedef typename type_fun::slice_piter<orig_bkd_piter>::ret ret;
+ };
+
+
+ // FIXME: What about niters and qiter?
+
+
} // end of namespace oln
Index: oln/core/1d/topo1d.hh
--- oln/core/1d/topo1d.hh (revision 0)
+++ oln/core/1d/topo1d.hh (revision 0)
@@ -0,0 +1,38 @@
+// 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_TOPO1D_HH
+# define OLN_CORE_1D_TOPO1D_HH
+
+// Headers required for the complete definition of oln::topo1d
+// (i.e., oln::topo_lbbox_<point1d>).
+# include <oln/core/1d/aliases.hh>
+# include <oln/core/1d/point1d.hh>
+# include <oln/core/1d/dpoint1d.hh>
+# include <oln/core/gen/topo_lbbox.hh>
+
+#endif // ! OLN_CORE_1D_TOPO1D_HH
Index: oln/core/2d/topo2d.hh
--- oln/core/2d/topo2d.hh (revision 0)
+++ oln/core/2d/topo2d.hh (revision 0)
@@ -0,0 +1,38 @@
+// 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_TOPO2D_HH
+# define OLN_CORE_2D_TOPO2D_HH
+
+// Headers required for the complete definition of oln::topo2d
+// (i.e., oln::topo_lbbox_<point2d>).
+# include <oln/core/2d/aliases.hh>
+# include <oln/core/2d/point2d.hh>
+# include <oln/core/2d/dpoint2d.hh>
+# include <oln/core/gen/topo_lbbox.hh>
+
+#endif // ! OLN_CORE_2D_TOPO2D_HH
Index: oln/core/3d/topo3d.hh
--- oln/core/3d/topo3d.hh (revision 0)
+++ oln/core/3d/topo3d.hh (revision 0)
@@ -0,0 +1,38 @@
+// 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_TOPO3D_HH
+# define OLN_CORE_3D_TOPO3D_HH
+
+// Headers required for the complete definition of oln::topo3d
+// (i.e., oln::topo_lbbox_<point3d>).
+# include <oln/core/3d/aliases.hh>
+# include <oln/core/3d/point3d.hh>
+# include <oln/core/3d/dpoint3d.hh>
+# include <oln/core/gen/topo_lbbox.hh>
+
+#endif // ! OLN_CORE_3D_TOPO3D_HH
Index: oln/core/gen/topo_bbox.hh
--- oln/core/gen/topo_bbox.hh (revision 659)
+++ oln/core/gen/topo_bbox.hh (working copy)
@@ -123,17 +123,15 @@
public:
topo_bbox_();
-
topo_bbox_(const bbox_t& bb);
+ topo_bbox_(const point& pmin, const point& pmax);
const bbox_t& impl_bbox() const;
-
bbox_t& impl_bbox();
bbox_t& impl_lbbox();
bool impl_has(const point& p) const;
-
bool impl_has_large(const point& p) const;
protected:
@@ -158,6 +156,12 @@
}
template <typename point>
+ topo_bbox_<point>::topo_bbox_(const point& pmin, const point& pmax)
+ : bb_(pmin, pmax)
+ {
+ }
+
+ template <typename point>
const typename topo_bbox_<point>::bbox_t&
topo_bbox_<point>::impl_bbox() const
{
Index: oln/core/gen/bbox_fwd_piter.hh
--- oln/core/gen/bbox_fwd_piter.hh (revision 659)
+++ oln/core/gen/bbox_fwd_piter.hh (working copy)
@@ -59,7 +59,7 @@
- /// Abstract forward point iterator class.
+ /// Generic forward point iterator class.
template <typename point>
class bbox_fwd_piter_ : public internal::bbox_fwd_piter< bbox_fwd_piter_<point> >,
private mlc::assert_< mlc_is_a(point, abstract::point) >
Index: oln/core/gen/topo_lbbox.hh
--- oln/core/gen/topo_lbbox.hh (revision 659)
+++ oln/core/gen/topo_lbbox.hh (working copy)
@@ -54,58 +54,8 @@
template <typename point>
struct vtypes< topo_lbbox_<point> >
{
- /* Trick to force the instantiation of bbox_<point>.
-
- As bbox_<point> is a template type used to define the `bbox'
- virtual type of topo_lbbox_<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_lbbox_<point> >::bbox_type'. */
+ /* Same trick as in the virtual types of oln::topo_bbox_ to force
+ the compiler to instantiate bbox_<point>. */
typedef typename bbox_<point>::self_type bbox_type;
typedef point point_type;
typedef mlc::true_ is_random_accessible_type;
@@ -124,16 +74,16 @@
public:
topo_lbbox_();
-
topo_lbbox_(const bbox_t& bb, unsigned border);
+ topo_lbbox_(const point& pmin, const point& pmax, unsigned border);
const bbox_t& impl_bbox() const;
bool impl_has(const point& p) const;
-
bool impl_has_large(const point& p) const;
const bbox_t& lbbox() const;
+ unsigned border () const;
protected:
@@ -163,6 +113,17 @@
}
template <typename point>
+ topo_lbbox_<point>::topo_lbbox_(const point& pmin, const point& pmax,
+ unsigned border)
+ : bb_(pmin, pmax), border_(border)
+ {
+ typedef oln_type_of(point, dpoint) dpoint_t;
+ dpoint_t dp;
+ dp.set_all(border);
+ lbb_ = bbox_<point>(bb_.pmin() - dp, bb_.pmax() + dp);
+ }
+
+ template <typename point>
const typename topo_lbbox_<point>::bbox_t&
topo_lbbox_<point>::impl_bbox() const
{
@@ -190,6 +151,13 @@
return lbb_;
}
+ template <typename point>
+ unsigned
+ topo_lbbox_<point>::border () const
+ {
+ return border_;
+ }
+
# endif
} // end of namespace oln
Index: oln/core/gen/bbox_bkd_piter.hh
--- oln/core/gen/bbox_bkd_piter.hh (revision 659)
+++ oln/core/gen/bbox_bkd_piter.hh (working copy)
@@ -59,7 +59,7 @@
- /// Abstract forward point iterator class.
+ /// Generic backward point iterator class.
template <typename point>
class bbox_bkd_piter_ : public internal::bbox_bkd_piter< bbox_bkd_piter_<point> >,
private mlc::assert_< mlc_is_a(point, abstract::point) >
Index: oln/Makefile.am
--- oln/Makefile.am (revision 659)
+++ oln/Makefile.am (working copy)
@@ -12,6 +12,7 @@
core/1d/image1d.hh \
core/1d/neighb1d.hh \
core/1d/point1d.hh \
+ core/1d/topo1d.hh \
\
core/2d/aliases.hh \
core/2d/array2d.hh \
@@ -20,6 +21,7 @@
core/2d/image2d.hh \
core/2d/neighb2d.hh \
core/2d/point2d.hh \
+ core/2d/topo2d.hh \
\
core/3d/aliases.hh \
core/3d/array3d.hh \
@@ -28,6 +30,7 @@
core/3d/image3d.hh \
core/3d/neighb3d.hh \
core/3d/point3d.hh \
+ core/3d/topo3d.hh \
\
core/abstract/image/accessibility/hierarchy.hh \
\
@@ -111,12 +114,14 @@
core/gen/fwd_niter_neighb.hh \
core/gen/fwd_piter_bbox.hh \
core/gen/fwd_qiter_win.hh \
+ core/gen/piter_isubset.hh \
core/gen/grid.hh \
core/gen/mapimage.hh \
core/gen/neighb.hh \
core/gen/topo_add_nbh.hh \
core/gen/topo_bbox.hh \
core/gen/topo_lbbox.hh \
+ core/gen/topo_slice.hh \
core/gen/window.hh \
\
core/spe/col.hh \
@@ -125,6 +130,7 @@
\
core/type_fun/ch_value.hh \
core/type_fun/plain.hh \
+ core/type_fun/slice_piter.hh \
\
core/internal/bbox_bkd_piter.hh \
core/internal/bbox_fwd_piter.hh \
@@ -161,6 +167,7 @@
morpher/fwd_decls.hh \
morpher/identity.hh \
morpher/tags.hh \
+ morpher/slice.hh \
morpher/thru_fun.hh \
morpher/value_cast.hh \
\
Index: oln/morpher/tags.hh
--- oln/morpher/tags.hh (revision 659)
+++ oln/morpher/tags.hh (working copy)
@@ -37,6 +37,8 @@
{
/// Tag associated to oln::morpher::image_extension.
struct identity;
+ /// Tag associated to oln::morpher::slice.
+ struct slice;
} // end of namespace oln::morpher::tag
Index: oln/morpher/slice.hh
--- oln/morpher/slice.hh (revision 0)
+++ oln/morpher/slice.hh (revision 0)
@@ -0,0 +1,206 @@
+// 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_SLICE_HH
+# define OLN_MORPHER_SLICE_HH
+
+# include <cstdlib>
+
+# include <mlc/int.hh>
+# include <mlc/abort.hh>
+
+# include <oln/core/image_entry.hh>
+# include <oln/core/gen/bbox.hh>
+# include <oln/core/type_fun/slice.hh>
+
+
+namespace oln
+{
+
+ /*---------------.
+ | slice<Image>. |
+ `---------------*/
+
+ namespace morpher
+ {
+ // Forward declaration.
+ template <typename Image> struct slice;
+
+ } // end of namespace oln::morpher
+
+
+ /// Super type.
+ template <typename Image>
+ struct set_super_type< morpher::slice<Image> >
+ {
+ typedef image_entry< morpher::slice<Image> > ret;
+ };
+
+
+ /// Virtual types associated to oln::morpher::slice<Image>
+ /// \{
+ template <typename Image>
+ struct vtypes< morpher::slice<Image> >
+ {
+ private:
+ typedef oln_deduce_type_of(Image, grid, dimvalue) orig_dimvalue_type;
+ typedef mlc::uint_< mlc_value(orig_dimvalue_type) - 1 > dimvalue_type;
+
+ public:
+ typedef typename
+ type_fun::slice_topo< oln_type_of(Image, topo) >::ret topo_type;
+
+ typedef grid_<mlc_value(orig_dimvalue_type) - 1> grid_type;
+
+ // psite_type: see below.
+ typedef typename
+ point_< mlc_value(dimvalue_type),
+ oln_deduce_type_of(Image, point, coord) >::ret
+ point_type;
+
+ // piter_type: see below.
+
+ typedef oln_type_of(Image, value) value_type;
+ // rvalue_type: see below.
+
+ // fwd_piter_type: see oln/core/iterator_vtypes.hh.
+ // bkd_piter_type: see oln/core/iterator_vtypes.hh.
+
+ // FIXME: fwd_qiter_type?
+ // FIXME: bkd_qiter_type?
+
+ typedef oln::morpher::tag::slice morpher_type;
+
+ };
+
+ // Coord.
+ template <typename Image>
+ struct single_vtype< morpher::slice<Image>, typedef_::coord_type >
+ {
+ typedef oln_deduce_type_of(Image, point, coord) ret;
+ };
+
+ // Psite.
+ template <typename Image>
+ struct single_vtype< morpher::slice<Image>, typedef_::psite_type >
+ {
+ private:
+ typedef morpher::slice<Image> self_t;
+ public:
+ typedef oln_type_of(self_t, point) ret;
+ };
+
+ /* FIXME: Should we keep the `piter' vtype, knowing that the macro
+ `oln_piter' gives the `fwd_piter' vtype (and not the `piter'
+ vtype)? */
+ // Piter.
+ template <typename Image>
+ struct single_vtype< morpher::slice<Image>, typedef_::piter_type >
+ {
+ typedef oln_type_of(Image, fwd_piter) ret;
+ };
+
+ // Rvalue.
+ template <typename Image>
+ struct single_vtype< morpher::slice<Image>, typedef_::rvalue_type >
+ {
+ typedef oln_type_of(Image, rvalue) ret;
+ };
+
+ // Lvalue.
+ template <typename Image>
+ struct single_vtype< morpher::slice<Image>, typedef_::lvalue_type >
+ {
+ typedef oln_type_of(Image, lvalue) ret;
+ };
+ /// \}
+
+
+ namespace morpher
+ {
+
+ template <typename Image>
+ class slice : public stc_get_supers(slice<Image>)
+ {
+ typedef slice<Image> self_t;
+
+ typedef oln_type_of(self_t, topo) topo_t;
+ typedef oln_type_of(self_t, rvalue) rvalue_t;
+ typedef oln_type_of(self_t, lvalue) lvalue_t;
+ typedef oln_type_of(self_t, point) point_t;
+
+ typedef oln_type_of(Image, topo) orig_topo_t;
+ typedef oln_type_of(Image, point) orig_point_t;
+
+ typedef oln_deduce_type_of(Image, point, coord) coord_t;
+
+
+ public:
+ // FIXME: Handle the constness.
+ slice(const abstract::image_having_bbox<Image>& image,
+ unsigned slice_dim, coord_t slice_coord) :
+ image_(image.exact()),
+ slice_dim_(slice_dim),
+ slice_coord_(slice_coord),
+ topo_(type_fun::slice_topo<orig_topo_t>::convert(image.topo(),
+ slice_dim))
+ {
+ }
+
+ const topo_t& impl_topo() const
+ {
+ return topo_;
+ }
+
+ rvalue_t impl_op_read(const point_t& p) const
+ {
+ precondition(topo_.has_large(p));
+ orig_point_t q = unslice_point(p, slice_dim_, slice_coord_);
+ return image_(q);
+ }
+
+ lvalue_t impl_op_readwrite(const point_t& p)
+ {
+ precondition(topo_.has_large(p));
+ orig_point_t q = unslice_point(p, slice_dim_, slice_coord_);
+ return image_(q);
+ }
+
+ protected:
+ Image image_;
+ unsigned slice_dim_;
+ coord_t slice_coord_;
+
+ private:
+ topo_t topo_;
+ };
+
+ } // end of namespace oln::morpher
+
+} // end of namespace oln
+
+#endif // ! OLN_MORPHER_SLICE_HH
On 2006-10-19, Roland Levillain <roland(a)lrde.epita.fr> wrote:
> Tsuna <tsuna(a)warszawa.lrde.epita.fr> writes:
>>
>> Types ending in _t are reserved by POSIX :P
>
> This rule has been set up by POSIX to avoid namespace pollution,
> because C has no means to separate standard types from user types.
>
> The aforementioned types ending in `_t' are enclosed in a C++ class
> namespace (which itself belongs to a user namespace). Under these
> conditions, does this rule still apply?
>
You are totally right, I was just being picky :P
>
> I browsed the Single Unix Specification version 3 (since POSIX isn't
> freely available), and only found this reference in the « Rationale
> (Informative) Volume » (XRAT):
>
> B.2.12 Data Types
>
> [SNIP]
>
> Is this the single reference on that subject in SUSv3?
>
>
No idea.
--
SIGOURE Benoit aka Tsuna (SUSv3 compliant)
_____ "On a long enough timeline, the survival rate
/EPITA\ Promo 2008.CSI/ACU for everyone drops to zero" -- Jack.
Roland Levillain <roland(a)lrde.epita.fr> writes:
> Thierry GERAUD <theo(a)lrde.epita.fr> writes:
>
>> Index: oln/core/abstract/image.hh
>> ===================================================================
>> --- oln/core/abstract/image.hh (revision 526)
>> +++ oln/core/abstract/image.hh (working copy)
>> @@ -29,216 +29,11 @@
>
> [...]
>
>> + /// 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;
>
> Shouldn't we use type names ending in `_type', rather than `_t', in
> accordance with
>
> https://olena.lrde.epita.fr/cgi-bin/twiki/view/Olena/CodingStyle
>
> ?
We've discussed this point with Théo; he said names ending in `_type'
are for public types, while the ones ending in `_t' are for private
types. That makes sense to me, so I suggest sticking to this
convention.
(BTW, we have to create a new coding style for Olena 1.0 on the Wiki,
derived from Olena 0.10's.)
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
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