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
January 2007
- 5 participants
- 11 discussions
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
URL: https://svn.lrde.epita.fr/svn/oln/trunk/static
ChangeLog:
2007-01-26 Thomas Moulard <thomas.moulard(a)lrde.epita.fr>
Add mini-oln.
* samples/mini-oln/README: Add mini-oln. New.
* samples/mini-oln/mini-oln.cc: Idem. New.
* samples/mini-oln: Idem. New.
* samples: Idem. New.
README | 1
mini-oln.cc | 539 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 540 insertions(+)
Index: samples/mini-oln/mini-oln.cc
===================================================================
- --- samples/mini-oln/mini-oln.cc (revision 0)
+++ samples/mini-oln/mini-oln.cc (revision 0)
@@ -0,0 +1,539 @@
+// Copyright (C) 2007 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.
+
+#include <vector>
+
+#include <mlc/case.hh>
+#include <stc/any.hh>
+#include <stc/scoop.hh>
+
+
+// Helper macros.
+#define oln_type_of_(FromType, Alias) \
+ oln::find_vtype<FromType, oln::typedef_:: Alias##_type>::ret
+
+#define oln_type_of(FromType, Alias) \
+ typename oln_type_of_(FromType, Alias)
+
+// Add equipment
+stc_scoop_equipment_for_namespace(oln);
+mlc_case_equipment_for_namespace(oln);
+
+
+// Point
+template <typename E>
+struct Point : public stc::any<E>
+{
+};
+
+struct point2d : public Point<point2d>
+{
+ int row;
+ int col;
+};
+
+struct point3d : public Point<point2d>
+{
+ int row;
+ int col;
+ int sli;
+};
+
+// Iterator
+template <typename E>
+struct Iterator;
+
+namespace oln
+{
+ mlc_decl_typedef(point_type);
+
+ template <typename E>
+ struct vtypes<Iterator<E> >
+ {
+ typedef mlc::undefined point_type;
+ };
+};
+
+template <typename E>
+struct Iterator : public stc::any<E>
+{
+ typedef oln_type_of(Iterator, point) point_t;
+
+ void start()
+ {
+ this->exact().start();
+ }
+
+ void next()
+ {
+ this->exact().next();
+ }
+
+ bool is_valid() const
+ {
+ this->exact().is_valid();
+ };
+
+ // auto
+ operator point_t()
+ {
+ return this->exact().operator point_t();
+ }
+};
+
+// Image
+template <typename E>
+struct Image;
+
+namespace oln
+{
+ mlc_decl_typedef(iter_type);
+ mlc_decl_typedef(value_type);
+
+ template <typename E>
+ struct vtypes<Image<E> >
+ {
+ typedef mlc::undefined point_type;
+ typedef mlc::undefined iter_type;
+ typedef mlc::undefined value_type;
+ };
+};
+
+template <typename E>
+struct Image : public stc::any<E>
+{
+ typedef oln_type_of(Image, point) point_t;
+ typedef oln_type_of(Image, iter) iter_t;
+ typedef oln_type_of(Image, value) value_t;
+
+ value_t& operator ()(point_t& p)
+ {
+ return this->exact().operator ()(p);
+ }
+
+ bool has(const point_t& p) const
+ {
+ this->exact().has(p);
+ }
+
+};
+
+namespace oln
+{
+ struct Image2d;
+
+ template<>
+ struct set_super_type<Image2d>
+ {
+ typedef Image<Image2d> ret;
+ };
+};
+
+struct Image2d : public Image<Image2d>
+{
+ typedef oln_type_of_(Image2d, point) point_t;
+ typedef oln_type_of_(Image2d, iter) iter_t;
+ typedef oln_type_of_(Image2d, value) value_t;
+
+ value_t& operator ()(point_t& p)
+ {
+ return this->exact().operator ()(p);
+ }
+
+ int nrows_get() const
+ {
+ this->exact().nrows_get();
+ }
+
+ int ncols_get() const
+ {
+ this->exact().ncols_get();
+ }
+};
+
+namespace oln
+{
+ struct Image3d;
+
+ template<>
+ struct set_super_type<Image3d>
+ {
+ typedef Image<Image3d> ret;
+ };
+};
+
+struct Image3d : public Image<Image3d>
+{
+ typedef oln_type_of_(Image3d, point) point_t;
+ typedef oln_type_of_(Image3d, iter) iter_t;
+ typedef oln_type_of_(Image3d, value) value_t;
+
+ value_t& operator ()(point_t& p)
+ {
+ return this->exact().operator ()(p);
+ }
+
+ int nrows_get() const
+ {
+ this->exact().nrows_get();
+ }
+
+ int ncols_get() const
+ {
+ this->exact().ncols_get();
+ }
+
+ int nslis_get() const
+ {
+ this->exact().nslis_get();
+ }
+};
+
+// Image with neighborhood
+struct image_with_nbh;
+
+namespace oln
+{
+ mlc_decl_typedef(niter_type);
+ mlc_decl_typedef(nbh_type);
+
+ template<>
+ struct set_super_type<image_with_nbh>
+ {
+ typedef Image<image_with_nbh> ret;
+ };
+
+ template <>
+ struct vtypes<image_with_nbh>
+ {
+ typedef mlc::undefined niter_type;
+ typedef mlc::undefined nbh_type;
+ };
+};
+
+struct image_with_nbh : public Image<image_with_nbh>
+{
+ typedef oln_type_of_(image_with_nbh, niter) niter_t;
+ typedef oln_type_of_(image_with_nbh, nbh) nbh_t;
+
+ nbh_t nbh() const
+ {
+ //FIXME
+ }
+};
+
+// Switch
+struct switch_image_base;
+
+namespace oln
+{
+ namespace error
+ {
+ struct ERROR_image_base;
+ };
+
+ template <typename I>
+ struct case_<switch_image_base, I, 1> : public mlc::where_ < mlc::eq_ <I, point2d> >
+ {
+ typedef Image2d ret;
+ };
+
+ template <typename I>
+ struct case_<switch_image_base, I, 2> : public mlc::where_ < mlc::eq_ <I, point3d> >
+ {
+ typedef Image3d ret;
+ };
+
+ template <typename I>
+ struct default_case_<switch_image_base, I>
+ {
+ typedef mlc::undefined ret;
+ };
+};
+
+
+
+
+// Image base
+template <typename E>
+struct image_base;
+
+namespace oln
+{
+ template<typename E>
+ struct set_super_type<image_base<E> >
+ {
+ typedef typename oln::switch_<switch_image_base, E>::ret ret;
+ };
+
+ template <typename E>
+ struct vtypes<image_base<E> >
+ {
+ typedef mlc::undefined point_type;
+ typedef mlc::undefined iter_type;
+ typedef mlc::undefined value_type;
+ };
+};
+
+template <typename E>
+struct image_base : public oln::switch_<switch_image_base, E>::ret
+{
+ typedef oln_type_of(image_base, point) point_t;
+ typedef oln_type_of(image_base, iter) iter_t;
+ typedef oln_type_of(image_base, value) value_t;
+
+ value_t& operator ()(point_t& p)
+ {
+ return this->exact().operator ()(p);
+ }
+
+ bool has(const point_t& p) const
+ {
+ this->exact().has(p);
+ }
+};
+
+// Iterator 2d
+struct iterator2d;
+
+template <typename T>
+struct image2d;
+
+namespace oln
+{
+ template<>
+ struct set_super_type<iterator2d>
+ {
+ typedef Iterator<iterator2d> ret;
+ };
+
+ template <>
+ struct vtypes<iterator2d>
+ {
+ typedef point2d point_type;
+ };
+};
+
+struct iterator2d : public Iterator<iterator2d>
+{
+ typedef oln_type_of_(iterator2d, point) point_t;
+
+ template <typename T>
+ iterator2d(image2d<T>& ima) :
+ nrows (ima.nrows_get()),
+ ncols (ima.ncols_get())
+ {
+ }
+
+ void start()
+ {
+ p.row = 0;
+ p.col = 0;
+ }
+
+ void next()
+ {
+ p.col = p.col + 1;
+
+ if (p.col == ncols)
+ {
+ p.col = 0;
+ p.row = p.row + 1;
+ }
+ }
+
+ bool is_valid() const
+ {
+ return p.row < nrows;
+ }
+
+ operator point_t()
+ {
+ return p;
+ }
+
+protected:
+ int nrows;
+ int ncols;
+ point_t p;
+};
+
+// image2d
+template <typename T>
+struct image2d;
+
+namespace oln
+{
+ template<typename T>
+ struct set_super_type<image2d<T> >
+ {
+ typedef image_base<image2d<T> > ret;
+ };
+
+ template <typename T>
+ struct vtypes<image2d<T> >
+ {
+ typedef point2d point_t;
+ typedef iterator2d iter_t;
+ typedef T value_t;
+ };
+};
+
+template <typename T>
+struct image2d : public image_base<image2d<T> >
+{
+ typedef oln_type_of(image2d, point) point_t;
+ typedef oln_type_of(image2d, iter) iter_t;
+ typedef oln_type_of(image2d, value) value_t;
+
+ image2d(int nrows, int ncols) :
+ data (0),
+ nrows (nrows),
+ ncols (ncols)
+ {
+ data = new std::vector<value_t>;
+ }
+
+ value_t& operator()(const point_t& p)
+ {
+ return this->data[p.row * nrows + p.col];
+ }
+
+ int nrows_get() const
+ {
+ return nrows;
+ }
+
+ int ncols_get() const
+ {
+ return ncols;
+ }
+
+ bool has(point_t& p)
+ {
+ assert(!!data);
+ return p.row >= 0 && p.row < nrows && p.col >= 0 && p.col < ncols;
+ }
+
+protected:
+ std::vector<value_t>* data;
+ int nrows;
+ int ncols;
+};
+
+// image_morpher
+template <typename E>
+struct image_morpher;
+
+namespace oln
+{
+ template<typename E>
+ struct set_super_type<image_morpher<E> >
+ {
+ typedef image_base<image_morpher<E> > ret;
+ };
+
+ template <typename E>
+ struct vtypes<image_morpher<E> >
+ {
+ typedef mlc::undefined delegatee_t;
+ };
+};
+
+template <typename E>
+struct image_morpher : public image_base<image_morpher<E> >
+{
+ typedef oln_type_of(image_morpher, delegatee) delegatee_t;
+
+ image_morpher(delegatee_t& ref_ima) :
+ ref_ima (ref_ima)
+ {
+ }
+
+ delegatee_t& ref ()
+ {
+ return ref_ima;
+ }
+protected:
+ delegatee_t& ref_ima;
+};
+
+//image_plus_neighborhood
+template <typename I, typename N>
+struct plus;
+
+namespace oln
+{
+ template <typename I, typename N>
+ struct set_super_type<image_morpher<plus<I, N> > >
+ {
+ typedef image_morpher<plus <I, N> > ret;
+ };
+
+ template <typename I, typename N>
+ struct vtypes<plus<I, N> >
+ {
+ typedef I delegatee_t;
+ };
+};
+
+template <typename I, typename N>
+struct plus : public image_morpher<plus<I, N> >
+{
+ plus(I& ima, N& nbh) :
+ nbh (nbh)
+ {
+ }
+
+protected:
+ N& nbh;
+};
+
+template <typename I, typename N>
+plus<I, N> operator +(I& lhs, N& rhs)
+{
+ plus<I, N> res(lhs, rhs);
+ return res;
+}
+
+
+
+int main()
+{
+ typedef plus<image2d<int>, image_with_nbh> my_ima;
+
+ point2d p2d;
+ point3d p3d;
+
+ image2d<int> ima(10, 10);
+ image_with_nbh ima_nb;
+
+ iterator2d it2d(ima);
+
+ //my_ima p = ima + ima_nb;
+}
+
Index: samples/mini-oln/README
===================================================================
- --- samples/mini-oln/README (revision 0)
+++ samples/mini-oln/README (revision 0)
@@ -0,0 +1 @@
+FIXME
\ No newline at end of file
- --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFFui+58QvmnUS5oeMRAqExAJ0YPJPC3maAOi+LM/Qq8Ee86b1I8ACeLpnE
pI+i4X30a0sH6KZHEBQOokw=
=8KbQ
-----END PGP SIGNATURE-----
2
2
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Catch up with Static.
* oln/core/typedefs.hh: Catch up with stc/scoop-alt.hh.
* oln/core/abstract/image/bbox/hierarchy.hh,
* oln/core/abstract/image/dimension/hierarchy.hh,
* oln/core/abstract/image/hybrid/classical.hh,
* oln/core/abstract/image/mutability/hierarchy.hh,
* oln/core/abstract/image/neighborhood/hierarchy.hh,
* oln/core/abstract/image/value_wise_accessibility/hierarchy.hh,
* oln/core/abstract/iterator_on_points.hh,
* oln/core/abstract/point.hh,
* oln/core/internal/dpoint_nd.hh,
* oln/core/image_entry.hh:
s/OLENA_USE_NEW_SCOOP2/OLENA_USE_SCOOP_ALT/g.
abstract/image/bbox/hierarchy.hh | 4 ++--
abstract/image/dimension/hierarchy.hh | 12 ++++++------
abstract/image/hybrid/classical.hh | 16 ++++++++--------
abstract/image/mutability/hierarchy.hh | 4 ++--
abstract/image/neighborhood/hierarchy.hh | 4 ++--
abstract/image/value_wise_accessibility/hierarchy.hh | 8 ++++----
abstract/iterator_on_points.hh | 8 ++++----
abstract/point.hh | 12 ++++++------
image_entry.hh | 8 ++++----
internal/dpoint_nd.hh | 8 ++++----
typedefs.hh | 8 +++-----
11 files changed, 45 insertions(+), 47 deletions(-)
Index: oln/core/typedefs.hh
--- oln/core/typedefs.hh (revision 726)
+++ oln/core/typedefs.hh (working copy)
@@ -41,11 +41,11 @@
# include <stc/any.hh>
# include <stc/exact.hh>
-# ifdef OLENA_USE_NEW_SCOOP2
-# include <stc/scoop2.hh>
+# ifdef OLENA_USE_SCOOP_ALT
+# include <stc/scoop-alt.hh>
# else
# include <stc/scoop.hh>
-# endif // OLENA_USE_NEW_SCOOP2
+# endif // OLENA_USE_SCOOP_ALT
# include <oln/core/type.hh>
// FIXME: Move to oln/core.
@@ -56,11 +56,9 @@
| Namespace equipment. |
`----------------------*/
-# ifndef OLENA_USE_NEW_SCOOP2
// The virtual types facility is inserted here because it also
// triggers Metalic's typedef introspection equipment.
stc_scoop_equipment_for_namespace(oln);
-# endif // !OLENA_USE_NEW_SCOOP2
namespace oln
Index: oln/core/image_entry.hh
--- oln/core/image_entry.hh (revision 726)
+++ oln/core/image_entry.hh (working copy)
@@ -71,9 +71,9 @@
// FIXME: default definitions:
typedef oln_point(E) psite_type;
-# ifndef OLENA_USE_NEW_SCOOP2
+# ifndef OLENA_USE_SCOOP_ALT
typedef oln_value(E) rvalue_type;
-# endif // !OLENA_USE_NEW_SCOOP2
+# endif // !OLENA_USE_SCOOP_ALT
/// \brief Morpher type.
///
@@ -81,13 +81,13 @@
typedef mlc::none morpher_type;
};
-# ifdef OLENA_USE_NEW_SCOOP2
+# ifdef OLENA_USE_SCOOP_ALT
template <typename E>
struct single_vtype< image_entry<E>, typedef_::rvalue_type >
{
typedef oln_value(E) ret;
};
-# endif // OLENA_USE_NEW_SCOOP2
+# endif // OLENA_USE_SCOOP_ALT
/// Entry class for point sets: image_entry<E> is an alias for
Index: oln/core/abstract/iterator_on_points.hh
--- oln/core/abstract/iterator_on_points.hh (revision 726)
+++ oln/core/abstract/iterator_on_points.hh (working copy)
@@ -54,19 +54,19 @@
struct vtypes< abstract::iterator_on_points<E> >
{
typedef stc::abstract point_type;
-# ifndef OLENA_USE_NEW_SCOOP2
+# ifndef OLENA_USE_SCOOP_ALT
typedef oln_deduce_deferred_vtype(E, point, coord) coord_type;
-# endif // !OLENA_USE_NEW_SCOOP2
+# endif // !OLENA_USE_SCOOP_ALT
};
-# ifdef OLENA_USE_NEW_SCOOP2
+# ifdef OLENA_USE_SCOOP_ALT
template <typename E>
struct single_vtype< abstract::iterator_on_points<E>,
typedef_::coord_type >
{
typedef oln_deduce_deferred_vtype(E, point, coord) ret;
};
-# endif // OLENA_USE_NEW_SCOOP2
+# endif // OLENA_USE_SCOOP_ALT
namespace abstract
Index: oln/core/abstract/image/hybrid/classical.hh
--- oln/core/abstract/image/hybrid/classical.hh (revision 726)
+++ oln/core/abstract/image/hybrid/classical.hh (working copy)
@@ -178,11 +178,11 @@
mlc::eq_< oln_vtype(E, grid), oln::grid1d >,
mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ >,
// FIXME: Shouldn't we use stc::is_found (resp. mlc::is_found) here?
-# ifdef OLENA_USE_NEW_SCOOP2
+# ifdef OLENA_USE_SCOOP_ALT
mlc::neq_< oln_deduce_vtype(E, topo, bbox), stc::not_found >
# else
mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found >
-# endif // OLENA_USE_NEW_SCOOP2
+# endif // OLENA_USE_SCOOP_ALT
> >
{
typedef abstract::classical_1d_image<E> ret;
@@ -196,11 +196,11 @@
mlc::eq_< oln_vtype(E, grid), oln::grid2d >,
mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ >,
// FIXME: Shouldn't we use stc::is_found (resp. mlc::is_found) here?
-# ifdef OLENA_USE_NEW_SCOOP2
+# ifdef OLENA_USE_SCOOP_ALT
mlc::neq_< oln_deduce_vtype(E, topo, bbox), stc::not_found >
# else
mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found >
-# endif // OLENA_USE_NEW_SCOOP2
+# endif // OLENA_USE_SCOOP_ALT
> >
{
typedef abstract::classical_2d_image<E> ret;
@@ -214,11 +214,11 @@
mlc::eq_< oln_vtype(E, grid), oln::grid3d >,
mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ >,
// FIXME: Shouldn't we use stc::is_found (resp. mlc::is_found) here?
-# ifdef OLENA_USE_NEW_SCOOP2
+# ifdef OLENA_USE_SCOOP_ALT
mlc::neq_< oln_deduce_vtype(E, topo, bbox), stc::not_found >
# else
mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found >
-# endif // OLENA_USE_NEW_SCOOP2
+# endif // OLENA_USE_SCOOP_ALT
> >
{
typedef abstract::classical_3d_image<E> ret;
@@ -231,11 +231,11 @@
where_< mlc::and_<
mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ >,
// FIXME: Shouldn't we use stc::is_found (resp. mlc::is_found) here?
-# ifdef OLENA_USE_NEW_SCOOP2
+# ifdef OLENA_USE_SCOOP_ALT
mlc::neq_< oln_deduce_vtype(E, topo, bbox), stc::not_found >
# else
mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found >
-# endif // OLENA_USE_NEW_SCOOP2
+# endif // OLENA_USE_SCOOP_ALT
> >
{
typedef abstract::classical_image<E> ret;
Index: oln/core/abstract/image/mutability/hierarchy.hh
--- oln/core/abstract/image/mutability/hierarchy.hh (revision 726)
+++ oln/core/abstract/image/mutability/hierarchy.hh (working copy)
@@ -108,11 +108,11 @@
/// With mutability.
template <typename E>
struct case_< image_hierarchy_wrt_mutability, E, 1 > :
-# ifdef OLENA_USE_NEW_SCOOP2
+# ifdef OLENA_USE_SCOOP_ALT
where_< stc::is_found_< oln_find_vtype(E, lvalue) > >
# else
where_< mlc::is_found_< oln_find_vtype(E, lvalue) > >
-# endif // OLENA_USE_NEW_SCOOP2
+# endif // OLENA_USE_SCOOP_ALT
{
typedef abstract::mutable_image<E> ret;
};
Index: oln/core/abstract/image/dimension/hierarchy.hh
--- oln/core/abstract/image/dimension/hierarchy.hh (revision 726)
+++ oln/core/abstract/image/dimension/hierarchy.hh (working copy)
@@ -98,11 +98,11 @@
struct case_< image_hierarchy_wrt_dimension, E, 1 > :
where_< mlc::and_<
mlc::eq_< oln_grid(E), oln::grid1d >,
-# ifdef OLENA_USE_NEW_SCOOP2
+# ifdef OLENA_USE_SCOOP_ALT
stc::is_found_< oln_find_vtype(E, lvalue) >
# else
mlc::is_found_< oln_find_vtype(E, lvalue) >
-# endif // OLENA_USE_NEW_SCOOP2
+# endif // OLENA_USE_SCOOP_ALT
> >
{
typedef abstract::mutable_image1d<E> ret;
@@ -121,11 +121,11 @@
struct case_< image_hierarchy_wrt_dimension, E, 3 > :
where_< mlc::and_<
mlc::eq_< oln_grid(E), oln::grid2d >,
-# ifdef OLENA_USE_NEW_SCOOP2
+# ifdef OLENA_USE_SCOOP_ALT
stc::is_found_< oln_find_vtype(E, lvalue) >
# else
mlc::is_found_< oln_find_vtype(E, lvalue) >
-# endif // OLENA_USE_NEW_SCOOP2
+# endif // OLENA_USE_SCOOP_ALT
> >
{
typedef abstract::mutable_image2d<E> ret;
@@ -144,11 +144,11 @@
struct case_< image_hierarchy_wrt_dimension, E, 5 > :
where_< mlc::and_<
mlc::eq_< oln_grid(E), oln::grid3d >,
-# ifdef OLENA_USE_NEW_SCOOP2
+# ifdef OLENA_USE_SCOOP_ALT
stc::is_found_< oln_find_vtype(E, lvalue) >
# else
mlc::is_found_< oln_find_vtype(E, lvalue) >
-# endif // OLENA_USE_NEW_SCOOP2
+# endif // OLENA_USE_SCOOP_ALT
> >
{
typedef abstract::mutable_image3d<E> ret;
Index: oln/core/abstract/image/neighborhood/hierarchy.hh
--- oln/core/abstract/image/neighborhood/hierarchy.hh (revision 726)
+++ oln/core/abstract/image/neighborhood/hierarchy.hh (working copy)
@@ -107,11 +107,11 @@
template <typename E>
struct case_< image_hierarchy_wrt_neighborhood, E, 1 > :
// FIXME: Shouldn't we use stc::is_found (resp. mlc::is_found) here?
-# ifdef OLENA_USE_NEW_SCOOP2
+# ifdef OLENA_USE_SCOOP_ALT
where_< mlc::neq_< oln_find_vtype(E, neighborhood), stc::not_found > >
# else
where_< mlc::neq_< oln_find_vtype(E, neighborhood), mlc::not_found > >
-# endif // OLENA_USE_NEW_SCOOP2
+# endif // OLENA_USE_SCOOP_ALT
{
typedef abstract::image_having_neighborhood<E> ret;
};
Index: oln/core/abstract/image/bbox/hierarchy.hh
--- oln/core/abstract/image/bbox/hierarchy.hh (revision 726)
+++ oln/core/abstract/image/bbox/hierarchy.hh (working copy)
@@ -136,11 +136,11 @@
template <typename E>
struct case_< image_hierarchy_wrt_bbox, E, 1 > :
// FIXME: Shouldn't we use stc::is_found (resp. mlc::is_found) here?
-# ifdef OLENA_USE_NEW_SCOOP2
+# ifdef OLENA_USE_SCOOP_ALT
where_< mlc::neq_< oln_deduce_vtype(E, topo, bbox), stc::not_found > >
# else
where_< mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found > >
-# endif // OLENA_USE_NEW_SCOOP2
+# endif // OLENA_USE_SCOOP_ALT
{
typedef abstract::image_having_bbox<E> ret;
};
Index: oln/core/abstract/image/value_wise_accessibility/hierarchy.hh
--- oln/core/abstract/image/value_wise_accessibility/hierarchy.hh (revision 726)
+++ oln/core/abstract/image/value_wise_accessibility/hierarchy.hh (working copy)
@@ -133,7 +133,7 @@
/// With mutable value-wise random accessibility.
template <typename E>
struct case_< image_hierarchy_wrt_value_wise_accessibility, E, 1 > :
-# ifdef OLENA_USE_NEW_SCOOP2
+# ifdef OLENA_USE_SCOOP_ALT
where_<
mlc_and( stc::is_found_< oln_find_vtype(E, fwd_viter) >,
stc::is_found_< oln_find_vtype(E, mutable_value_proxy) > )
@@ -143,7 +143,7 @@
mlc_and( mlc::is_found_< oln_find_vtype(E, fwd_viter) >,
mlc::is_found_< oln_find_vtype(E, mutable_value_proxy) > )
>
-# endif // OLENA_USE_NEW_SCOOP2
+# endif // OLENA_USE_SCOOP_ALT
{
typedef abstract::mutable_image_being_value_wise_random_accessible<E> ret;
};
@@ -151,11 +151,11 @@
/// With (constant) value-wise random accessibility.
template <typename E>
struct case_< image_hierarchy_wrt_value_wise_accessibility, E, 2 > :
-# ifdef OLENA_USE_NEW_SCOOP2
+# ifdef OLENA_USE_SCOOP_ALT
where_< stc::is_found_< oln_find_vtype(E, fwd_viter) > >
# else
where_< mlc::is_found_< oln_find_vtype(E, fwd_viter) > >
-# endif // OLENA_USE_NEW_SCOOP2
+# endif // OLENA_USE_SCOOP_ALT
{
typedef abstract::image_being_value_wise_random_accessible<E> ret;
};
Index: oln/core/abstract/point.hh
--- oln/core/abstract/point.hh (revision 726)
+++ oln/core/abstract/point.hh (working copy)
@@ -69,18 +69,18 @@
// FIXME: Prefer to use final<deduce..> when possible.
typedef stc::abstract grid_type;
typedef stc::abstract dpoint_type;
-# ifndef OLENA_USE_NEW_SCOOP2
+# ifndef OLENA_USE_SCOOP_ALT
typedef oln_deduce_deferred_vtype(E, dpoint, coord) coord_type;
-# endif // !OLENA_USE_NEW_SCOOP2
+# endif // !OLENA_USE_SCOOP_ALT
typedef stc::abstract dim_type;
-# ifndef OLENA_USE_NEW_SCOOP2
+# ifndef OLENA_USE_SCOOP_ALT
typedef oln_dim(E) dim_t;
typedef xtd::vec<mlc_value(dim_t), coord_type> vec_type;
-# endif // !OLENA_USE_NEW_SCOOP2
+# endif // !OLENA_USE_SCOOP_ALT
};
-# ifdef OLENA_USE_NEW_SCOOP2
+# ifdef OLENA_USE_SCOOP_ALT
template <typename E>
struct single_vtype< abstract::point<E>, typedef_::coord_type>
{
@@ -96,7 +96,7 @@
public:
typedef xtd::vec<mlc_value(dim_t), coord_t> ret;
};
-# endif // OLENA_USE_NEW_SCOOP2
+# endif // OLENA_USE_SCOOP_ALT
namespace abstract
Index: oln/core/internal/dpoint_nd.hh
--- oln/core/internal/dpoint_nd.hh (revision 726)
+++ oln/core/internal/dpoint_nd.hh (working copy)
@@ -54,16 +54,16 @@
template <typename E>
struct vtypes< internal::dpoint_nd<E> >
{
-# ifndef OLENA_USE_NEW_SCOOP2
+# ifndef OLENA_USE_SCOOP_ALT
private:
typedef oln_deferred_vtype(E, dim) dim_t;
typedef oln_deferred_vtype(E, coord) coord_t;
public:
typedef xtd::vec<mlc_value(dim_t), coord_t> vec_type;
-# endif // !OLENA_USE_NEW_SCOOP2
+# endif // !OLENA_USE_SCOOP_ALT
};
-# ifdef OLENA_USE_NEW_SCOOP2
+# ifdef OLENA_USE_SCOOP_ALT
template <typename E>
struct single_vtype< internal::dpoint_nd<E>, typedef_::vec_type >
{
@@ -73,7 +73,7 @@
public:
typedef xtd::vec<mlc_value(dim_t), coord_t> ret;
};
-# endif // OLENA_USE_NEW_SCOOP2
+# endif // OLENA_USE_SCOOP_ALT
namespace internal
{
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/static
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Rename stc/scoop2.hh as stc/scoop-alt.hh.
Encapsulate the contents of SCOOPED_NAMESPACE in
stc_scoop_equipment_for_namespace.
* stc/scoop2.hh: Rename as...
* stc/scoop-alt.hh: ...this.
Adjust header guards.
(ERROR::IN_find__VIRTUAL_TYPE_IS_ABSTRACT)
(ERROR::IN_find_local__VIRTUAL_TYPE_MULTIPLY_DEFINED)
(ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT)
(ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED_FINAL)
(ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED)
(ERROR::IN_merge2__VIRTUAL_TYPE_REDEFINED_ABSTRACT)
(ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT)
(ERROR::IN_merge3__VIRTUAL_TYPE_REDEFINED_ABSTRACT)
(ERROR::IN_merge3__LOCAL_DECLARATION_OF_NOT_DELEGATED_AND_ABSTRACT)
(ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED_FINAL)
(ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED): Rename as...
(ERROR::IN_find_VIRTUAL_TYPE_IS_ABSTRACT)
(ERROR::IN_find_local_VIRTUAL_TYPE_MULTIPLY_DEFINED)
(ERROR::IN_merge2_FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT)
(ERROR::IN_merge2_FINAL_VIRTUAL_TYPE_REDEFINED_FINAL)
(ERROR::IN_merge2_FINAL_VIRTUAL_TYPE_REDEFINED)
(ERROR::IN_merge2_VIRTUAL_TYPE_REDEFINED_ABSTRACT)
(ERROR::IN_merge3_FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT)
(ERROR::IN_merge3_VIRTUAL_TYPE_REDEFINED_ABSTRACT)
(ERROR::IN_merge3_LOCAL_DECLARATION_OF_NOT_DELEGATED_AND_ABSTRACT)
(ERROR::IN_merge3_FINAL_VIRTUAL_TYPE_REDEFINED_FINAL)
(ERROR::IN_merge3_FINAL_VIRTUAL_TYPE_REDEFINED): ...these.
(SCOOPED_NAMESPACE): Remove macro.
(stc_scoop_equipment_for_namespace): New macro.
Encapsulate the contents of SCOOPED_NAMESPACE within this macro.
(stc_match_pair_0p_with, stc_match_pair_1p_with)
(stc_match_pair_2p_with, stc_match_pair_1p_with_error)
(stc_match_pair_2p_with_error)
(stc_match_triple_0p_with, stc_match_triple_1p_with)
(stc_match_triple_2p_with, stc_match_triple_3p_with)
(stc_match_triple_2p_with_error, stc_match_triple_3p_with_error):
Move and rename these macros as..
* stc/internal/match-with.hh (stc_internal_match_pair_0p_with)
(stc_internal_match_pair_1p_with, stc_internal_match_pair_2p_with)
(stc_internal_match_pair_1p_with_error)
(stc_internal_match_pair_2p_with_error)
(stc_internal_match_triple_0p_with)
(stc_internal_match_triple_1p_with)
(stc_internal_match_triple_2p_with)
(stc_internal_match_triple_3p_with)
(stc_internal_match_triple_2p_with_error)
(stc_internal_match_triple_3p_with_error): ...these (new file).
* stc/Makefile (nobase_stc_HEADERS): Remove scoop2.hh.
Add scoop-alt.hh and internal/match-with.hh.
* tests/scoop2.cc: Rename as...
* tests/scoop-alt.cc: ...this.
Adjust.
(stc_scoop_equipment_for_namespace): Invoke it.
* tests/super.cc (my::set_pseudosuper_type<C>): Remove.
(my::vtypes<C>::delegatee_type): New.
* tests/Makefile.am (nobase_stc_HEADERS): Add
internal/match-with.hh.
(scoop2_SOURCES): Remove.
(scoop_alt_SOURCES): New.
stc/Makefile.am | 4
stc/internal/match-with.hh | 128 ++++
stc/scoop-alt.hh | 1199 +++++++++++++++++++++------------------------
tests/Makefile.am | 4
tests/scoop-alt.cc | 7
tests/super.cc | 6
6 files changed, 699 insertions(+), 649 deletions(-)
Index: tests/super.cc
--- tests/super.cc (revision 725)
+++ tests/super.cc (working copy)
@@ -80,11 +80,11 @@
simple test, but it doesn't matter: we are only checking the
super relationship here. */
- /// Link to B (``pseudo'' inheritance).
+ /// Delegation to B (used to be called ``pseudo'' inheritance).
template<>
- struct set_pseudosuper_type<C>
+ struct vtypes<C>
{
- typedef B ret;
+ typedef B delegatee_type;
};
struct C // no inheritance
Index: tests/scoop-alt.cc
--- tests/scoop-alt.cc (revision 724)
+++ tests/scoop-alt.cc (working copy)
@@ -35,14 +35,11 @@
#include <mlc/cmp.hh>
#include <mlc/assert.hh>
-#include <stc/scoop2.hh>
+#include <stc/scoop-alt.hh>
-/* FIXME: To be enabled later, when the contents of stc/scoop2.hh is
- enclosed in a macro. */
-#if 0
// Namespace equipment.
stc_scoop_equipment_for_namespace(my);
-#endif
+
// FIXME: Check single_vtype, too.
Index: tests/Makefile.am
--- tests/Makefile.am (revision 725)
+++ tests/Makefile.am (working copy)
@@ -23,7 +23,7 @@
\
tour \
\
- scoop2
+ scoop-alt
any_SOURCES = any.cc
@@ -36,7 +36,7 @@
tour_SOURCES = tour.cc
-scoop2_SOURCES = scoop2.cc
+scoop_alt_SOURCES = scoop-alt.cc
# Old tests.
EXTRA_DIST = multiple-supers.cc vtypes-multiple-supers.cc
Index: stc/scoop-alt.hh
--- stc/scoop-alt.hh (revision 724)
+++ stc/scoop-alt.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2005, 2006 EPITA Research and Development Laboratory
+// Copyright (C) 2005, 2006, 2007 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
@@ -25,23 +25,28 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/* \file stc/vtypes.hh
- \brief Equipment for SCOOP 2 (in particular, virtual types). */
+/* \file stc/scoop-alt.hh
-#ifndef STC_SCOOP2_HH
-# define STC_SCOOP2_HH
+ \brief Alternative equipment for SCOOP 2 (in particular, virtual
+ types). */
+
+
+#ifndef STC_SCOOP_ALT_HH
+# define STC_SCOOP_ALT_HH
# include <mlc/flags.hh>
# include <mlc/typedef.hh>
# include <mlc/abort.hh>
+# include <stc/internal/match-with.hh>
+
namespace stc
{
/* FIXME: Define a real stc::none, instead of making it an alias of
mlc::none. For compatibility purpose with the current
- implementation of the SCOOP 2 paradigme (see stc/scoop.hh), we
+ implementation of the SCOOP 2 paradigm (see stc/scoop.hh), we
need to have stc::none be equal to mlc::none. */
#if 0
struct none {};
@@ -73,20 +78,20 @@
namespace ERROR
{
- struct IN_find__VIRTUAL_TYPE_IS_ABSTRACT;
+ struct IN_find_VIRTUAL_TYPE_IS_ABSTRACT;
- struct IN_find_local__VIRTUAL_TYPE_MULTIPLY_DEFINED;
+ struct IN_find_local_VIRTUAL_TYPE_MULTIPLY_DEFINED;
- struct IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT;
- struct IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED_FINAL;
- struct IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED;
- struct IN_merge2__VIRTUAL_TYPE_REDEFINED_ABSTRACT;
-
- struct IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT;
- struct IN_merge3__VIRTUAL_TYPE_REDEFINED_ABSTRACT;
- struct IN_merge3__LOCAL_DECLARATION_OF_NOT_DELEGATED_AND_ABSTRACT;
- struct IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED_FINAL;
- struct IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED;
+ struct IN_merge2_FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT;
+ struct IN_merge2_FINAL_VIRTUAL_TYPE_REDEFINED_FINAL;
+ struct IN_merge2_FINAL_VIRTUAL_TYPE_REDEFINED;
+ struct IN_merge2_VIRTUAL_TYPE_REDEFINED_ABSTRACT;
+
+ struct IN_merge3_FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT;
+ struct IN_merge3_VIRTUAL_TYPE_REDEFINED_ABSTRACT;
+ struct IN_merge3_LOCAL_DECLARATION_OF_NOT_DELEGATED_AND_ABSTRACT;
+ struct IN_merge3_FINAL_VIRTUAL_TYPE_REDEFINED_FINAL;
+ struct IN_merge3_FINAL_VIRTUAL_TYPE_REDEFINED;
} // end of namespace ERROR
@@ -97,631 +102,551 @@
// Based on doc/algorithm.ml.
-// FIXME: Temp. hack. The contents of SCOOPED_NAMESPACE will be
-// available later as a macro, as in stc/scoop.hh. Currently, it's
-// easier to work without this macro equipment.
-#define SCOOPED_NAMESPACE oln
-
-
-// ------------------------------------------------------------ find_local.
-
-// Highly inspired from Th�o's get_stm!
-
-namespace SCOOPED_NAMESPACE
-{
-
- // Declare delegatee_type.
- mlc_decl_typedef(delegatee_type);
-
-
- template <typename class_name>
- struct set_super_type
- {
- };
-
- template <typename class_name>
- struct vtypes
- {
- };
-
- template <typename class_name, typename type_name>
- struct single_vtype
- {
- typedef mlc::not_found ret;
- };
-
- namespace find_local_
- {
- // Forward declaration.
- template <typename T, typename U> struct match_with;
-
- template <typename T>
- struct match_with <T, mlc::not_found>
- {
- typedef T ret;
- };
-
- template <typename U>
- struct match_with <mlc::not_found, U>
- {
- typedef U ret;
- };
-
- template <>
- struct match_with <mlc::not_found, mlc::not_found>
- {
- typedef stc::not_found ret;
- };
-
- template <typename T, typename U>
- struct match_with :
- mlc::abort_<T, stc::ERROR::IN_find_local__VIRTUAL_TYPE_MULTIPLY_DEFINED>
- {
- };
-
- } // end of namespace find_local_
-
- template <typename source, typename target>
- struct find_local
- {
- typedef SCOOPED_NAMESPACE::vtypes<source> decl1;
- typedef typename target::template from_<decl1>::ret res1;
-
- typedef SCOOPED_NAMESPACE::single_vtype<source, target> decl2;
- typedef typename decl2::ret ret2;
- // Result.
- typedef typename find_local_::match_with<res1, ret2>::ret ret;
- };
-
-
- // -------------------------------------------------------------- merge2.
-
-// Shortcuts macros.
-#define stc_match_pair_0p_with(Local, Super, Res) \
+#define stc_scoop_equipment_for_namespace(SCOOPED_NAMESPACE) \
+ \
+namespace SCOOPED_NAMESPACE \
+{ \
+ \
+ /* Declare delegatee_type. */ \
+ mlc_decl_typedef(delegatee_type); \
+ \
+ \
+ template <typename class_name> \
+ struct set_super_type \
+ { \
+ }; \
+ \
+ template <typename class_name> \
+ struct vtypes \
+ { \
+ }; \
+ \
+ template <typename class_name, typename type_name> \
+ struct single_vtype \
+ { \
+ typedef mlc::not_found ret; \
+ }; \
+ \
+ /* ----------------------------------------------------- find_local. */ \
+ \
+ /* Highly inspired from Th�o's get_stm! */ \
+ \
+ namespace find_local_ \
+ { \
+ /* Forward declaration. */ \
+ template <typename T, typename U> struct match_with; \
+ \
+ template <typename T> \
+ struct match_with <T, mlc::not_found> \
+ { \
+ typedef T ret; \
+ }; \
+ \
+ template <typename U> \
+ struct match_with <mlc::not_found, U> \
+ { \
+ typedef U ret; \
+ }; \
+ \
template <> \
- struct match_with< Local, Super > \
- { \
- typedef Res ret; \
- }
-
-#define stc_match_pair_1p_with(T1, Local, Super, Res) \
- template < typename T1 > \
- struct match_with< Local, Super > \
- { \
- typedef Res ret; \
- }
-
-#define stc_match_pair_2p_with(T1, T2, Local, Super, Res) \
- template < typename T1, typename T2 > \
- struct match_with< Local, Super > \
- { \
- typedef Res ret; \
- }
-
-// Erroneous cases.
-#define stc_match_pair_1p_with_error(T1, Local, Super, Msg) \
- template < typename T1 > \
- struct match_with< Local, Super > : \
- mlc::abort_< T1, Msg > \
- { \
- }
-
-#define stc_match_pair_2p_with_error(T1, T2, Local, Super, Msg) \
- template < typename T1, typename T2 > \
- struct match_with< Local, Super > : \
- mlc::abort_< T2, Msg > \
+ struct match_with <mlc::not_found, mlc::not_found> \
{ \
- }
-
-
- namespace merge2_
- {
- // Forward declaration.
- template <typename T, typename U> struct match_with;
-
-
- /*------------------------------.
- | local_res == stc::not_found. |
- `------------------------------*/
-
- stc_match_pair_0p_with(stc::not_found, stc::not_found,
- stc::not_found);
-
- stc_match_pair_0p_with(stc::not_found, stc::abstract,
- stc::not_found);
-
- stc_match_pair_1p_with(U,
- stc::not_found, stc::final<U>,
- stc::final<U>);
-
- stc_match_pair_1p_with(U,
- stc::not_found, U,
- U);
-
-
- /*-----------------------------.
- | local_res == stc::abstract. |
- `-----------------------------*/
-
- stc_match_pair_0p_with(stc::abstract, stc::not_found,
- stc::abstract);
-
- stc_match_pair_0p_with(stc::abstract, stc::abstract,
- stc::abstract);
-
- stc_match_pair_1p_with_error(U,
- stc::abstract, stc::final<U>,
- stc::ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT);
-
- stc_match_pair_1p_with_error(U,
- stc::abstract, U,
- stc::ERROR::IN_merge2__VIRTUAL_TYPE_REDEFINED_ABSTRACT);
-
-
- /*-----------------------------.
- | local_res == stc::final<T>. |
- `-----------------------------*/
-
- stc_match_pair_1p_with(T,
- stc::final<T>, stc::not_found,
- stc::final<T>);
-
- stc_match_pair_1p_with(T,
- stc::final<T>, stc::abstract,
- stc::final<T>);
-
- stc_match_pair_2p_with_error(T, U,
- stc::final<T>, stc::final<U>,
- stc::ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED_FINAL);
-
- stc_match_pair_2p_with(T, U,
- stc::final<T>, U,
- stc::final<T>);
-
-
- /*-----------------.
- | local_res == T. |
- `-----------------*/
-
- stc_match_pair_1p_with(T,
- T, stc::not_found,
- T);
-
- stc_match_pair_1p_with(T,
- T, stc::abstract,
- T);
-
- stc_match_pair_2p_with_error(T, U,
- T, stc::final<U>,
- stc::ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED);
-
- template <typename T, typename U>
- struct match_with
- {
- typedef T ret;
- };
-
- } // end of namespace merge2_
-
-#undef stc_match_pair_2p_with_error
-#undef stc_match_pair_1p_with_error
-#undef stc_match_pair_2p_with
-#undef stc_match_pair_1p_with
-#undef stc_match_pair_0p_with
-
- template <typename local_res, typename super_res>
- struct merge2
- {
- // Result.
- typedef typename merge2_::match_with<local_res, super_res>::ret ret;
- };
-
-
- // -------------------------------------------------------------- merge3.
-
-// Shortcuts macros.
-#define stc_match_triple_0p_with(Local, Super, Deleg, Res) \
+ typedef stc::not_found ret; \
+ }; \
+ \
+ template <typename T, typename U> \
+ struct match_with : \
+ mlc::abort_<T, \
+ stc::ERROR::IN_find_local_VIRTUAL_TYPE_MULTIPLY_DEFINED> \
+ { \
+ }; \
+ \
+ } /* end of namespace find_local_ */ \
+ \
+ template <typename source, typename target> \
+ struct find_local \
+ { \
+ typedef SCOOPED_NAMESPACE::vtypes<source> decl1; \
+ typedef typename target::template from_<decl1>::ret res1; \
+ \
+ typedef SCOOPED_NAMESPACE::single_vtype<source, target> decl2; \
+ typedef typename decl2::ret ret2; \
+ \
+ \
+ /* Result. */ \
+ typedef typename find_local_::match_with<res1, ret2>::ret ret; \
+ }; \
+ \
+ \
+ /* --------------------------------------------------------- merge2. */ \
+ \
+ \
+ namespace merge2_ \
+ { \
+ /* Forward declaration. */ \
+ template <typename T, typename U> struct match_with; \
+ \
+ \
+ /* ----------------------------- */ \
+ /* local_res == stc::not_found. */ \
+ /* ----------------------------- */ \
+ \
+ stc_internal_match_pair_0p_with(stc::not_found, stc::not_found, \
+ stc::not_found); \
+ \
+ stc_internal_match_pair_0p_with(stc::not_found, stc::abstract, \
+ stc::not_found); \
+ \
+ stc_internal_match_pair_1p_with(U, \
+ stc::not_found, stc::final<U>, \
+ stc::final<U>); \
+ \
+ stc_internal_match_pair_1p_with(U, \
+ stc::not_found, U, \
+ U); \
+ \
+ \
+ /* ---------------------------- */ \
+ /* local_res == stc::abstract. */ \
+ /* ---------------------------- */ \
+ \
+ stc_internal_match_pair_0p_with(stc::abstract, stc::not_found, \
+ stc::abstract); \
+ \
+ stc_internal_match_pair_0p_with(stc::abstract, stc::abstract, \
+ stc::abstract); \
+ \
+ stc_internal_match_pair_1p_with_error(U, \
+ stc::abstract, stc::final<U>, \
+ stc::ERROR::IN_merge2_FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT); \
+ \
+ stc_internal_match_pair_1p_with_error(U, \
+ stc::abstract, U, \
+ stc::ERROR::IN_merge2_VIRTUAL_TYPE_REDEFINED_ABSTRACT); \
+ \
+ \
+ /* ---------------------------- */ \
+ /* local_res == stc::final<T>. */ \
+ /* ---------------------------- */ \
+ \
+ stc_internal_match_pair_1p_with(T, \
+ stc::final<T>, stc::not_found, \
+ stc::final<T>); \
+ \
+ stc_internal_match_pair_1p_with(T, \
+ stc::final<T>, stc::abstract, \
+ stc::final<T>); \
+ \
+ stc_internal_match_pair_2p_with_error(T, U, \
+ stc::final<T>, stc::final<U>, \
+ stc::ERROR::IN_merge2_FINAL_VIRTUAL_TYPE_REDEFINED_FINAL); \
+ \
+ stc_internal_match_pair_2p_with(T, U, \
+ stc::final<T>, U, \
+ stc::final<T>); \
+ \
+ \
+ /* ---------------- */ \
+ /* local_res == T. */ \
+ /* ---------------- */ \
+ \
+ stc_internal_match_pair_1p_with(T, \
+ T, stc::not_found, \
+ T); \
+ \
+ stc_internal_match_pair_1p_with(T, \
+ T, stc::abstract, \
+ T); \
+ \
+ stc_internal_match_pair_2p_with_error(T, U, \
+ T, stc::final<U>, \
+ stc::ERROR::IN_merge2_FINAL_VIRTUAL_TYPE_REDEFINED); \
+ \
+ template <typename T, typename U> \
+ struct match_with \
+ { \
+ typedef T ret; \
+ }; \
+ \
+ } /* end of namespace merge2_ */ \
+ \
+ template <typename local_res, typename super_res> \
+ struct merge2 \
+ { \
+ /* Result. */ \
+ typedef typename merge2_::match_with<local_res, super_res>::ret ret; \
+ }; \
+ \
+ \
+ /* --------------------------------------------------------- merge3. */ \
+ \
+ \
+ namespace merge3_ \
+ { \
+ /* Forward declaration. */ \
+ template <typename T, typename U, typename V> struct match_with; \
+ \
+ \
+ /* ----------------------------- */ \
+ /* local_res == stc::not_found. */ \
+ /* ----------------------------- */ \
+ \
+ /* super_res == stc::not_found. */ \
+ stc_internal_match_triple_0p_with( \
+ stc::not_found, stc::not_found, stc::not_found, \
+ stc::not_found); \
+ \
+ stc_internal_match_triple_0p_with( \
+ stc::not_found, stc::not_found, stc::abstract, \
+ stc::not_found); \
+ \
+ stc_internal_match_triple_1p_with(V, \
+ stc::not_found, stc::not_found, stc::final<V>, \
+ stc::final<V>); \
+ \
+ stc_internal_match_triple_1p_with(V, \
+ stc::not_found, stc::not_found, V, \
+ V); \
+ \
+ /* super_res == stc::abstract. */ \
+ stc_internal_match_triple_0p_with( \
+ stc::not_found, stc::abstract, stc::not_found, \
+ stc::not_found); \
+ \
+ stc_internal_match_triple_0p_with( \
+ stc::not_found, stc::abstract, stc::abstract, \
+ stc::abstract); \
+ \
+ stc_internal_match_triple_1p_with(V, \
+ stc::not_found, stc::abstract, stc::final<V>, \
+ stc::final<V>); \
+ \
+ stc_internal_match_triple_1p_with(V, \
+ stc::not_found, stc::abstract, V, \
+ V); \
+ \
+ /* super_res is a concrete type. */ \
+ stc_internal_match_triple_2p_with(U, V, \
+ stc::not_found, stc::final<U>, V, \
+ stc::final<U>); \
+ \
+ stc_internal_match_triple_2p_with(U, V, \
+ stc::not_found, U, V, \
+ U); \
+ \
+ \
+ /* ---------------------------- */ \
+ /* local_res == stc::abstract. */ \
+ /* ---------------------------- */ \
+ \
+ /* super_res == stc::not_found. */ \
+ stc_internal_match_triple_0p_with( \
+ stc::abstract, stc::not_found, stc::not_found, \
+ stc::abstract); \
+ \
+ stc_internal_match_triple_0p_with( \
+ stc::abstract, stc::not_found, stc::abstract, \
+ stc::abstract); \
+ \
+ stc_internal_match_triple_1p_with(V, \
+ stc::abstract, stc::not_found, stc::final<V>, \
+ stc::final<V>); \
+ \
+ stc_internal_match_triple_1p_with(V, \
+ stc::abstract, stc::not_found, V, \
+ V); \
+ \
+ \
+ /* super_res == stc::abstract. */ \
+ stc_internal_match_triple_0p_with( \
+ stc::abstract, stc::abstract, stc::not_found, \
+ stc::abstract); \
+ \
+ stc_internal_match_triple_0p_with( \
+ stc::abstract, stc::abstract, stc::abstract, \
+ stc::abstract); \
+ \
+ stc_internal_match_triple_1p_with(V, \
+ stc::abstract, stc::abstract, stc::final<V>, \
+ stc::final<V>); \
+ \
+ stc_internal_match_triple_1p_with(V, \
+ stc::abstract, stc::abstract, V, \
+ V); \
+ \
+ \
+ /* super_res == stc::not_delegated_abstract. */ \
+ stc_internal_match_triple_1p_with(V, \
+ stc::abstract, stc::not_delegated_abstract, V, \
+ stc::not_delegated_abstract); \
+ \
+ stc_internal_match_triple_1p_with(V, \
+ stc::abstract, stc::not_delegated, V, \
+ stc::not_delegated_abstract); \
+ \
+ \
+ /* super_res is a concrete type. */ \
+ stc_internal_match_triple_2p_with_error(U, V, \
+ stc::abstract, stc::final<U>, V, \
+ stc::ERROR::IN_merge3_FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT); \
+ \
+ stc_internal_match_triple_2p_with_error(U, V, \
+ stc::abstract, U, V, \
+ stc::ERROR::IN_merge3_VIRTUAL_TYPE_REDEFINED_ABSTRACT); \
+ \
+ \
+ /* --------------------------------- */ \
+ /* local_res == stc::not_delegated. */ \
+ /* --------------------------------- */ \
+ \
+ stc_internal_match_triple_1p_with(V, \
+ stc::not_delegated, stc::not_found, V, \
+ stc::not_delegated); \
+ \
+ stc_internal_match_triple_1p_with(V, \
+ stc::not_delegated, stc::abstract, V, \
+ stc::not_delegated_abstract); \
+ \
+ stc_internal_match_triple_1p_with(V, \
+ stc::not_delegated, stc::not_delegated_abstract, V, \
+ stc::not_delegated_abstract); \
+ \
+ \
+ /* ------------------------------------------ */ \
+ /* local_res == stc::not_delegated_abstract. */ \
+ /* ------------------------------------------ */ \
+ \
+ /* FIXME: Shouldn't we introduce a means to tag a vtype both as */ \
+ /* abstract *and* not delegated? (Currently, the rule below */ \
+ /* prevents this). */ \
+ stc_internal_match_triple_2p_with_error(U, V, \
+ stc::not_delegated_abstract, U, V, \
+ stc::ERROR::IN_merge3_LOCAL_DECLARATION_OF_NOT_DELEGATED_AND_ABSTRACT); \
+ \
+ \
+ /* ---------------------------- */ \
+ /* local_res == stc::final<T>. */ \
+ /* ---------------------------- */ \
+ \
+ stc_internal_match_triple_3p_with_error(T, U, V, \
+ stc::final<T>, stc::final<U>, V, \
+ stc::ERROR::IN_merge3_FINAL_VIRTUAL_TYPE_REDEFINED_FINAL); \
+ \
+ stc_internal_match_triple_3p_with(T, U, V, \
+ stc::final<T>, U, V, \
+ stc::final<T>); \
+ \
+ \
+ /* ---------------- */ \
+ /* local_res == T. */ \
+ /* ---------------- */ \
+ \
+ stc_internal_match_triple_3p_with_error(T, U, V, \
+ T, stc::final<U>, V, \
+ stc::ERROR::IN_merge3_FINAL_VIRTUAL_TYPE_REDEFINED); \
+ \
+ template <typename T, typename U, typename V> \
+ struct match_with \
+ { \
+ typedef T ret; \
+ }; \
+ \
+ } /* end of namespace merge3_ */ \
+ \
+ \
+ template <typename local_res, typename super_res, typename delegatee_res> \
+ struct merge3 \
+ { \
+ /* Result. */ \
+ typedef typename \
+ merge3_::match_with<local_res, super_res, delegatee_res>::ret ret; \
+ }; \
+ \
+ \
+ /* ------------------------------------------------------ find_rec. */ \
+ \
+ /* Forward declarations. */ \
+ template <typename source, typename target> struct find_rec; \
+ template <typename source, typename target> struct find_rec_in_supers; \
+ \
+ \
+ namespace find_rec_ \
+ { \
+ \
+ namespace find_delegatee_res_ \
+ { \
+ /* Forward declaration. */ \
+ template <typename delegatee, typename target> struct match_with; \
+ \
+ template <typename target> \
+ struct match_with<stc::not_found, target> \
+ { \
+ typedef stc::not_found ret; \
+ }; \
+ \
+ template <typename target> \
+ struct match_with<stc::abstract, target> \
+ { \
+ typedef stc::not_found ret; \
+ }; \
+ \
+ template <typename delegatee, typename target> \
+ struct match_with \
+ { \
+ typedef typename find_rec<delegatee, target>::ret ret; \
+ }; \
+ \
+ } /* end of namespace find_delegatee_res_ */ \
+ \
+ \
+ /* Forward declaration. */ \
+ template <typename source, typename target> struct match_with; \
+ \
+ template <typename target> \
+ struct match_with<stc::none, target> \
+ { \
+ typedef stc::not_found ret; \
+ }; \
+ \
+ template <typename source, typename target> \
+ struct match_with \
+ { \
+ typedef typename find_local<source, target>::ret local_res; \
+ typedef typename find_rec<stc_super(source), target>::ret super_res; \
+ /* delegatee_type is the name of the (optional) virtual type */ \
+ /* containing the (type of the) delgatee. */ \
+ typedef typename \
+ find_rec_in_supers<source, typedef_::delegatee_type>::ret delegatee; \
+ \
+ typedef typename \
+ find_delegatee_res_::match_with<delegatee, target>::ret delegatee_res; \
+ typedef typename \
+ merge3<local_res, super_res, delegatee_res>::ret ret; \
+ }; \
+ \
+ } /* end of namespace find_rec_ */ \
+ \
+ template <typename source, typename target> \
+ struct find_rec \
+ { \
+ /* Result. */ \
+ typedef typename find_rec_::match_with<source, target>::ret ret; \
+ }; \
+ \
+ \
+ /* --------------------------------------------- find_rec_in_supers. */ \
+ \
+ namespace find_rec_in_supers_ \
+ { \
+ /* Forward declaration. */ \
+ template <typename source, typename target> struct match_with; \
+ \
+ template <typename target> \
+ struct match_with<stc::none, target> \
+ { \
+ typedef stc::none ret; \
+ }; \
+ \
+ template <typename source, typename target> \
+ struct match_with \
+ { \
+ typedef typename find_local<source, target>::ret local_res; \
+ typedef typename find_rec<stc_super(source), target>::ret super_res; \
+ typedef typename merge2<local_res, super_res>::ret ret; \
+ }; \
+ \
+ } /* end of namespace find_rec_in_supers_ */ \
+ \
+ template <typename source, typename target> \
+ struct find_rec_in_supers \
+ { \
+ /* Result. */ \
+ typedef typename \
+ find_rec_in_supers_::match_with<source, target>::ret ret; \
+ }; \
+ \
+ \
+ /* ----------------------------------------------------------- find. */ \
+ \
+ namespace find_ \
+ { \
+ /* Forward declaration. */ \
+ template <typename T> struct match_with; \
+ \
+ /* FIXME: We'd like to add a static abort here, but we can't, */ \
+ /* since stc::abstract is not a free parameter (enabling this */ \
+ /* abort statement would prevent any compilation). */ \
template <> \
- struct match_with< Local, Super, Deleg > \
- { \
- typedef Res ret; \
- }
-
-#define stc_match_triple_1p_with(T1, Local, Super, Deleg, Res) \
- template < typename T1 > \
- struct match_with< Local, Super, Deleg > \
- { \
- typedef Res ret; \
- }
-
-#define stc_match_triple_2p_with(T1, T2, Local, Super, Deleg, Res) \
- template < typename T1, typename T2 > \
- struct match_with< Local, Super, Deleg > \
- { \
- typedef Res ret; \
- }
-
-#define stc_match_triple_3p_with(T1, T2, T3, Local, Super, Deleg, Res) \
- template < typename T1, typename T2, typename T3 > \
- struct match_with< Local, Super, Deleg > \
- { \
- typedef Res ret; \
- }
-
-// Erroneous cases.
-#define stc_match_triple_2p_with_error(T1, T2, Local, Super, Deleg, Msg) \
- template < typename T1, typename T2 > \
- struct match_with< Local, Super, Deleg > : \
- mlc::abort_< T2, Msg > \
+ struct match_with<stc::abstract> \
+ /* : mlc::abort_<stc::abstract, \
+ stc::ERROR::IN_find_VIRTUAL_TYPE_IS_ABSTRACT> */ \
+ { \
+ }; \
+ \
+ /* FIXME: We'd like to add a static abort here, but we can't, */ \
+ /* since stc::not_delegated_abstract is not a free parameter */ \
+ /* (enabling this abort statement would prevent any */ \
+ /* compilation). */ \
+ template <> \
+ struct match_with<stc::not_delegated_abstract> \
+ /* : mlc::abort_<stc::not_delegated_abstract, */ \
+ /* stc::ERROR::IN_find_VIRTUAL_TYPE_IS_ABSTRACT> */ \
{ \
- }
-
-#define stc_match_triple_3p_with_error(T1, T2, T3, Local, Super, Deleg, Msg) \
- template < typename T1, typename T2, typename T3 > \
- struct match_with< Local, Super, Deleg > : \
- mlc::abort_< T3, Msg > \
+ }; \
+ \
+ template <> \
+ struct match_with<stc::not_delegated> \
{ \
- }
-
-
- namespace merge3_
- {
- // Forward declaration.
- template <typename T, typename U, typename V> struct match_with;
-
-
- /*------------------------------.
- | local_res == stc::not_found. |
- `------------------------------*/
-
- // super_res == stc::not_found.
- stc_match_triple_0p_with(stc::not_found, stc::not_found, stc::not_found,
- stc::not_found);
-
- stc_match_triple_0p_with(stc::not_found, stc::not_found, stc::abstract,
- stc::not_found);
-
- stc_match_triple_1p_with(V,
- stc::not_found, stc::not_found, stc::final<V>,
- stc::final<V>);
-
- stc_match_triple_1p_with(V,
- stc::not_found, stc::not_found, V,
- V);
-
- // super_res == stc::abstract.
- stc_match_triple_0p_with(stc::not_found, stc::abstract, stc::not_found,
- stc::not_found);
-
- stc_match_triple_0p_with(stc::not_found, stc::abstract, stc::abstract,
- stc::abstract);
-
- stc_match_triple_1p_with(V,
- stc::not_found, stc::abstract, stc::final<V>,
- stc::final<V>);
-
- stc_match_triple_1p_with(V,
- stc::not_found, stc::abstract, V,
- V);
-
- // super_res is a concrete type.
- stc_match_triple_2p_with(U, V,
- stc::not_found, stc::final<U>, V,
- stc::final<U>);
-
- stc_match_triple_2p_with(U, V,
- stc::not_found, U, V,
- U);
-
-
- /*-----------------------------.
- | local_res == stc::abstract. |
- `-----------------------------*/
-
- // super_res == stc::not_found.
- stc_match_triple_0p_with(stc::abstract, stc::not_found, stc::not_found,
- stc::abstract);
-
- stc_match_triple_0p_with(stc::abstract, stc::not_found, stc::abstract,
- stc::abstract);
-
- stc_match_triple_1p_with(V,
- stc::abstract, stc::not_found, stc::final<V>,
- stc::final<V>);
-
- stc_match_triple_1p_with(V,
- stc::abstract, stc::not_found, V,
- V);
-
-
- // super_res == stc::abstract.
- stc_match_triple_0p_with(stc::abstract, stc::abstract, stc::not_found,
- stc::abstract);
-
- stc_match_triple_0p_with(stc::abstract, stc::abstract, stc::abstract,
- stc::abstract);
-
- stc_match_triple_1p_with(V,
- stc::abstract, stc::abstract, stc::final<V>,
- stc::final<V>);
-
- stc_match_triple_1p_with(V,
- stc::abstract, stc::abstract, V,
- V);
-
-
- // super_res == stc::not_delegated_abstract.
- stc_match_triple_1p_with(V,
- stc::abstract, stc::not_delegated_abstract, V,
- stc::not_delegated_abstract);
-
- stc_match_triple_1p_with(V,
- stc::abstract, stc::not_delegated, V,
- stc::not_delegated_abstract);
-
-
- // super_res is a concrete type.
- stc_match_triple_2p_with_error(U, V,
- stc::abstract, stc::final<U>, V,
- stc::ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT);
-
- stc_match_triple_2p_with_error(U, V,
- stc::abstract, U, V,
- stc::ERROR::IN_merge3__VIRTUAL_TYPE_REDEFINED_ABSTRACT);
-
-
- /*----------------------------------.
- | local_res == stc::not_delegated. |
- `----------------------------------*/
-
- stc_match_triple_1p_with(V,
- stc::not_delegated, stc::not_found, V,
- stc::not_delegated);
-
- stc_match_triple_1p_with(V,
- stc::not_delegated, stc::abstract, V,
- stc::not_delegated_abstract);
-
- stc_match_triple_1p_with(V,
- stc::not_delegated, stc::not_delegated_abstract, V,
- stc::not_delegated_abstract);
-
-
- /*----------------------------------------------.
- | local_res == stc::not_delegated_abstract. *) |
- `----------------------------------------------*/
-
- /* FIXME: Shouldn't we introduce a means to tag a vtype both
- as abstract *and* not delegated? (Currently, the rule below
- prevents this). */
- stc_match_triple_2p_with_error(U, V,
- stc::not_delegated_abstract, U, V,
- stc::ERROR::IN_merge3__LOCAL_DECLARATION_OF_NOT_DELEGATED_AND_ABSTRACT);
-
-
- /*-----------------------------.
- | local_res == stc::final<T>. |
- `-----------------------------*/
-
- stc_match_triple_3p_with_error(T, U, V,
- stc::final<T>, stc::final<U>, V,
- stc::ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED_FINAL);
-
- stc_match_triple_3p_with(T, U, V,
- stc::final<T>, U, V,
- stc::final<T>);
-
-
- /*-----------------.
- | local_res == T. |
- `-----------------*/
-
- stc_match_triple_3p_with_error(T, U, V,
- T, stc::final<U>, V,
- stc::ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED);
-
- template <typename T, typename U, typename V>
- struct match_with
- {
- typedef T ret;
- };
-
- } // end of namespace merge3_
-
-
-#undef stc_match_triple_3p_with_error
-#undef stc_match_triple_2p_with_error
-#undef stc_match_triple_3p_with
-#undef stc_match_triple_2p_with
-#undef stc_match_triple_1p_with
-#undef stc_match_triple_0p_with
-
-
- template <typename local_res, typename super_res, typename delegatee_res>
- struct merge3
- {
- // Result.
- typedef typename merge3_::match_with<local_res, super_res, delegatee_res>::ret ret;
- };
-
-
- // ----------------------------------------------------------- find_rec.
-
- // Forward declarations.
- template <typename source, typename target> struct find_rec;
- template <typename source, typename target> struct find_rec_in_supers;
-
-
- namespace find_rec_
- {
-
- namespace find_delegatee_res_
- {
- // Forward declaration.
- template <typename delegatee, typename target> struct match_with;
-
- template <typename target>
- struct match_with<stc::not_found, target>
- {
- typedef stc::not_found ret;
- };
-
- template <typename target>
- struct match_with<stc::abstract, target>
- {
- typedef stc::not_found ret;
- };
-
- template <typename delegatee, typename target>
- struct match_with
- {
- typedef typename find_rec<delegatee, target>::ret ret;
- };
-
- } // end of namespace find_delegatee_res_
-
-
- // Forward declaration.
- template <typename source, typename target> struct match_with;
-
- template <typename target>
- struct match_with<stc::none, target>
- {
- typedef stc::not_found ret;
- };
-
- template <typename source, typename target>
- struct match_with
- {
- typedef typename find_local<source, target>::ret local_res;
- typedef typename find_rec<stc_super(source), target>::ret super_res;
- // delegatee_type is the name of the (optional) virtual type
- // containing the (type of the) delgatee.
- typedef typename find_rec_in_supers<source, typedef_::delegatee_type>::ret delegatee;
-
- typedef typename find_delegatee_res_::match_with<delegatee, target>::ret delegatee_res;
- typedef typename merge3<local_res, super_res, delegatee_res>::ret ret;
- };
-
- } // end of namespace find_rec_
-
- template <typename source, typename target>
- struct find_rec
- {
- // Result.
- typedef typename find_rec_::match_with<source, target>::ret ret;
- };
-
-
- // -------------------------------------------------- find_rec_in_supers.
-
- namespace find_rec_in_supers_
- {
- // Forward declaration.
- template <typename source, typename target> struct match_with;
-
- template <typename target>
- struct match_with<stc::none, target>
- {
- typedef stc::none ret;
- };
-
- template <typename source, typename target>
- struct match_with
- {
- typedef typename find_local<source, target>::ret local_res;
- typedef typename find_rec<stc_super(source), target>::ret super_res;
- typedef typename merge2<local_res, super_res>::ret ret;
- };
-
- } // end of namespace find_rec_in_supers_
-
- template <typename source, typename target>
- struct find_rec_in_supers
- {
- // Result.
- typedef typename find_rec_in_supers_::match_with<source, target>::ret ret;
- };
-
-
- // ---------------------------------------------------------------- find.
-
- namespace find_
- {
- // Forward declaration.
- template <typename T> struct match_with;
-
- template <>
- struct match_with<stc::abstract>
-/* FIXME: We'd like to add a static abort here, but we can't, since
- stc::abstract is not a free parameter (enabling this abort statement
- would prevent any compilation). */
-#if 0
- : mlc::abort_<stc::abstract,
- stc::ERROR::IN_find__VIRTUAL_TYPE_IS_ABSTRACT>
-#endif
- {
- };
-
- template <>
- struct match_with<stc::not_delegated_abstract>
-/* FIXME: We'd like to add a static abort here, but we can't, since
- stc::not_delegated_abstract is not a free parameter (enabling this
- abort statement would prevent any compilation). */
-#if 0
- : mlc::abort_<stc::not_delegated_abstract,
- stc::ERROR::IN_find__VIRTUAL_TYPE_IS_ABSTRACT>
-#endif
- {
- };
-
- template <>
- struct match_with<stc::not_delegated>
- {
- typedef stc::not_found ret;
- };
-
- template <typename T>
- struct match_with< stc::final<T> >
- {
- typedef T ret;
- };
-
- template <typename T>
- struct match_with
- {
- typedef T ret;
- };
-
- } // end of namespace find_
-
-
- /// Find a virtual type.
- template <typename source, typename target>
- struct find_vtype
- {
- typedef typename find_rec<source, target>::ret res;
- // Result.
- typedef typename find_::match_with<res>::ret ret;
- };
-
-
- /// Find a virtual type, and ensure it is found.
- template <typename from, typename target>
- struct vtype
- {
- typedef typename find_vtype<from, target>::ret res;
- struct check_ : mlc::assert_< mlc::is_found_<res> >
- {
- typedef res ret;
- };
- typedef typename check_::ret ret;
- };
-
-} /* end of SCOOPED_NAMESPACE */
-
+ typedef stc::not_found ret; \
+ }; \
+ \
+ template <typename T> \
+ struct match_with< stc::final<T> > \
+ { \
+ typedef T ret; \
+ }; \
+ \
+ template <typename T> \
+ struct match_with \
+ { \
+ typedef T ret; \
+ }; \
+ \
+ } /* end of namespace find_ */ \
+ \
+ \
+ /** Find a virtual type. */ \
+ template <typename source, typename target> \
+ struct find_vtype \
+ { \
+ typedef typename find_rec<source, target>::ret res; \
+ /* Result. */ \
+ typedef typename find_::match_with<res>::ret ret; \
+ }; \
+ \
+ \
+ /** Find a virtual type, and ensure it is found. */ \
+ template <typename from, typename target> \
+ struct vtype \
+ { \
+ typedef typename find_vtype<from, target>::ret res; \
+ struct check_ : mlc::assert_< mlc::is_found_<res> > \
+ { \
+ typedef res ret; \
+ }; \
+ typedef typename check_::ret ret; \
+ }; \
+ \
+} /* end of SCOOPED_NAMESPACE */ \
+ \
+struct e_n_d___w_i_t_h___s_e_m_i_c_o_l_o_n;
+
+
+/*------------------.
+| Shortcuts macro. |
+`------------------*/
// FIXME: Document all these macros.
@@ -782,4 +707,4 @@
>::ret
-#endif // ! STC_SCOOP2_HH
+#endif // ! STC_SCOOP_ALT_HH
Index: stc/Makefile.am
--- stc/Makefile.am (revision 725)
+++ stc/Makefile.am (working copy)
@@ -7,11 +7,11 @@
exact.hh \
find_exact.hh \
scoop.hh \
+ scoop-alt.hh \
valist_aggregator.hh \
\
internal/extract_vtype_from_list.hh \
- \
- scoop2.hh
+ internal/match-with.hh
# Old code.
EXTRA_DIST = was.scoop.hh
Index: stc/internal/match-with.hh
--- stc/internal/match-with.hh (revision 0)
+++ stc/internal/match-with.hh (revision 0)
@@ -0,0 +1,128 @@
+// Copyright (C) 2005, 2006, 2007 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.
+
+
+/* \file stc/match-with.hh
+ \brief Internal helpers for stc/scoop-alt.hh.
+
+ This file contains helpers that mimic a ``match-with'' (pattern
+ matching) construct from many functional languages. */
+
+
+#ifndef STC_INTERNAL_MATCH_WITH_HH
+# define STC_INTERNAL_MATCH_WITH_HH
+
+/*-----------------.
+| merge2 helpers. |
+`-----------------*/
+
+/* Shortcuts macros. */
+#define stc_internal_match_pair_0p_with(Local, Super, Res) \
+ template <> \
+ struct match_with< Local, Super > \
+ { \
+ typedef Res ret; \
+ }
+
+#define stc_internal_match_pair_1p_with(T1, Local, Super, Res) \
+ template < typename T1 > \
+ struct match_with< Local, Super > \
+ { \
+ typedef Res ret; \
+ }
+
+#define stc_internal_match_pair_2p_with(T1, T2, Local, Super, Res) \
+ template < typename T1, typename T2 > \
+ struct match_with< Local, Super > \
+ { \
+ typedef Res ret; \
+ }
+
+/* Erroneous cases. */
+#define stc_internal_match_pair_1p_with_error(T1, Local, Super, Msg) \
+ template < typename T1 > \
+ struct match_with< Local, Super > : \
+ mlc::abort_< T1, Msg > \
+ { \
+ }
+
+#define stc_internal_match_pair_2p_with_error(T1, T2, Local, Super, Msg) \
+ template < typename T1, typename T2 > \
+ struct match_with< Local, Super > : \
+ mlc::abort_< T2, Msg > \
+ { \
+ }
+
+/*-----------------.
+| merge3 helpers. |
+`-----------------*/
+
+/* Shortcuts macros. */
+#define stc_internal_match_triple_0p_with(Local, Super, Deleg, Res) \
+ template <> \
+ struct match_with< Local, Super, Deleg > \
+ { \
+ typedef Res ret; \
+ }
+
+#define stc_internal_match_triple_1p_with(T1, Local, Super, Deleg, Res) \
+ template < typename T1 > \
+ struct match_with< Local, Super, Deleg > \
+ { \
+ typedef Res ret; \
+ }
+
+#define stc_internal_match_triple_2p_with(T1, T2, Local, Super, Deleg, Res) \
+ template < typename T1, typename T2 > \
+ struct match_with< Local, Super, Deleg > \
+ { \
+ typedef Res ret; \
+ }
+
+#define stc_internal_match_triple_3p_with(T1, T2, T3, Local, Super, Deleg, Res) \
+ template < typename T1, typename T2, typename T3 > \
+ struct match_with< Local, Super, Deleg > \
+ { \
+ typedef Res ret; \
+ }
+
+/* Erroneous cases. */
+#define stc_internal_match_triple_2p_with_error(T1, T2, Local, Super, Deleg, Msg) \
+ template < typename T1, typename T2 > \
+ struct match_with< Local, Super, Deleg > : \
+ mlc::abort_< T2, Msg > \
+ { \
+ }
+
+#define stc_internal_match_triple_3p_with_error(T1, T2, T3, Local, Super, Deleg, Msg) \
+ template < typename T1, typename T2, typename T3 > \
+ struct match_with< Local, Super, Deleg > : \
+ mlc::abort_< T3, Msg > \
+ { \
+ }
+
+#endif // ! STC_INTERNAL_MATCH_WITH_HH
1
0
On 2007-01-30, Roland Levillain <roland(a)lrde.epita.fr> wrote:
> Thomas Moulard <thomas.moulard(a)lrde.epita.fr> writes:
>
>> URL: https://svn.lrde.epita.fr/svn/oln/trunk/static
>>
>> ChangeLog:
>> 2007-01-11 Thomas Moulard <thomas.moulard(a)lrde.epita.fr>
>>
>> Fix some tests.
>> * tests/vtypes-and-exact.cc: Fix macro.
>> * tests/vtypes.cc: Fix macro.
>>
>> vtypes-and-exact.cc | 2 +-
>> vtypes.cc | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>
>>
>> Property changes on: .
>> ___________________________________________________________________
>> Name: mailto
>> + olena-patches(a)lrde.epita.fr
>
> I suppose `mailto' is a Subversion property used by svn-wrapper to
> store the address of a mailing-list. In that case, I suggest using a
> prefix, to avoid name clashes, as Subversion does for its own
> properties (e.g. svn:externals). What about `svn-wrapper:mailto' or
> even `svn-wrap:mailto'?
>
>
or even svnw:mailto ?
I don't know, properties are so rarely used that I thought that a pain
`mailto' would be easier to use. Have you ever set a property whose
name didn't start with `svn:'?
--
SIGOURE Benoit aka Tsuna (SUSv3 compliant)
_____ "On a long enough timeline, the survival rate
/EPITA\ Promo 2008.CSI/ACU/YAKA for everyone drops to zero" -- Jack.
2
1
2007-01-30 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add mini-std.
* samples/mini-std: New.
* samples/mini-oln/design.hh: New.
Index: samples/mini-oln/design.hh
===================================================================
--- samples/mini-oln/design.hh (revision 0)
+++ samples/mini-oln/design.hh (revision 0)
@@ -0,0 +1,461 @@
+
+// Point
+
+Point : class =
+{
+}
+
+point2d : class < Point =
+{
+ row : int;
+ col : int;
+}
+
+point3d : class < Point =
+{
+ row : int;
+ col : int;
+ sli : int;
+}
+
+
+// Iterator
+
+Iterator : class =
+{
+ point_t : typedef < Point;
+
+ start : () -> void;
+ next : () -> void;
+ is_valid : const () -> bool;
+
+ auto : -> point_t;
+}
+
+
+
+// Image
+
+Image : class =
+{
+ {
+ point_t < Point;
+ iter_t < Iterator;
+ value_t;
+ }
+ : typedef;
+
+ "()" : const (p : point_t const&) -> value_t;
+ has : const (p : point_t const&) -> bool;
+}
+
+
+// Image = Image_2D | Image_3D
+
+Image_2D : class < Image =
+{
+ "()" : const (row : int, col : int) -> value_t;
+ nrows : const () -> int;
+ ncols : const () -> int;
+}
+
+Image_3D : class < Image =
+{
+ "()" : const (row : int, col : int, sli : int) -> value_t;
+ nrows : const () -> int;
+ ncols : const () -> int;
+ nslis : const () -> int;
+}
+
+
+// Image = Image_with_Nbh | not
+
+Image_with_Nbh : class < Image
+{
+ {
+ niter_t < Iterator;
+ nbh_t < Neighborhood;
+ }
+ : typedef;
+ nbh : const () -> nbh_t;
+}
+
+
+
+// plugs !
+
+image_dim_plug : [I : type] -> type = {
+ switch (I.point_t) {
+ case point2d: return Image_2D;
+ case point3d: return Image_3D;
+ }
+}
+
+image_nbh_plug : [I : type] -> type = {
+ if (I.nbh_t)
+ return Image_with_Nbh;
+ else
+ return Image;
+}
+
+
+
+// image_entry
+
+image_base : class < image_dim_plug[@],
+ image_nbh_plug[@] =
+{
+ {
+ point_t;
+ iter_t;
+ value_t;
+ }
+ : typedef;
+
+ "()" : const (p : point_t const&) -> value_t;
+ has : const (p : point_t const&) -> bool;
+}
+
+
+
+// iterator2d
+
+iterator2d : class < Iterator =
+{
+ point_t : typedef := point2d;
+
+ make : (ima : Image_2D) = {
+ nrows := ima.nrows;
+ ncols := ima.ncols;
+ }
+
+ start : () -> void = {
+ p.row := 0;
+ p.col := 0;
+ }
+
+ next : () -> void = {
+ p.col := p.col + 1;
+ if (p.col = ncols) {
+ p.col := 0;
+ p.row := p.row + 1;
+ }
+ }
+
+ is_valid : const () -> bool = {
+ return p.row < p.nrows;
+ }
+
+ auto : -> point_t =
+ {
+ return p;
+ }
+
+ protected {
+ nrows : int;
+ ncols : int;
+ p : point_t;
+ }
+}
+
+
+
+// image2d[T]
+
+image2d : [T : class] -> class < image_base =
+{
+ {
+ point_t := point2d;
+ iter_t := iterator2d;
+ value_t := T;
+ }
+ : typedef;
+
+ make : (nrows : int, ncols : int) =
+ {
+ data.make(nrows * ncols);
+ }
+
+ "()" : const (p : point_t const&) -> value_t =
+ {
+ precondition { has(p) = true }
+ return data.element(p.row * ncols + p.col);
+ }
+
+ "()" : const (row : int, col : int) -> value_t =
+ {
+ p : point2d;
+ p.make(row, col);
+ return @[p];
+ }
+
+ has : const (p : point_t const&) -> bool =
+ {
+ precondition { data != 0 }
+ return p.row >= 0 and p.row < nrows and p.col >= 0 and p.col < ncols;
+ }
+
+ data : vector[T];
+ nrows : int;
+ ncols : int;
+}
+
+
+
+// image_morpher
+
+image_morpher : class < image_base =
+{
+ delegatee_t : typedef;
+}
+
+
+
+// fun
+
+fun_ : [I : class < Image, F : type] where (F.arg_t = I.value_t) -> class =
+{
+ {
+ delegatee_t := I;
+ value_t := F.res_t;
+ }
+ : typedef;
+
+ ima : I;
+ f : F;
+
+ "()" : const (p : point_t const&) -> value_t =
+ {
+ precondition { has(p) = true }
+ return f(ima(p));
+ }
+}
+
+fun1 : class =
+{
+ {
+ arg_t;
+ res_t;
+ }
+ : typedef;
+
+ "()" : (ima : I < Image) -> fun_[I,@] =
+ {
+ fun_[I,@] tmp; // '@' is exact type
+ tmp.make(ima, @); // here '@' is *this
+ return tmp;
+ }
+}
+
+pow : class < fun1 =
+{
+ n : unsigned;
+
+ {
+ arg_t := double;
+ res_t := double;
+ }
+ : typedef;
+
+ "()" : (x : double) -> double =
+ {
+ return std::pow(x, n);
+ }
+}
+
+
+// stack
+
+vec : [n : unsigned, T : type] -> class =
+{
+ data : T[n];
+
+ "[]" : (i : unsigned) -> T =
+ {
+ precondition { i < n }
+ return data[i];
+ }
+}
+
+stack_ : [n : unsigned, I : class < Image] -> class =
+{
+ {
+ delegatee_t := I;
+ value_t := vec[n, I.value_t];
+ }
+ : typedef;
+
+ ima : vec[n,I];
+
+ "()" : const (p : point_t const&) -> value_t =
+ {
+ precondition { has(p) = true }
+ value_t tmp;
+ for (unsigned i := 0; i < n; ++i)
+ tmp[i] := ima[i](p);
+ return tmp;
+ }
+}
+
+stack : [I : class < Image] (ima_0 : I const&, ima_1 : I const&) -> stack_[2,I] =
+{
+ stack_[2,I] tmp;
+ tmp.ima[0] := ima_0;
+ tmp.ima[1] := ima_1;
+ return tmp;
+}
+
+
+
+// "image + neighborhood"
+
+plus : [I : class < Image, N : type] where N < Neighborhood
+-> class < image_morpher =
+{
+ {
+ delegatee_t := I;
+ }
+ : typedef;
+
+ ima : I;
+ nbh : N;
+}
+
+
+// operator plus
+
+"+" : [I : class < Image, N : class < Neighborhood] (ima : I, nbh : N) -> plus[I, N] =
+{
+ plus[I, N] tmp;
+ return tmp.make(ima, nbh);
+}
+
+
+
+
+// ----------------------------------------------------------------------
+
+
+
+
+// "image + neighborhood"
+
+plus : [I : class < Image, N : type] where N < Neighborhood
+-> class < image_morpher =
+{
+ {
+ delegatee_t := I;
+ }
+ : typedef;
+
+ ima : I;
+ nbh : N;
+}
+
+
+// operator plus
+
+"+" : [I : class < Image,
+ T : type] (lhs : I, rhs : T) -> plus[I, T] =
+{
+ plus[I, T] ima;
+ return ima.make(lhs, rhs);
+}
+
+
+
+
+// unsub
+
+unsubset : (ima : Image_with_Subset) = { FIXME }
+
+
+
+// predicate
+
+predicate : [I : class < Image] -> type = {
+ return (I.point_t const &) -> I.value_t;
+}
+
+
+
+// sub[I,P]
+
+sub : [I, P] where I < Iterator and P = predicate[I]
+-> class < Iterator =
+{
+ point_t : typedef := I.point_t;
+
+ iter : I;
+ pred : P;
+ p : point_t const&;
+
+ make : (ima : Image) {
+ iter.make(unsubset(ima));
+ pred := ima.pred();
+ p := iter.p;
+ }
+
+ invariant {
+ iter.is_valid() => pred(p);
+ }
+
+ start : () -> void = {
+ iter.start();
+ while (iter.is_valid() and not pred(p))
+ iter.next();
+ }
+
+ next : () -> void = {
+ iter.next();
+ while (iter.is_valid() and not pred(p))
+ iter.next();
+ }
+
+ is_valid : const () -> bool = {
+ return iter.is_valid();
+ }
+
+ auto : -> point_t =
+ {
+ return p;
+ }
+}
+
+
+
+// 'pipe' is "image | predicate -> sub-image"
+
+pipe : [I : class < Image, P : type] where P = predicate[I]
+-> class < image_morpher =
+{
+ {
+ delegatee_t := I;
+ iter_t : sub[I.iter_t, P];
+ }
+ : typedef;
+
+ pred : P;
+
+ unsubset : () -> I =
+ {
+ return ref_ima;
+ }
+
+ has : const (p : point_t const&) -> bool =
+ {
+ return ref_ima.has(p) and pred(p);
+ }
+
+}
+
+
+
+// operator pipe
+
+"|" : [I : class < Image,
+ T : type] (lhs : I, rhs : T) -> pipe[I, T] =
+{
+ pipe[I, T] ima;
+ return ima.make(lhs, rhs);
+}
Index: samples/mini-std/cpp/impl.hh
===================================================================
--- samples/mini-std/cpp/impl.hh (revision 0)
+++ samples/mini-std/cpp/impl.hh (revision 0)
@@ -0,0 +1,199 @@
+#ifndef MINI_STD_IMPL_HH
+# define MINI_STD_IMPL_HH
+
+# include "concepts.hh"
+
+
+namespace abc
+{
+
+
+ // container SWITCH-CASE
+
+ namespace internal
+ {
+
+ // front insertion
+ template <typename b, typename E> struct front_insertion_sequence;
+ template <typename E> struct front_insertion_sequence <mlc::true_, E> : virtual Front_Insertion_Sequence<E> {};
+ template <typename E> struct front_insertion_sequence <mlc::false_, E> : virtual Sequence<E> {};
+
+ // back insertion
+ template <typename b, typename E> struct back_insertion_sequence;
+ template <typename E> struct back_insertion_sequence <mlc::true_, E> : virtual Back_Insertion_Sequence<E> {};
+ template <typename E> struct back_insertion_sequence <mlc::false_, E> : virtual Sequence<E> {};
+
+ // random access
+ template <typename b, typename E> struct random_access_container;
+ template <typename E> struct random_access_container <mlc::true_, E> : virtual Random_Access_Container<E> {};
+ template <typename E> struct random_access_container <mlc::false_, E> : virtual Container<E> {};
+
+ template <typename E>
+ struct container_switch
+ : front_insertion_sequence< abc_vtype(E, has_front_insertion), E >,
+ back_insertion_sequence < abc_vtype(E, has_back_insertion), E >,
+ random_access_container < abc_vtype(E, has_random_access), E >
+ {
+ protected:
+ container_switch() {}
+ };
+
+
+ } // end of abc::internal
+
+
+
+
+// container_base
+// |
+// +-- morpher_container
+// |
+// +-- primary_container
+// |
+// +-- primary_std_container
+
+
+
+
+ // Class container_base<E>.
+
+ template <typename E> class container_base;
+
+ template <typename E>
+ struct vtypes< container_base<E> >
+ {
+ typedef mlc::none super_type;
+
+ typedef stc::abstract value_type;
+ typedef stc::abstract iterator;
+ typedef stc::abstract const_iterator;
+ typedef stc::abstract reference; // FIXME: or stc::final<value_type&>?
+ typedef stc::abstract const_reference; // FIXME: or stc::final<const value_type&>?
+ typedef stc::abstract size_type;
+
+ typedef stc::abstract has_random_access;
+ typedef stc::abstract has_front_insertion;
+ typedef stc::abstract has_back_insertion;
+
+ typedef stc::abstract tag;
+ };
+
+ template <typename E>
+ class container_base : public internal::container_switch<E>
+ {
+ public:
+ // FIXME: remove below.
+ typedef typename Back_Insertion_Sequence<E>::reference reference;
+ typedef typename Back_Insertion_Sequence<E>::const_reference const_reference;
+ protected:
+ container_base() {}
+ };
+
+
+
+ // Class morpher_container<E>.
+
+ template <typename E> class morpher_container;
+
+ template <typename E>
+ struct vtypes< morpher_container<E> >
+ {
+ typedef container_base<E> super_type;
+ typedef stc::abstract delegatee_type;
+ };
+
+ template <typename E>
+ class morpher_container : public container_base<E>
+ {
+ public:
+ stc_using_from(Container<E>, value_type);
+ abc_typename(delegatee_type);
+
+ const delegatee_type& delegatee() const { return this->exact().impl_delegatee(); }
+ delegatee_type& delegatee() { return this->exact().impl_delegatee(); }
+
+ protected:
+ morpher_container() {}
+ };
+
+
+
+ // Class primary_container<E>.
+
+ template <typename E> class primary_container;
+
+ template <typename E>
+ struct vtypes< primary_container<E> >
+ {
+ typedef container_base<E> super_type;
+ typedef mlc::none tag;
+ };
+
+ template <typename E>
+ class primary_container : public container_base<E>
+ {
+ public:
+ stc_using_from(Container<E>, value_type);
+ protected:
+ primary_container() {}
+ };
+
+
+
+ // Class primary_std_container<E>.
+
+ template <typename E> class primary_std_container;
+
+ template <typename E>
+ struct vtypes< primary_std_container<E> >
+ {
+ typedef primary_container<E> super_type;
+ typedef stc::abstract std_type;
+
+ typedef stc_defer(std_type) container_t;
+ typedef stc::final<typename container_t::value_type> value_type;
+ typedef stc::final<typename container_t::iterator> iterator;
+ typedef stc::final<typename container_t::const_iterator> const_iterator;
+ typedef stc::final<typename container_t::reference> reference;
+ typedef stc::final<typename container_t::const_reference> const_reference;
+ typedef stc::final<typename container_t::size_type> size_type;
+ };
+
+ template <typename E>
+ class primary_std_container : public primary_container<E>
+ {
+ public:
+ typedef primary_container<E> super;
+
+ stc_using(iterator);
+ stc_using(const_iterator);
+ stc_using(size_type);
+ stc_using(value_type);
+
+ // Container.
+ iterator impl_begin() { return data_.begin(); }
+ const_iterator impl_begin() const { return data_.begin(); }
+ iterator impl_end() { return data_.end(); }
+ const_iterator impl_end() const { return data_.end(); }
+ size_type impl_size() const { return data_.size(); }
+ bool impl_empty() const { return data_.empty(); }
+
+ // Forward_Container.
+ bool impl_equal(const E& rhs) const { return data_ == rhs.data_; }
+ bool impl_less (const E& rhs) const { return data_ < rhs.data_; }
+
+ protected:
+
+ primary_std_container() {}
+ primary_std_container(size_type n) : data_(n) {}
+ primary_std_container(size_type n, const value_type& t) : data_(n, t) {}
+ primary_std_container(const primary_std_container& rhs) : data_(rhs.data_) {}
+
+ abc_vtype(E, std_type) data_;
+ };
+
+
+} // end of namespace abc
+
+
+#endif // ! MINI_STD_IMPL_HH
Index: samples/mini-std/cpp/vector.hh
===================================================================
--- samples/mini-std/cpp/vector.hh (revision 0)
+++ samples/mini-std/cpp/vector.hh (revision 0)
@@ -0,0 +1,85 @@
+#ifndef MINI_STD_VECTOR_HH
+# define MINI_STD_VECTOR_HH
+
+# include <vector>
+# include "impl.hh"
+
+
+namespace abc
+{
+
+
+ template <typename T> class vector;
+
+
+ template <typename T>
+ struct vtypes< vector<T> >
+ {
+ typedef vector<T> E;
+ typedef primary_std_container<E> super_type;
+
+ typedef std::vector<T> std_type;
+
+ // As Reversible_Container:
+ typedef typename std::vector<T>::reverse_iterator reverse_iterator;
+ typedef typename std::vector<T>::const_reverse_iterator const_reverse_iterator;
+
+ // Properties.
+ typedef mlc::true_ has_random_access;
+ typedef mlc::false_ has_front_insertion;
+ typedef mlc::true_ has_back_insertion;
+ };
+
+
+
+ template <typename T>
+ class vector : public primary_std_container< vector<T> >
+ {
+ public:
+
+ typedef vector<T> self_type;
+ typedef primary_std_container<self_type> super;
+
+ stc_using(iterator);
+ stc_using(const_iterator);
+ stc_using(reverse_iterator);
+ stc_using(const_reverse_iterator);
+ stc_using(size_type);
+ stc_using(reference);
+ stc_using(const_reference);
+ stc_using(value_type);
+
+ using super::data_;
+
+ // Constructors:
+ vector() {}
+ vector(size_type n) : super(n) {}
+ vector(size_type n, const T& t) : super(n, t) {}
+ vector(const vector& rhs) : super(rhs) {}
+
+ vector& operator=(const vector& rhs) { data_ = rhs.data_; return *this; }
+ void reserve(size_t n) { data_.reserve(n); }
+
+ // FIXME: swap, resize
+
+ // As Reversible_Container:
+ reverse_iterator impl_rbegin() { return data_.rbegin(); }
+ const_reverse_iterator impl_rbegin() const { return data_.rbegin(); }
+ reverse_iterator impl_rend() { return data_.rend(); }
+ const_reverse_iterator impl_rend() const { return data_.rend(); }
+
+ // As Random_Access_Container:
+ reference impl_brackets(size_type n) { return data_[n]; }
+ const_reference impl_brackets(size_type n) const { return data_[n]; }
+
+ // As Sequence:
+ iterator impl_insert(iterator p, value_type t) { return data_.insert(p, t); }
+ iterator impl_erase(iterator p) { return data_.erase(p); }
+ iterator impl_erase(iterator p, iterator q) { return data_.erase(p, q); }
+ };
+
+
+} // end of namespace abc
+
+
+#endif // ! MINI_STD_VECTOR_HH
Index: samples/mini-std/cpp/deque.hh
===================================================================
--- samples/mini-std/cpp/deque.hh (revision 0)
+++ samples/mini-std/cpp/deque.hh (revision 0)
@@ -0,0 +1,81 @@
+#ifndef MINI_STD_DEQUE_HH
+# define MINI_STD_DEQUE_HH
+
+# include <deque>
+# include "impl.hh"
+
+
+namespace abc
+{
+
+
+ template <typename T> class deque;
+
+
+
+ template <typename T>
+ struct vtypes< deque<T> >
+ {
+ typedef deque<T> E;
+ typedef primary_std_container<E> super_type;
+
+ typedef std::deque<T> std_type;
+
+ // As Reversible_Container:
+ typedef typename std::deque<T>::reverse_iterator reverse_iterator;
+ typedef typename std::deque<T>::const_reverse_iterator const_reverse_iterator;
+
+ // Properties.
+ typedef mlc::true_ has_random_access;
+ typedef mlc::true_ has_front_insertion;
+ typedef mlc::true_ has_back_insertion;
+ };
+
+
+
+ template <typename T>
+ class deque : public primary_std_container< deque<T> >
+ {
+ public:
+
+ typedef deque<T> self_type;
+ typedef primary_std_container<self_type> super;
+
+ stc_using(iterator);
+ stc_using(const_iterator);
+ stc_using(reverse_iterator);
+ stc_using(const_reverse_iterator);
+ stc_using(size_type);
+ stc_using(reference);
+ stc_using(const_reference);
+ stc_using(value_type);
+
+ using super::data_;
+
+ // Constructors:
+ deque() {}
+ deque(size_type n) : super(n) {}
+ deque(size_type n, const T& t) : super(n, t) {}
+ deque(const deque& rhs) : super(rhs) {}
+
+ deque& operator=(const deque& rhs) { data_ = rhs.data_; return *this; }
+
+ // FIXME: swap, resize
+
+ // As Reversible_Container:
+ reverse_iterator impl_rbegin() { return data_.rbegin(); }
+ const_reverse_iterator impl_rbegin() const { return data_.rbegin(); }
+ reverse_iterator impl_rend() { return data_.rend(); }
+ const_reverse_iterator impl_rend() const { return data_.rend(); }
+
+ // As Sequence:
+ iterator impl_insert(iterator p, value_type t) { return data_.insert(p, t); }
+ iterator impl_erase(iterator p) { return data_.erase(p); }
+ iterator impl_erase(iterator p, iterator q) { return data_.erase(p, q); }
+ };
+
+
+} // end of namespace abc
+
+
+#endif // ! MINI_STD_DEQUE_HH
Index: samples/mini-std/cpp/stack.hh
===================================================================
--- samples/mini-std/cpp/stack.hh (revision 0)
+++ samples/mini-std/cpp/stack.hh (revision 0)
@@ -0,0 +1,71 @@
+#ifndef MINI_STD_CONTAINERS_HH
+# define MINI_STD_CONTAINERS_HH
+
+# include "impl.hh"
+
+
+namespace abc
+{
+
+
+ template <typename T, typename S> class stack;
+
+
+
+ template <typename T, typename S>
+ struct vtypes< stack<T,S> >
+ {
+ typedef stack<T,S> E;
+ typedef morpher_container<E> super_type;
+
+ typedef S delegatee_type;
+
+ // Properties.
+ typedef mlc::false_ has_front_insertion;
+ typedef mlc::true_ has_back_insertion;
+
+ typedef tag::identity tag;
+ };
+
+
+
+ template <typename T, typename S>
+ class stack : public morpher_container< stack<T,S> >
+ {
+ public:
+
+ typedef stack<T,S> self_type;
+ typedef morpher_container<self_type> super;
+
+ stc_using(reference);
+ stc_using(value_type);
+ stc_using(delegatee_type);
+
+ // Renaming.
+ reference top()
+ {
+ assert(not this->empty());
+ return this->back();
+ }
+ void push(value_type t)
+ {
+ this->push_back(t);
+ }
+ void pop()
+ {
+ assert(not this->empty());
+ this->pop_back();
+ }
+
+ const delegatee_type& impl_delegatee() const { return this->seq_; }
+ delegatee_type& impl_delegatee() { return this->seq_; }
+
+ protected:
+ S seq_;
+ };
+
+
+} // end of namespace abc
+
+
+#endif // ! MINI_STD_CONTAINERS_HH
Index: samples/mini-std/cpp/algorithm.hh
===================================================================
--- samples/mini-std/cpp/algorithm.hh (revision 0)
+++ samples/mini-std/cpp/algorithm.hh (revision 0)
@@ -0,0 +1,64 @@
+#ifndef MINI_STD_ALGORITHM_HH
+# define MINI_STD_ALGORITHM_HH
+
+# include <algorithm>
+# include "concepts.hh"
+
+
+namespace abc
+{
+
+ /// \{
+ /// Facades.
+
+ template <typename C>
+ void sort(Container<C>& c);
+
+ template <typename C, typename I>
+ void copy(const Container<C>& c, I iter);
+
+ /// \}
+
+
+
+ /// \{
+ /// sort
+
+ namespace impl
+ {
+
+ template <typename C>
+ void sort(Random_Access_Container<C>& c)
+ {
+ std::sort(c.begin(), c.end());
+ }
+
+ } // impl
+
+ template <typename C>
+ void sort(Container<C>& c)
+ {
+ impl::sort(c.exact());
+ }
+
+ /// \}
+
+
+
+ /// \{
+ /// copy
+
+ template <typename C, typename I>
+ void copy(const Container<C>& c, I iter)
+ {
+ std::copy(c.begin(), c.end(), iter);
+ }
+
+ /// \}
+
+
+
+} // end of namespace abc
+
+
+#endif // ! MINI_STD_ALGORITHM_HH
Index: samples/mini-std/cpp/value_cast.hh
===================================================================
--- samples/mini-std/cpp/value_cast.hh (revision 0)
+++ samples/mini-std/cpp/value_cast.hh (revision 0)
@@ -0,0 +1,65 @@
+#ifndef MINI_STD_VALUE_CAST_HH
+# define MINI_STD_VALUE_CAST_HH
+
+# include "impl.hh"
+# include "identity.hh"
+
+
+namespace abc
+{
+
+
+ template <typename T, typename C> class value_cast_;
+
+
+ template <typename T, typename C>
+ struct vtypes< value_cast_<T,C> >
+ {
+ typedef value_cast_<T,C> E;
+ typedef morpher_container<E> super_type;
+
+ typedef C delegatee_type;
+
+ typedef T value_type;
+ typedef T& reference;
+ typedef const T& const_reference;
+
+ typedef tag::identity tag;
+ };
+
+
+ template <typename T, typename C>
+ class value_cast_ : public morpher_container< value_cast_<T,C> >
+ {
+ public:
+
+ typedef value_cast_<T,C> self_type;
+ typedef morpher_container<self_type> super;
+
+ stc_using(delegatee_type);
+
+ value_cast_(Container<C>& con)
+ : con_(con.exact())
+ {
+ }
+
+ const delegatee_type& impl_delegatee() const { return this->con_; }
+ delegatee_type& impl_delegatee() { return this->con_; }
+
+ protected:
+ C& con_;
+ };
+
+
+ template <typename T, typename C>
+ value_cast_<T, C> value_cast(Container<C>& c)
+ {
+ value_cast_<T, C> tmp(c);
+ return tmp;
+ }
+
+
+} // end of namespace abc
+
+
+#endif // ! MINI_STD_VALUE_CAST_HH
Index: samples/mini-std/cpp/equipment.hh
===================================================================
--- samples/mini-std/cpp/equipment.hh (revision 0)
+++ samples/mini-std/cpp/equipment.hh (revision 0)
@@ -0,0 +1,89 @@
+#ifndef MINI_STD_EQUIPMENT_HH
+# define MINI_STD_EQUIPMENT_HH
+
+# include <cassert>
+# include <stc/any.hh>
+# include <stc/scoop.hh>
+
+
+stc_scoop_equipment_for_namespace(abc);
+
+
+
+// Patch.
+
+# define abc_vtype_(From, Target) abc::vtype<From, abc::typedef_::Target>::ret
+# define abc_vtype(From, Target) typename abc_vtype_(From, Target)
+
+# define abc_typename(Vtype) typedef abc_vtype(E, Vtype) Vtype
+
+# define stc_defer(Target) typename abc::deferred_vtype<E, abc::typedef_::Target>::ret
+
+# define stc_using(Vtype) typedef typename super::Vtype Vtype
+# define stc_using_from(From, Vtype) typedef typename From::Vtype Vtype
+
+# define stc_introducing(Vtype) typedef abc_vtype(self_type, Vtype) Vtype
+
+// stc_deferred_vtype(test, E, dim)
+
+
+
+namespace abc
+{
+
+ /// \{
+ /// Typedef declarations.
+
+ // From std.
+ mlc_decl_typedef(value_type);
+ mlc_decl_typedef(value_compare);
+ mlc_decl_typedef(reference);
+ mlc_decl_typedef(const_reference);
+ mlc_decl_typedef(data_type);
+ mlc_decl_typedef(size_type);
+ mlc_decl_typedef(distance_type);
+ mlc_decl_typedef(iterator);
+ mlc_decl_typedef(const_iterator);
+ mlc_decl_typedef(reverse_iterator);
+ mlc_decl_typedef(const_reverse_iterator);
+ mlc_decl_typedef(key_type);
+ mlc_decl_typedef(key_compare);
+ mlc_decl_typedef(std_type);
+
+ // Properties.
+ mlc_decl_typedef(has_random_access);
+ mlc_decl_typedef(has_front_insertion);
+ mlc_decl_typedef(has_back_insertion);
+
+ mlc_decl_typedef(tag);
+
+ /// \}
+
+
+
+ namespace automatic
+ {
+
+ template < template <class> class abstraction, typename E, typename tag = void >
+ struct impl;
+
+ template < template <class> class abstraction, typename E >
+ struct impl< abstraction, E, mlc::none >
+ {
+ // none means nothing!
+ };
+
+ template < template <class> class abstraction, typename E >
+ struct impl< abstraction, E, void > : impl< abstraction, E, abc_vtype(E, tag) >
+ {
+ // fetch impl w.r.t. tag
+ };
+
+ } // end of namespace abc::automatic
+
+
+
+} // end of namespace abc
+
+
+#endif // ! MINI_STD_EQUIPMENT_HH
Index: samples/mini-std/cpp/identity.hh
===================================================================
--- samples/mini-std/cpp/identity.hh (revision 0)
+++ samples/mini-std/cpp/identity.hh (revision 0)
@@ -0,0 +1,164 @@
+#ifndef MINI_STD_IDENTITY_HH
+# define MINI_STD_IDENTITY_HH
+
+# include "equipment.hh"
+# include "fwddecls.hh"
+
+
+
+namespace abc
+{
+
+ // tag::identity.
+
+ namespace tag { struct identity; }
+
+
+ namespace automatic
+ {
+
+ // FIXME: Hack! (to be removed)
+
+ template < template <class> class abstraction, typename E >
+ struct impl< abstraction, E, tag::identity >
+ {
+ // ...
+ };
+
+
+
+ // Container
+
+ template <typename E>
+ class impl< Container, E, tag::identity >
+ :
+ public virtual stc::any__simple<E>
+ {
+ protected:
+ abc_typename(value_type);
+ abc_typename(iterator);
+ abc_typename(const_iterator);
+ abc_typename(size_type);
+ public:
+ iterator impl_begin() { return this->exact().delegatee().begin(); }
+ const_iterator impl_begin() const { return this->exact().delegatee().begin(); }
+ iterator impl_end() { return this->exact().delegatee().end(); }
+ const_iterator impl_end() const { return this->exact().delegatee().end(); }
+ size_type impl_size() const { return this->exact().delegatee().size(); }
+ bool impl_empty() const { return this->exact().delegatee().empty(); }
+ };
+
+
+
+ // Forward_Container
+
+ template <typename E>
+ class impl< Forward_Container, E, tag::identity >
+ :
+ public virtual stc::any__simple<E>
+ {
+ protected:
+ typedef Forward_Container<E> self_type;
+ public:
+ bool impl_equal(const self_type& rhs) const { return this->exact().delegatee().operator==(rhs); }
+ bool impl_less (const self_type& rhs) const { return this->exact().delegatee().operator< (rhs); }
+ };
+
+
+
+ // Reversible_Container
+
+ template <typename E>
+ class impl< Reversible_Container, E, tag::identity >
+ :
+ public virtual stc::any__simple<E>
+ {
+ protected:
+ abc_typename(reverse_iterator);
+ abc_typename(const_reverse_iterator);
+ public:
+ reverse_iterator impl_rbegin() { return this->exact().delegatee().rbegin(); }
+ const_reverse_iterator impl_rbegin() const { return this->exact().delegatee().rbegin(); }
+ reverse_iterator impl_rend() { return this->exact().delegatee().rend(); }
+ const_reverse_iterator impl_rend() const { return this->exact().delegatee().rend(); }
+ };
+
+
+
+ // Random_Access_Container
+
+ template <typename E>
+ class impl< Random_Access_Container, E, tag::identity >
+ :
+ public virtual stc::any__simple<E>
+ {
+ protected:
+ abc_typename(reference);
+ abc_typename(const_reference);
+ abc_typename(size_type);
+ public:
+ reference impl_brackets(size_type n) { return this->exact().delegatee()[n]; }
+ const_reference impl_brackets(size_type n) const { return this->exact().delegatee()[n]; }
+ };
+
+
+
+ // Sequence
+
+ template <typename E>
+ class impl< Sequence, E, tag::identity >
+ :
+ public virtual stc::any__simple<E>
+ {
+ protected:
+ abc_typename(value_type);
+ abc_typename(iterator);
+ public:
+ iterator impl_insert(iterator p, value_type t) { return this->exact().delegatee().insert(p, t); }
+ iterator impl_erase(iterator p) { return this->exact().delegatee().erase(p); }
+ iterator impl_erase(iterator p, iterator q) { return this->exact().delegatee().erase(p, q); }
+ };
+
+
+
+ // Front_Insertion_Sequence
+
+ template <typename E>
+ class impl< Front_Insertion_Sequence, E, tag::identity >
+ :
+ public virtual stc::any__simple<E>
+ {
+ protected:
+ abc_typename(value_type);
+ public:
+ void impl_push_front(value_type t) { this->exact().delegatee().push_front(t); }
+ void impl_pop_front() { this->exact().delegatee().pop_front(); }
+ };
+
+
+
+ // Back_Insertion_Sequence
+
+ template <typename E>
+ class impl< Back_Insertion_Sequence, E, tag::identity >
+ :
+ public virtual stc::any__simple<E>
+ {
+ protected:
+ abc_typename(value_type);
+ abc_typename(reference);
+ public:
+ reference impl_back() { this->exact().delegatee().back(); }
+ void impl_push_back(value_type t) { this->exact().delegatee().push_back(t); }
+ void impl_pop_back() { this->exact().delegatee().pop_back(); }
+ };
+
+
+
+ } // end of namespace abc::automatic
+
+
+} // end of namespace abc
+
+
+#endif // ! MINI_STD_IDENTITY_HH
Index: samples/mini-std/cpp/main.cc
===================================================================
--- samples/mini-std/cpp/main.cc (revision 0)
+++ samples/mini-std/cpp/main.cc (revision 0)
@@ -0,0 +1,19 @@
+
+#include <iostream>
+#include <iterator>
+
+#include "vector.hh"
+#include "algorithm.hh"
+
+
+
+int main()
+{
+ abc::vector<int> v;
+ v.push_back(3);
+ v.push_back(1);
+ v.push_back(4);
+
+ abc::sort(v);
+ abc::copy(v, std::ostream_iterator<int>(std::cout, "\n"));
+}
Index: samples/mini-std/cpp/fwddecls.hh
===================================================================
--- samples/mini-std/cpp/fwddecls.hh (revision 0)
+++ samples/mini-std/cpp/fwddecls.hh (revision 0)
@@ -0,0 +1,84 @@
+#ifndef MINI_STD_FWDDECLS_HH
+# define MINI_STD_FWDDECLS_HH
+
+
+namespace abc
+{
+
+
+ // Container
+ // |
+ // +-- Forward_Container
+ // |
+ // |
+ // +-- Reversible_Container
+ // | |
+ // | +-- Random_Access_Container
+ // |
+
+ template <typename E> class Container;
+ template <typename E> class Forward_Container;
+ template <typename E> class Reversible_Container;
+ template <typename E> class Random_Access_Container;
+
+ // |
+ // +-- Sequence
+ // | |
+ // | +-- Front_Insertion_Sequence
+ // | |
+ // | +-- Back_Insertion_Sequence
+ // |
+
+ template <typename E> class Sequence;
+ template <typename E> class Front_Insertion_Sequence;
+ template <typename E> class Back_Insertion_Sequence;
+
+ // |
+ // +-- Associative_Container
+ // |
+ // +-- Simple_Associative_Container
+ // +-- Pair_Associative_Container
+ // |
+ // +-- Sorted_Associative_Container
+ // +-- Hashed_Associative_Container
+ // |
+ // +-- Unique_Associative_Container
+ // +-- Multiple_Associative_Container
+
+ template <typename E> class Associative_Container;
+ template <typename E> class Simple_Associative_Container;
+ template <typename E> class Pair_Associative_Container;
+ template <typename E> class Sorted_Associative_Container;
+ template <typename E> class Hashed_Associative_Container;
+ template <typename E> class Unique_Associative_Container;
+ template <typename E> class Multiple_Associative_Container;
+
+
+
+ // Iterator
+ // |
+ // +-- Trivial_Iterator
+ // | |
+ // | +-- Input_Iterator
+ // | |
+ // +-- Output_Iterator |
+ // | |
+ // +---------+-- Forward_Iterator
+ // |
+ // +-- Bidirectional_Iterator
+ // |
+ // +-- Random_Access_Iterator
+
+ template <typename E> class Iterator;
+ template <typename E> class Trivial_Iterator;
+ template <typename E> class Input_Iterator;
+ template <typename E> class Output_Iterator;
+ template <typename E> class Forward_Iterator;
+ template <typename E> class Bidirectional_Iterator;
+ template <typename E> class Random_Access_Iterator;
+
+
+} // end of namespace abc
+
+
+#endif // ! MINI_STD_FWDDECLS_HH
Index: samples/mini-std/cpp/list.hh
===================================================================
--- samples/mini-std/cpp/list.hh (revision 0)
+++ samples/mini-std/cpp/list.hh (revision 0)
@@ -0,0 +1,83 @@
+#ifndef MINI_STD_LIST_HH
+# define MINI_STD_LIST_HH
+
+# include <list>
+# include "impl.hh"
+
+
+namespace abc
+{
+
+
+ template <typename T> class list;
+
+
+ template <typename T>
+ struct vtypes< list<T> >
+ {
+ typedef list<T> E;
+ typedef primary_std_container<E> super_type;
+
+ typedef std::list<T> std_type;
+
+ // As Reversible_Container:
+ typedef typename std::list<T>::reverse_iterator reverse_iterator;
+ typedef typename std::list<T>::const_reverse_iterator const_reverse_iterator;
+
+ // Properties.
+ typedef mlc::false_ has_random_access;
+ typedef mlc::true_ has_front_insertion;
+ typedef mlc::true_ has_back_insertion;
+ };
+
+
+
+ template <typename T>
+ class list : public primary_std_container< list<T> >
+ {
+ public:
+
+ typedef list<T> self_type;
+ typedef primary_std_container<self_type> super;
+
+ stc_using(iterator);
+ stc_using(const_iterator);
+ stc_using(size_type);
+ stc_using(reference);
+ stc_using(const_reference);
+ stc_using(value_type);
+
+ stc_introducing(reverse_iterator);
+ stc_introducing(const_reverse_iterator);
+
+ using super::data_;
+
+ // Constructors:
+ list() {}
+ list(size_type n) : super(n) {}
+ list(size_type n, const T& t) : super(n, t) {}
+ list(const list& rhs) : super(rhs) {}
+
+ list& operator=(const list& rhs) { data_ = rhs.data_; return *this; }
+
+ void sort() { data_.sort(); }
+
+ // FIXME: swap, resize
+
+ // As Reversible_Container:
+ reverse_iterator impl_rbegin() { return data_.rbegin(); }
+ const_reverse_iterator impl_rbegin() const { return data_.rbegin(); }
+ reverse_iterator impl_rend() { return data_.rend(); }
+ const_reverse_iterator impl_rend() const { return data_.rend(); }
+
+ // As Sequence:
+ iterator impl_insert(iterator p, value_type t) { return data_.insert(p, t); }
+ iterator impl_erase(iterator p) { return data_.erase(p); }
+ iterator impl_erase(iterator p, iterator q) { return data_.erase(p, q); }
+ };
+
+
+} // end of namespace abc
+
+
+#endif // ! MINI_STD_LIST_HH
Index: samples/mini-std/cpp/concepts.hh
===================================================================
--- samples/mini-std/cpp/concepts.hh (revision 0)
+++ samples/mini-std/cpp/concepts.hh (revision 0)
@@ -0,0 +1,356 @@
+#ifndef MINI_STD_CONCEPTS_HH
+# define MINI_STD_CONCEPTS_HH
+
+# include "equipment.hh"
+
+
+namespace abc
+{
+
+ // Container
+
+ template <typename E>
+ class Container : public virtual stc::any__simple<E>,
+ public automatic::impl<Container, E>
+ {
+ public:
+
+ // Typedefs.
+ abc_typename(value_type);
+ abc_typename(iterator);
+ abc_typename(const_iterator);
+ abc_typename(reference);
+ abc_typename(const_reference);
+ abc_typename(size_type);
+
+ // Methods.
+ iterator begin() { return this->exact().impl_begin(); }
+ const_iterator begin() const { return this->exact().impl_begin(); }
+ iterator end() { return this->exact().impl_end(); }
+ const_iterator end() const { return this->exact().impl_end(); }
+ size_type size() const { return this->exact().impl_size(); }
+ bool empty() const { return this->exact().impl_empty(); }
+
+ protected:
+ Container() {}
+ };
+
+
+
+ // Forward_Container
+
+ template <typename E>
+ class Forward_Container : public virtual Container<E>,
+ public automatic::impl<Forward_Container, E>
+ {
+ public:
+
+ typedef Forward_Container<E> self_type;
+
+ // Methods.
+ bool operator==(const self_type& rhs) const { return this->exact().impl_equal(rhs.exact()); }
+ bool operator< (const self_type& rhs) const { return this->exact().impl_less(rhs.exact()); }
+
+ // Concrete. // FIXME: Use the default impl mechanism so that the user can override.
+ bool operator!=(const self_type& rhs) const { return not (*this == rhs); }
+ bool operator> (const self_type& rhs) const { return rhs < *this; }
+ bool operator<=(const self_type& rhs) const { return not (*this > rhs); }
+ bool operator>=(const self_type& rhs) const { return not (*this < rhs); }
+
+ protected:
+ Forward_Container() {}
+ };
+
+
+
+ // Reversible_Container
+
+ template <typename E>
+ class Reversible_Container : public virtual Forward_Container<E>,
+ public automatic::impl<Reversible_Container, E>
+ {
+ public:
+
+ // Typedefs.
+ abc_typename(reverse_iterator);
+ abc_typename(const_reverse_iterator);
+
+ // Methods.
+ reverse_iterator rbegin() { return this->exact().impl_rbegin(); }
+ const_reverse_iterator rbegin() const { return this->exact().impl_rbegin(); }
+ reverse_iterator rend() { return this->exact().impl_rend(); }
+ const_reverse_iterator rend() const { return this->exact().impl_rend(); }
+
+ protected:
+ Reversible_Container() {}
+ };
+
+
+
+ // Random_Access_Container
+
+ template <typename E>
+ class Random_Access_Container : public virtual Reversible_Container<E>,
+ public automatic::impl<Random_Access_Container, E>
+ {
+ public:
+
+ typedef Reversible_Container<E> super;
+ stc_using(reference);
+ stc_using(const_reference);
+ stc_using(size_type);
+
+ // Methods.
+ reference operator[](size_type n) { assert(0 <= n and n <= this->size());
+ return this->exact().impl_brackets(n); }
+ const_reference operator[](size_type n) const { assert(0 <= n and n <= this->size());
+ return this->exact().impl_brackets(n); }
+ protected:
+ Random_Access_Container() {}
+ };
+
+
+
+ // Sequence
+
+ template <typename E>
+ class Sequence : public virtual Forward_Container<E>,
+ public automatic::impl<Sequence, E>
+ {
+ public:
+
+ typedef Forward_Container<E> super;
+ stc_using(iterator);
+ stc_using(value_type);
+ stc_using(reference);
+ stc_using(const_reference);
+
+ // Methods.
+ iterator insert(iterator p, value_type t) { return this->exact().impl_insert(p, t); }
+ iterator erase(iterator p) { return this->exact().impl_erase(p); }
+ iterator erase(iterator p, iterator q) { return this->exact().impl_erase(p, q); }
+
+ // Concrete.
+ reference front()
+ {
+ assert(not this->empty());
+ return *(this->first());
+ }
+ const_reference front() const
+ {
+ assert(not this->empty());
+ return *(this->first());
+ }
+ void clear()
+ {
+ this->erase(this->begin(), this->end());
+ }
+
+ protected:
+ Sequence() {}
+ };
+
+
+
+
+ // Front_Insertion_Sequence
+
+ template <typename E>
+ class Front_Insertion_Sequence : public virtual Sequence<E>,
+ public automatic::impl<Front_Insertion_Sequence, E>
+ {
+ public:
+
+ typedef Sequence<E> super;
+ stc_using(value_type);
+
+ // Concrete.
+ void push_front(value_type t)
+ {
+ this->insert(this->begin(), t);
+ }
+ void pop_front()
+ {
+ assert(not this->empty());
+ this->erase(this->begin());
+ }
+
+ protected:
+ Front_Insertion_Sequence() {}
+ };
+
+
+
+ // Back_Insertion_Sequence
+
+ template <typename E>
+ class Back_Insertion_Sequence : public virtual Sequence<E>,
+ public automatic::impl<Back_Insertion_Sequence, E>
+ {
+ public:
+
+ typedef Sequence<E> super;
+ stc_using(reference);
+ stc_using(value_type);
+
+ // Concrete.
+ reference back()
+ {
+ assert(not this->empty());
+ return *(--this->end());
+ }
+ void push_back(value_type t)
+ {
+ this->insert(this->end(), t);
+ }
+ void pop_back()
+ {
+ assert(not this->empty());
+ this->erase(--this->end());
+ }
+ protected:
+ Back_Insertion_Sequence() {}
+ };
+
+
+
+ // Iterator
+
+ template <typename E>
+ class Iterator : public virtual stc::any__simple<E>,
+ public automatic::impl<Iterator, E>
+ {
+ public:
+
+ // FIXME
+
+ protected:
+ Iterator() {}
+ };
+
+
+
+ // Trivial_Iterator
+
+ template <typename E>
+ class Trivial_Iterator : public virtual Iterator<E>,
+ public automatic::impl<Trivial_Iterator, E>
+ {
+ public:
+
+ typedef Trivial_Iterator<E> self_type;
+
+ // Typedef.
+ abc_typename(value_type);
+
+ // Methods.
+ value_type operator*() const { return this->exact().impl_star(); }
+ const value_type& operator->() const { return this->exact().impl_arrow(); }
+ bool operator==(const self_type& rhs) const { return this->exact().impl_equal(rhs.exact()); }
+
+ // Concrete.
+ bool operator!=(const self_type& rhs) const
+ {
+ return not (*this == rhs);
+ }
+
+ protected:
+ Trivial_Iterator() {}
+ };
+
+
+
+ // Input_Iterator
+
+ template <typename E>
+ class Input_Iterator : public virtual Trivial_Iterator<E>,
+ public automatic::impl<Input_Iterator, E>
+ {
+ public:
+
+ // Typedef.
+ abc_typename(distance_type);
+
+ // Method.
+ E& operator++() { return this->exact().impl_preinc(); }
+
+ // Concrete.
+ E operator++(int) const
+ {
+ E cpy(*this);
+ ++(*this);
+ return cpy;
+ }
+
+ protected:
+ Input_Iterator() {}
+ };
+
+
+
+ // Output_Iterator
+
+ template <typename E>
+ class Output_Iterator : public virtual Trivial_Iterator<E>,
+ public automatic::impl<Output_Iterator, E>
+ {
+ public:
+
+ typedef Trivial_Iterator<E> super;
+ stc_using(value_type);
+
+ using super::operator*;
+ using super::operator->;
+
+ // Methods.
+ value_type& operator*() { return this->exact().impl_star(); }
+ value_type& operator->() { return this->exact().impl_arrow(); }
+
+ protected:
+ Output_Iterator() {}
+ };
+
+
+
+ // Forward_Iterator
+
+ template <typename E>
+ class Forward_Iterator : public virtual Input_Iterator<E>, public virtual Output_Iterator<E>,
+ public automatic::impl<Forward_Iterator, E>
+ {
+ public:
+ // nothing
+ protected:
+ Forward_Iterator() {}
+ };
+
+
+
+ // Bidirectional_Iterator
+
+ template <typename E>
+ class Bidirectional_Iterator : public virtual Forward_Iterator<E>,
+ public automatic::impl<Bidirectional_Iterator, E>
+ {
+ public:
+
+ // Method.
+ E& operator--() { return this->exact().impl_predec(); }
+
+ // Concrete.
+ E operator--(int) const
+ {
+ E cpy(*this);
+ --(*this);
+ return cpy;
+ }
+
+ protected:
+ Bidirectional_Iterator() {}
+ };
+
+
+} // end of namespace abc
+
+
+#endif // ! MINI_STD_CONCEPTS_HH
Index: samples/mini-std/design.hh
===================================================================
--- samples/mini-std/design.hh (revision 0)
+++ samples/mini-std/design.hh (revision 0)
@@ -0,0 +1,248 @@
+
+// Container
+
+Container : class =
+{
+ value_type : type;
+
+ iterator : type;
+ const_iterator : type;
+
+ reference : type;
+ const_reference : type;
+
+ size_type : type;
+
+ begin : () -> iterator;
+ begin : const () -> const_iterator;
+
+ end : () -> iterator;
+ end : const () -> const_iterator;
+
+ size : const () -> size_type;
+ empty : const () -> bool;
+}
+
+
+// Forward_Container
+
+Forward_Container : class < Container =
+{
+ "=" : const (rhs : @type) -> bool;
+ "!=" : const (rhs : @type) -> bool;
+ "<" : const (rhs : @type) -> bool;
+ ">" : const (rhs : @type) -> bool;
+ "<=" : const (rhs : @type) -> bool;
+ ">=" : const (rhs : @type) -> bool;
+}
+
+
+// Reversible_Container
+
+Reversible_Container : class < Forward_Container =
+{
+ reverse_iterator : type;
+ const_reverse_iterator : type;
+
+ rbegin : () -> reverse_iterator;
+ rbegin : const () -> const_reverse_iterator;
+
+ rend : () -> reverse_iterator;
+ rend : const () -> const_reverse_iterator;
+
+ /* Models: vector, list, deque */
+}
+
+
+// Random_Access_Container
+
+Random_Access_Container : class < Reversible_Container =
+{
+ "[]" : (n : size_type) -> reference {
+ precondition { 0 <= n and n <= @size() }
+ }
+ "[]" : const (n : size_type) -> const_reference {
+ precondition { 0 <= n and n <= @size() }
+ }
+}
+
+
+
+// Sequence
+
+Sequence : class < Forward_Container =
+{
+ make : (n : size_type, t : value_type) {
+ precondition { n >= 0 }
+ postcondition { @size() = n } // FIXME: and...
+ }
+
+ // FIXME: some ctors are missing.
+
+ front : () -> reference =
+ {
+ precondition { not @empty() }
+ return *(@first());
+ }
+ front : const () -> const_reference =
+ {
+ precondition { not @empty() }
+ return *(@first());
+ }
+
+ insert : (p : iterator, t : value_type) -> iterator;
+
+ erase : (p : iterator) -> iterator;
+ erase : (p : iterator, q : iterator) -> iterator;
+
+ clear : () -> void =
+ {
+ @erase(@begin(), @end());
+ }
+
+ /* Models: vector, deque, list */
+}
+
+
+
+// Front_Insertion_Sequence
+
+Front_Insertion_Sequence : class < Sequence =
+{
+ push_front : (t : value_type) -> void =
+ {
+ @insert(@begin(), t);
+ }
+ pop_front : () -> void =
+ {
+ precondition { not @empty() }
+ @erase(@begin());
+ }
+ /* Models: deque, list */
+}
+
+
+// Back_Insertion_Sequence
+
+Back_Insertion_Sequence : class < Sequence =
+{
+ back : () -> reference =
+ {
+ precondition { not @empty() }
+ return *(--@end());
+ }
+ push_back : (t : value_type) -> void =
+ {
+ @insert(@end(), t);
+ }
+ pop_back : () -> void =
+ {
+ precondition { not @empty() }
+ @erase(--@end());
+ }
+ /* Models: vector, deque, list */
+}
+
+
+
+// vector[T]
+
+vector : [T : type] -> class < Back_Insertion_Sequence, Random_Access_Container =
+{
+ // FIXME: impl
+}
+
+
+// Associative_Container
+
+Associative_Container : class < Forward_Container =
+{
+ key_type : type;
+
+ erase : (k : key_type) -> size_type;
+ erase : (p : iterator) -> void;
+ erase : (p : iterator, q : iterator) -> void;
+
+ clear : () -> void =
+ {
+ @erase(@begin(), @end());
+ }
+
+ find : (k : key_type) -> iterator;
+ find : const (k : key_type) -> const_iterator;
+
+ count : (k : key_type) -> size_type;
+
+ // FIXME: equal_range
+
+ /* Models: set, multiset, map, multimap */
+}
+
+
+// Simple_Associative_Container
+
+Simple_Associative_Container : class < Associative_Container =
+{
+ check {
+ key_type = value_type and iterator = const_iterator
+ }
+ /* Models: set, multiset */
+}
+
+
+// Pair_Associative_Container
+
+Pair_Associative_Container : class < Associative_Container =
+{
+ data_type : type;
+ value_type : type = pair[key_type const, data_type];
+ /* Models: map, multimap */
+}
+
+
+
+// Sorted_Associative_Container
+
+Sorted_Associative_Container : class < Associative_Container =
+{
+ key_compare : type < Strict_Weak_Ordering;
+ value_compare : type < Strict_Weak_Ordering;
+
+ // FIXME: ctors, key_comp, value_compare, lower_bound, upper_bound, equal_range
+}
+
+
+
+// FIXME: Hashed_Associative_Container
+// FIXME: Unique_Associative_Container
+// FIXME: Multiple_Associative_Container
+
+
+
+// Trivial_Iterator
+
+Trivial_Iterator : class =
+{
+ value_type : type;
+ "*" : const () : value_type const&;
+ "->" : const () : value_type const&;
+ "=" : const (rhs : @type const&) : bool;
+}
+
+// Input_Iterator
+
+Input_Iterator : class < Trivial_Iterator =
+{
+ "++@" : () -> @type &; // pre
+ "@++" : () -> @type &; // post
+}
+
+
+
+// Output_Iterator
+
+Output_Iterator : class < Trivial_Iterator =
+{
+ "*" : () : value_type &;
+ "->" : () : value_type &;
+}
Index: samples/mini-std/README
===================================================================
--- samples/mini-std/README (revision 0)
+++ samples/mini-std/README (revision 0)
@@ -0,0 +1,29 @@
+ -*- outline -*-
+
+* compilation
+
+cd cpp
+g++ -I../../.. -I../../../../metalic -Wall -ansi -pedantic main.cc
+
+* contents
+
+** utility files
+
+concepts.hh
+equipment.hh
+fwddecls.hh
+identity.hh
+impl.hh
+
+** based on existing std tools
+
+deque.hh
+list.hh
+stack.hh
+vector.hh
+
+algorithm.hh
+
+** morphers
+
+value_cast.hh
1
0
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
URL: https://svn.lrde.epita.fr/svn/oln/trunk/static
ChangeLog:
2007-01-11 Thomas Moulard <thomas.moulard(a)lrde.epita.fr>
Fix some tests.
* tests/vtypes-and-exact.cc: Fix macro.
* tests/vtypes.cc: Fix macro.
vtypes-and-exact.cc | 2 +-
vtypes.cc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Property changes on: .
___________________________________________________________________
Name: mailto
+ olena-patches(a)lrde.epita.fr
Index: tests/vtypes-and-exact.cc
===================================================================
- --- tests/vtypes-and-exact.cc (revision 718)
+++ tests/vtypes-and-exact.cc (working copy)
@@ -40,7 +40,7 @@
// Helper macros.
#define my_type_of_(FromType, Alias) \
- - my::direct_type_of_<FromType, my::typedef_:: Alias##_type>::ret
+ my::find_vtype<FromType, my::typedef_:: Alias##_type>::ret
#define my_type_of(FromType, Alias) \
typename my_type_of_(FromType, Alias)
Index: tests/vtypes.cc
===================================================================
- --- tests/vtypes.cc (revision 718)
+++ tests/vtypes.cc (working copy)
@@ -37,7 +37,7 @@
// Helper macros.
#define my_type_of_(FromType, Alias) \
- - my::direct_type_of_<FromType, my::typedef_:: Alias##_type>::ret
+ my::find_vtype<FromType, my::typedef_:: Alias##_type>::ret
#define my_type_of(FromType, Alias) \
typename my_type_of_(FromType, Alias)
- --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
iD8DBQFFpmPq8QvmnUS5oeMRAr2HAKCXyklCwcRaUHXhG7jkLogf8248yQCfQiyv
XHz2zTG6ywb7d0CNQa13pNc=
=ev6W
-----END PGP SIGNATURE-----
2
2
Index: static/ChangeLog
===================================================================
--- static/ChangeLog (révision 723)
+++ static/ChangeLog (révision 724)
@@ -109,7 +109,7 @@
2006-11-14 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Simplify scoop facilities.
-
+
* stc/scoop.hh: Rename as...
* stc/was.scoop.hh: ...this new file.
* stc/scoop.hh: New version.
@@ -178,7 +178,7 @@
2006-09-27 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Enforce safety in some SCOOP tools.
-
+
* stc/scoop.hh (stc_set_nth_super, stc_set_super): Add
"end of semicolon" safety.
(stc_virtual_typedef): Use oln_check_type_of instead of
@@ -304,7 +304,7 @@
2006-09-06 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
New macro to declare virtual types in abstract classes.
-
+
* stc/vtypes.hh (stc_virtual_typedef): New.
2006-09-04 Roland Levillain <roland(a)lrde.epita.fr>
@@ -313,7 +313,7 @@
* stc/vtypes.hh (vtypes, single_vtype, ext_vtype): Rename as...
(vtypes_in_category, single_vtype_in_category, ext_vtype_in_category):
- ...this.
+ ...this.
(vtypes_, single_vtype_, ext_vtype_): Rename as...
(vtypes, single_vtype, ext_vtype): ...this.
(packed_vtypes): Rename as...
@@ -329,7 +329,7 @@
recursions when their definitions involve the knowledge of the
exact type of the class these virtual types belong to.
- * static/stc/vtypes.hh (single_vtype, single_vtype_): New template
+ * stc/vtypes.hh (single_vtype, single_vtype_): New template
class.
(internal::tag::single): New.
(internal::tag::external): Rename as...
@@ -340,18 +340,18 @@
Check the return type of the algorithm.
More documentation.
s/external/extended/.
- * static/tests/vtypes.cc: Conform to the new terminology.
- * static/tests/vtypes-multiple-supers.cc: Adjust.
+ * tests/vtypes.cc: Conform to the new terminology.
+ * tests/vtypes-multiple-supers.cc: Adjust.
* tests/vtypes-and-exact.cc: Likewise.
Aesthetic changes.
(main): Exercize stc::is_any_.
- * static/stc/valist_aggregator.hh (valist_aggregator): Use virtual
+ * stc/valist_aggregator.hh (valist_aggregator): Use virtual
inheritance.
2006-09-01 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add materials to handle types without category.
-
+
* stc/vtypes.hh (stc_equip_namespace_with_vtypes): Add
ext_vtype_ and packed_vtypes_ for types without category.
(ext_vtype, packed_vtypes): Add specializations for
@@ -360,13 +360,13 @@
2006-08-30 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Fix missing typedefs and handle types without category.
-
+
* stc/any.hh (any__best_speed): Add typedef exact_type.
(any__best_memory): Likewise.
* stc/vtypes.hh (stc_equip_namespace_with_vtypes): Add 'vtypes_'
and the specialization 'vtypes<void, from_type>' for definitions
of associated types from types that do not have any category.
-
+
2006-06-15 Roland Levillain <roland(a)lrde.epita.fr>
Document method checks in Static tour.
@@ -406,8 +406,8 @@
* tests/tour.cc (static_hierarchy_with_any): More on the retrieval
of and the conversion to the exact type.
(main): Run dynamic tests.
- (static_hierarchy_with_any::A)
- (static_hierarchy_with_a_non_leaf_concrete_class::A)
+ (static_hierarchy_with_any::A)
+ (static_hierarchy_with_a_non_leaf_concrete_class::A)
(static_hierarchy_with_methods::A): Use stc::any instead of
stc::any__simple.
Index: olena/ChangeLog
===================================================================
--- olena/ChangeLog (révision 723)
+++ olena/ChangeLog (révision 724)
@@ -23,7 +23,7 @@
[!OLENA_USE_NEW_SCOOP2]: Define it.
(single_vtype<abstract::iterator_on_points<E>, typedef_::coord_type>)
[OLENA_USE_NEW_SCOOP2]: Define it.
- * oln/core/abstract/point.hh (oln, oln):
+ * oln/core/abstract/point.hh (oln, oln):
(vtypes< abstract::point<E> >::coord_type)
(vtypes< abstract::point<E> >::vec_type)
[!OLENA_USE_NEW_SCOOP2]: Define them.
@@ -136,9 +136,10 @@
2006-12-04 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Propagate scoop update to oln.
-
+
* oln/core/macros.hh
- (oln_type_of_, oln_type_of, oln_deduce_type_of): Update and rename as...
+ (oln_type_of_, oln_type_of, oln_deduce_type_of): Update and rename
+ as...
(oln_vtype_, oln_vtype, oln_deduce_vtype): ...these.
(oln_deferred_vtype, oln_deduce_deferred_vtype): New.
(oln_find_vtype, oln_find_deferred_vtype): New.
@@ -154,13 +155,17 @@
* oln/core/typedefs.hh: Likewise.
* oln/core/automatic/impl.hh: Likewise.
* oln/core/automatic/image/image.hh: Likewise.
- * oln/core/automatic/image/image_being_point_wise_random_accessible.hh: Likewise.
+ * oln/core/automatic/image/image_being_point_wise_random_accessible.hh:
+ Likewise.
* oln/core/automatic/image/image_having_neighborhood.hh: Likewise.
- * oln/core/automatic/image/image_being_value_wise_random_accessible.hh: Likewise.
+ * oln/core/automatic/image/image_being_value_wise_random_accessible.hh:
+ Likewise.
* oln/core/automatic/topology/topology_having_bbox.hh: Likewise.
* oln/core/automatic/topology/topology_having_subset.hh: Likewise.
- * oln/core/automatic/topology/topology_being_random_accessible.hh: Likewise.
- * oln/core/automatic/topology/topology_having_neighborhood.hh: Likewise.
+ * oln/core/automatic/topology/topology_being_random_accessible.hh:
+ Likewise.
+ * oln/core/automatic/topology/topology_having_neighborhood.hh:
+ Likewise.
* oln/core/spe/row.hh: Likewise.
* oln/core/spe/col.hh: Likewise.
* oln/core/spe/slice.hh: Likewise.
@@ -173,13 +178,16 @@
* 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/abstract/image/point_wise_accessibility/hierarchy.hh: Likewise.
- * oln/core/abstract/point_set/point_set_being_random_accessible.hh: Likewise.
+ * oln/core/abstract/image/point_wise_accessibility/hierarchy.hh:
+ Likewise.
+ * oln/core/abstract/point_set/point_set_being_random_accessible.hh:
+ Likewise.
* oln/core/abstract/point_set/point_set_having_known_size.hh: Likewise.
* oln/core/abstract/point_set/point_set_being_connected.hh: Likewise.
* oln/core/abstract/point_set/point_set_having_bbox.hh: Likewise.
* oln/core/abstract/topology/topology_having_bbox.hh: Likewise.
- * oln/core/abstract/topology/topology_being_random_accessible.hh: Likewise.
+ * oln/core/abstract/topology/topology_being_random_accessible.hh:
+ Likewise.
* oln/core/abstract/topology/topology_having_subset.hh: Likewise.
* oln/core/abstract/topology/topology_having_neighborhood.hh: Likewise.
* oln/core/abstract/internal/image_impl.hh: Likewise.
@@ -216,7 +224,7 @@
- stc::abstract instead of mlc::undefined;
- stc::final when possible;
- 'deferred' versions of vtype access when required.
-
+
* oln/core/point_set_entry.hh: Update.
(set_super_type): New.
(vtypes): Update.
@@ -233,19 +241,20 @@
* oln/core/abstract/window.hh: Likewise.
Remove obsolete definitions of now final vtypes.
-
+
* tests/core/image_entry.cc: Update.
* oln/core/1d/image1d.hh: Likewise.
* oln/core/2d/image2d.hh: Likewise.
* oln/core/3d/image3d.hh: Likewise.
-
+
Update tests with the 'find' version of vtype access.
-
+
* oln/core/abstract/image/mutability/hierarchy.hh: Update.
* oln/core/abstract/image/dimension/hierarchy.hh: Likewise.
* oln/core/abstract/image/neighborhood/hierarchy.hh: Likewise.
* oln/core/abstract/image/bbox/hierarchy.hh: Likewise.
- * oln/core/abstract/image/value_wise_accessibility/hierarchy.hh: Likewise.
+ * oln/core/abstract/image/value_wise_accessibility/hierarchy.hh:
+ Likewise.
Update from 'delegated' to 'delegatee'.
@@ -257,7 +266,7 @@
* oln/core/typedefs.hh (delegated_type): Add commentary.
Misc.
-
+
* tests/core/at.cc: Cosmetic change.
* oln/core/gen/bbox.hh (vtypes): Fix typo.
* oln/core/gen/pset_list.hh: Likewise.
@@ -299,12 +308,12 @@
(oln::vtypes< internal::point_nd<E> >::vec_type): Fix typedef.
* oln/core/internal/point_nd.hh
(oln::vtypes< internal::point_nd<E> >::vec_t): Remove typedef.
- (oln::vtypes< internal::point_nd<E> >::vec_type): Fix typedef.
+ (oln::vtypes< internal::point_nd<E> >::vec_type): Fix typedef.
2006-11-14 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Now call simplified scoop macros.
-
+
* oln/core/macros.hh
(oln_deduce_direct_type_of_, oln_deduce_direct_type_of): Remove.
(oln_check_type_of, oln_check_type_of_): Remove.
@@ -312,14 +321,14 @@
(oln_deduce): New; shortcut to oln_deduce_type_of.
Add missing shortcuts.
-
+
* oln/core/typedefs.hh (oln_dim, oln_dim_): New.
(oln_vec, oln_vec_): New.
(oln_bbox, oln_bbox_): New.
(include): Fix and add fwd decls.
Move single_vtype definitions into vtypes structures.
-
+
* oln/core/point_set_entry.hh: Update.
(single_vtype): Move into...
(vtypes): ...this.
@@ -341,10 +350,10 @@
* oln/morpher/thru_mfun.hh: Likewise.
* oln/morpher/stack_rw.hh: Likewise.
* oln/morpher/internal/image_value_morpher.hh: Likewise.
-
+
Prevent problems due to mutual recursion (thru inheritance
and dependent types).
-
+
* oln/core/abstract/image.hh (decl): Disable static checks.
* oln/core/abstract/image/bbox/hierarchy.hh: Update.
(decl): Disable static check.
@@ -354,13 +363,13 @@
Disable static check.
* oln/core/gen/bkd_piter_bbox.hh: Update.
Disable static check.
-
+
For safety purpose.
-
+
* oln/basics2d.hh (include): Move iterator_vtypes up.
Decouple some files from specific code.
-
+
* oln/core/automatic/image/mutable_image1d.hh
(include): Remove dependency to specific point header.
(tmp): Update.
@@ -385,7 +394,7 @@
* tests/core/dpoint2d.cc: Likewise.
Update.
-
+
* tests/morphers/with_lut.cc: Cosmetics.
* tests/core/image_entry.cc: Update.
* oln/io/pnm.hh: Use shortcuts.
@@ -457,7 +466,7 @@
Introduce oln::value::lut_value_proxy.
- * olena/oln/value/lut_value_proxy.hh: New.
+ * oln/value/lut_value_proxy.hh: New.
* oln/core/typedefs.hh (mutable_fwd_viter_type): Remove virtual
type declaration.
(value_proxy_type, mutable_value_proxy_type): New virtual types
@@ -495,7 +504,7 @@
Remove oln::mutable_fwd_viter_lut and clean up oln::fwd_viter_lut.
- * olena/oln/core/abstract/iterator_on_values.hh: New.
+ * oln/core/abstract/iterator_on_values.hh: New.
* oln/core/internal/fwd_viter_lut.hh:
(oln::internal::fwd_viter_lut<Exact>): Inherit from
oln::abstract::iterator_on_values<Exact>.
@@ -536,7 +545,7 @@
2006-11-07 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add point-set types based on std containers.
-
+
* oln/core/gen/piter_on_std_based_pset.hh: New.
* oln/core/gen/pset_list.hh: New.
* oln/core/gen/pset_vec.hh: New.
@@ -561,11 +570,11 @@
* oln/core/abstract/functions.hh (fun_rw): Update.
* oln/morpher/count_rw.hh (count_rw): Move impl into guards.
* oln/morpher/stack_rw.hh (include): Update.
-
+
2006-11-06 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add morpher::stack_rw.
-
+
* tests/morphers/stack_rw_morpher.cc: New.
* tests/morphers/Makefile.am: Update.
* oln/morpher/stack_rw.hh: New.
@@ -669,7 +678,7 @@
...this.
* oln/value/proxy.hh: Fix header guards.
(oln/core/typedefs.hh): Include it.
- * oln/Makefile.am (nobase_oln_HEADERS): Add
+ * oln/Makefile.am (nobase_oln_HEADERS): Add
core/abstract/image/computability/hierarchy.hh,
core/abstract/image/value_wise_accessibility/hierarchy.hh,
core/automatic/image/image_being_value_wise_random_accessible.hh,
@@ -745,13 +754,13 @@
2006-10-25 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Oops.
-
+
* oln/value/two_way.hh: New.
2006-10-25 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Tiny fix just before pastis.
-
+
* oln/basics1d.hh (include): Add missing headers.
* oln/basics2d.hh: Likewise.
* oln/basics3d.hh: Likewise.
@@ -759,7 +768,7 @@
2006-10-25 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add two-way morpher.
-
+
* tests/morphers/two_way_morpher.cc: New.
* tests/morphers/Makefile.am: Update.
* oln/morpher/two_way.hh: New.
@@ -772,7 +781,7 @@
2006-10-25 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add oln::level::apply_inplace.
-
+
* tests/level/apply_inplace.cc: New.
* oln/level/assign.hh: Typo.
* oln/level/apply.hh (apply_inplace): New.
@@ -782,7 +791,7 @@
2006-10-25 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add oln abstract functions + move slice vtype definitions.
-
+
* oln/level/assign.hh: New.
* oln/level/apply.hh: New.
* oln/level/clone.hh: New.
@@ -801,7 +810,7 @@
2006-10-25 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Introduce ids for images and better oln::morpher::count_rw_.
-
+
* tests/morphers/count_rw_morpher.cc: Add sample code in comments.
* oln/core/abstract/iterator_on_points.hh (operator<<): New.
* oln/core/abstract/image.hh (image, operator=): New.
@@ -827,7 +836,7 @@
2006-10-24 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add point-wise values.
-
+
* tests/core/pw_value.cc: New.
* tests/core/Makefile.am: Update.
* oln/core/gen/pw_value.hh: New.
@@ -836,7 +845,7 @@
2006-10-24 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add a morpher to count read-write ops.
-
+
* tests/morphers/count_rw_morpher.cc: New.
* tests/morphers/Makefile.am: Update.
* oln/morpher/count_rw.hh: New.
@@ -850,7 +859,7 @@
* oln/morpher/internal/image_value_morpher.hh
(image_value_morpher): New overloading for ctor.
(image_): Add & to its type.
-
+
2006-10-24 Roland Levillain <roland(a)lrde.epita.fr>
Add a morpher adding a look-up table to an image.
@@ -889,14 +898,14 @@
Fix debug track and disambiguate the 'at' method overloading
in const and mutable nD images.
-
+
* oln/core/abstract/array.hh: New.
* oln/debug/track.hh (n_arrays): New.
(include): Fix.
* oln/core/abstract/image.hh (image): New cpy ctor so fix
n_images tracking.
* oln/core/abstract/image/dimension/1d.hh: Disambiguate by
- changing inheritance to virtual + inserting a using directive.
+ changing inheritance to virtual + inserting a using directive.
* oln/core/abstract/image/dimension/2d.hh: Likewise.
* oln/core/abstract/image/dimension/3d.hh: Likewise.
* oln/core/1d/array1d.hh (array1d): Add inheritance.
@@ -908,7 +917,7 @@
Add stack morpher and remove the hack related to indexed mutable
access.
-
+
* tests/morphers/stack_morpher.cc: New.
* tests/morphers/Makefile.am: Update.
* oln/debug/track.hh: New.
@@ -991,7 +1000,7 @@
2006-10-20 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add morpher based on mutators.
-
+
* tests/value/accessor.cc: New.
* tests/value/Makefile.am: Update.
* oln/morpher/thru_mfun.hh: New.
@@ -1041,7 +1050,7 @@
* 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.
+ morpher/slice.hh.
* tests/morphers/slice_morpher.cc: New test.
* tests/morphers/Makefile.am (check_PROGRAMS): Add slice_morpher.
(slice_morpher_SOURCES): New.
@@ -1061,7 +1070,7 @@
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.
@@ -1071,7 +1080,7 @@
* 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.
@@ -1127,7 +1136,7 @@
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...
@@ -1150,7 +1159,7 @@
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.
@@ -1172,7 +1181,7 @@
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.
@@ -1217,7 +1226,7 @@
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.
@@ -1228,7 +1237,7 @@
2006-10-16 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add binary value type plus update image hierarchy plugs.
-
+
* oln/value/tags.hh: New.
* oln/value/bin.hh: New.
* oln/value/all.hh: New.
@@ -1239,11 +1248,11 @@
* oln/value/greylevel.hh (greylevel_): New conversion operator.
(gl1): Remove; now replaced by value::bin.
* oln/Makefile.am: Update.
-
+
2006-10-16 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add grey-level types.
-
+
* tests/grey.cc: New.
* tests/Makefile.am: Update.
* oln/value/default.hh: New.
@@ -1451,7 +1460,7 @@
2006-10-12 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add image accessors with indices.
-
+
* tests/at.cc: New.
* oln/core/automatic/image1d.hh: New.
* oln/core/automatic/image2d.hh: New.
@@ -1459,7 +1468,7 @@
* tests/Makefile.am (check_PROGRAMS): Add 'at'.
Move io_pnm to get consistent with SOURCES list.
(at_SOURCES): New.
- * oln/core/typedefs.hh (oln_psite, oln_psite_): New.
+ * oln/core/typedefs.hh (oln_psite, oln_psite_): New.
* oln/core/automatic/image_being_mutable.hh
(lvalue_t, psite_t): Remove; use oln_lvalue and oln_psite instead.
(impl_op_readwrite): Update sig.
1
0
723: Add temporary helpers to support the new SCOOP 2 implementation.
by Roland Levillain 26 Jan '07
by Roland Levillain 26 Jan '07
26 Jan '07
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Add temporary helpers to support the new SCOOP 2 implementation.
The macro OLENA_USE_NEW_SCOOP2 is used to tag the places where
support code is introduced.
* oln/core/typedefs.hh (stc/scoop2.hh) [OLENA_USE_NEW_SCOOP2]:
Include it.
(stc/scoop.hh) [!OLENA_USE_NEW_SCOOP2]: Include it.
Invoke stc_scoop_equipment_for_namespace(oln).
Temporary hack: define deferred virtual types as single_vtypes
when using new SCOOP 2 implementation.
* oln/core/image_entry.hh
(vtypes< image_entry<E> >::rvalue_type)
[!OLENA_USE_NEW_SCOOP2]: Define it.
(single_vtype<image_entry<E>, typedef_::rvalue_type>
[!OLENA_USE_NEW_SCOOP2]: Define it.
* oln/core/abstract/iterator_on_points.hh
(vtypes< abstract::iterator_on_points<E> >)
[!OLENA_USE_NEW_SCOOP2]: Define it.
(single_vtype<abstract::iterator_on_points<E>, typedef_::coord_type>)
[OLENA_USE_NEW_SCOOP2]: Define it.
* oln/core/abstract/point.hh (oln, oln):
(vtypes< abstract::point<E> >::coord_type)
(vtypes< abstract::point<E> >::vec_type)
[!OLENA_USE_NEW_SCOOP2]: Define them.
(single_vtype< abstract::point<E>, typedef_::coord_type>)
(single_vtype< abstract::point<E>, typedef_::vec_type>)
[OLENA_USE_NEW_SCOOP2]: Define them.
* oln/core/internal/point_nd.hh (vtypes< internal::point_nd<E> >):
Disable it (duplicate with vtypes< abstract::point<E> >).
* oln/core/internal/dpoint_nd.hh
(vtypes< internal::dpoint_nd<E> >::vec_type)
[!OLENA_USE_NEW_SCOOP2]: Define it.
(single_vtype< internal::dpoint_nd<E>, typedef_::vec_type >)
[OLENA_USE_NEW_SCOOP2]: Define it.
Fix the usage of stc::not_found and stc::is_found_.
* oln/core/abstract/image/dimension/hierarchy.hh
(case_<image_hierarchy_wrt_dimension, E, 1>)
(case_<image_hierarchy_wrt_dimension, E, 3>)
(case_<image_hierarchy_wrt_dimension, E, 5>)
[OLENA_USE_NEW_SCOOP2]: Use stc::is_found_ to check for the
existence of an lvalue.
[!OLENA_USE_NEW_SCOOP2]: Use mlc::is_found_ to check for the
existence of an lvalue.
* oln/core/abstract/image/mutability/hierarchy.hh
(case_<image_hierarchy_wrt_mutability, E, 1>)
[OLENA_USE_NEW_SCOOP2]: Use stc::is_found_ to check for the
existence of an lvalue.
[!OLENA_USE_NEW_SCOOP2]: Use mlc::is_found_ to check for the
existence of an lvalue.
* oln/core/abstract/image/bbox/hierarchy.hh
(case_<image_hierarchy_wrt_bbox, E, 1>)
[OLENA_USE_NEW_SCOOP2]: Use stc::is_found_ to check for the
existence of a bounding box.
[!OLENA_USE_NEW_SCOOP2]: Use mlc::is_found_ to check for the
existence of a bounding box.
* oln/core/abstract/image/hybrid/classical.hh
(case_<image_hybrid_hierarchy_wrt_classical, E, 1>)
(case_<image_hybrid_hierarchy_wrt_classical, E, 2>)
(case_<image_hybrid_hierarchy_wrt_classical, E, 3>)
(case_<image_hybrid_hierarchy_wrt_classical, E, 4>)
[OLENA_USE_NEW_SCOOP2]: Use stc::not_found to check for the
existence of a bounding box.
(case_<image_hybrid_hierarchy_wrt_classical, E, 1>)
(case_<image_hybrid_hierarchy_wrt_classical, E, 2>)
(case_<image_hybrid_hierarchy_wrt_classical, E, 3>)
(case_<image_hybrid_hierarchy_wrt_classical, E, 4>)
[!OLENA_USE_NEW_SCOOP2]: Use mlc::not_found to check for the
existence of a bounding box.
* oln/core/abstract/image/value_wise_accessibility/hierarchy.hh
(case_<image_hierarchy_wrt_value_wise_accessibility, E, 1>):
(case_<image_hierarchy_wrt_value_wise_accessibility, E, 2>):
[OLENA_USE_NEW_SCOOP2]: Use stc::is_found_ to check for the
existence of a value iterator (and a value proxy).
[!OLENA_USE_NEW_SCOOP2]: Use mlc::is_found_ to check for the
existence of a value iterator (and a value proxy).
* oln/core/abstract/image/neighborhood/hierarchy.hh
(case_<image_hierarchy_wrt_neighborhood, E, 1>)
[OLENA_USE_NEW_SCOOP2]: Use stc::is_found_ to check for the
existence of a neighborhood.
[!OLENA_USE_NEW_SCOOP2]: Use mlc::is_found_ to check for the
existence of a neighborhood.
* oln/core/abstract/grid.hh (set_super_type<abstract::grid<E>>):
New. Fix abstract::grid not having a super type.
* oln/morpher/thru_mfun.hxx: Move all implementations of methods
into...
(oln::morpher): ...this namespace.
* oln/core/gen/fwd_viter_lut.hh, oln/core/gen/bkd_viter_lut.hh,
* oln/core/gen/topo_bbox.hh, oln/core/gen/topo_lbbox.hh,
* oln/core/gen/topo_add_isubset.hh, oln/core/gen/topo_add_nbh.hh,
* oln/core/internal/bbox_fwd_piter.hh: Fix comments.
* oln/core/2d/point2d.hh (oln): Aesthetic changes.
* tests/core/point2d.cc: Fix inter-dependent headers.
* tests/core/dpoint2d.cc: Add a static assertion.
* tests/algorithms/fill.cc:
s/oln_type_of_(image_t, piter)/oln_piter_(image_t)/
oln/core/2d/point2d.hh | 1
oln/core/abstract/grid.hh | 7 +
oln/core/abstract/image/bbox/hierarchy.hh | 5 +
oln/core/abstract/image/dimension/hierarchy.hh | 30 +++++-
oln/core/abstract/image/hybrid/classical.hh | 44 +++++++---
oln/core/abstract/image/mutability/hierarchy.hh | 4
oln/core/abstract/image/neighborhood/hierarchy.hh | 5 +
oln/core/abstract/image/value_wise_accessibility/hierarchy.hh | 19 +++-
oln/core/abstract/iterator_on_points.hh | 11 ++
oln/core/abstract/point.hh | 22 +++++
oln/core/gen/bkd_viter_lut.hh | 2
oln/core/gen/fwd_viter_lut.hh | 2
oln/core/gen/topo_add_isubset.hh | 6 -
oln/core/gen/topo_add_nbh.hh | 6 -
oln/core/gen/topo_bbox.hh | 4
oln/core/gen/topo_lbbox.hh | 4
oln/core/image_entry.hh | 9 ++
oln/core/internal/bbox_fwd_piter.hh | 2
oln/core/internal/dpoint_nd.hh | 17 +++
oln/core/internal/point_nd.hh | 21 ++--
oln/core/typedefs.hh | 6 +
oln/morpher/thru_mfun.hxx | 5 +
tests/algorithms/fill.cc | 2
tests/core/dpoint2d.cc | 3
tests/core/point2d.cc | 3
25 files changed, 193 insertions(+), 47 deletions(-)
Index: tests/core/point2d.cc
--- tests/core/point2d.cc (revision 722)
+++ tests/core/point2d.cc (working copy)
@@ -27,7 +27,10 @@
#include <mlc/assert.hh>
#include <mlc/is_a.hh>
+// FIXME: There is an inter-dependency between point2d and dpoint2d.
+// Maybe we'll solve this with the interface/implementation separation?
#include <oln/core/2d/point2d.hh>
+#include <oln/core/2d/dpoint2d.hh>
int
Index: tests/core/dpoint2d.cc
--- tests/core/dpoint2d.cc (revision 722)
+++ tests/core/dpoint2d.cc (working copy)
@@ -39,4 +39,7 @@
mlc::assert_<
mlc_is_a_( dpoint_t, oln::internal::dpoint_nd )
>::check();
+
+ typedef oln_vtype_(dpoint_t, vec) vec_t;
+ mlc::assert_< mlc_is_a_( vec_t, mlc_comma_1(xtd::vec< 2u, int >) ) >::check();
}
Index: tests/algorithms/fill.cc
--- tests/algorithms/fill.cc (revision 722)
+++ tests/algorithms/fill.cc (working copy)
@@ -40,7 +40,7 @@
typedef oln::image2d<int> image_t;
image_t ima(3, 3);
oln::level::fill(ima, 51);
- oln_type_of_(image_t, piter) p(ima.topo());
+ oln_piter_(image_t) p(ima.topo());
for_all(p)
assert(ima(p) == 51);
}
Index: oln/core/typedefs.hh
--- oln/core/typedefs.hh (revision 722)
+++ oln/core/typedefs.hh (working copy)
@@ -41,7 +41,11 @@
# include <stc/any.hh>
# include <stc/exact.hh>
+# ifdef OLENA_USE_NEW_SCOOP2
+# include <stc/scoop2.hh>
+# else
# include <stc/scoop.hh>
+# endif // OLENA_USE_NEW_SCOOP2
# include <oln/core/type.hh>
// FIXME: Move to oln/core.
@@ -52,9 +56,11 @@
| Namespace equipment. |
`----------------------*/
+# ifndef OLENA_USE_NEW_SCOOP2
// The virtual types facility is inserted here because it also
// triggers Metalic's typedef introspection equipment.
stc_scoop_equipment_for_namespace(oln);
+# endif // !OLENA_USE_NEW_SCOOP2
namespace oln
Index: oln/core/image_entry.hh
--- oln/core/image_entry.hh (revision 722)
+++ oln/core/image_entry.hh (working copy)
@@ -71,7 +71,9 @@
// FIXME: default definitions:
typedef oln_point(E) psite_type;
+# ifndef OLENA_USE_NEW_SCOOP2
typedef oln_value(E) rvalue_type;
+# endif // !OLENA_USE_NEW_SCOOP2
/// \brief Morpher type.
///
@@ -79,6 +81,13 @@
typedef mlc::none morpher_type;
};
+# ifdef OLENA_USE_NEW_SCOOP2
+ template <typename E>
+ struct single_vtype< image_entry<E>, typedef_::rvalue_type >
+ {
+ typedef oln_value(E) ret;
+ };
+# endif // OLENA_USE_NEW_SCOOP2
/// Entry class for point sets: image_entry<E> is an alias for
Index: oln/core/abstract/iterator_on_points.hh
--- oln/core/abstract/iterator_on_points.hh (revision 722)
+++ oln/core/abstract/iterator_on_points.hh (working copy)
@@ -54,9 +54,20 @@
struct vtypes< abstract::iterator_on_points<E> >
{
typedef stc::abstract point_type;
+# ifndef OLENA_USE_NEW_SCOOP2
typedef oln_deduce_deferred_vtype(E, point, coord) coord_type;
+# endif // !OLENA_USE_NEW_SCOOP2
};
+# ifdef OLENA_USE_NEW_SCOOP2
+ template <typename E>
+ struct single_vtype< abstract::iterator_on_points<E>,
+ typedef_::coord_type >
+ {
+ typedef oln_deduce_deferred_vtype(E, point, coord) ret;
+ };
+# endif // OLENA_USE_NEW_SCOOP2
+
namespace abstract
{
Index: oln/core/abstract/image/hybrid/classical.hh
--- oln/core/abstract/image/hybrid/classical.hh (revision 722)
+++ oln/core/abstract/image/hybrid/classical.hh (working copy)
@@ -174,11 +174,16 @@
/// 1D case.
template <typename E>
struct case_< image_hybrid_hierarchy_wrt_classical, E, 1 > :
- where_< mlc::and_list_< mlc::eq_< oln_vtype(E, grid), oln::grid1d >,
+ where_< mlc::and_list_<
+ mlc::eq_< oln_vtype(E, grid), oln::grid1d >,
mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ >,
+ // FIXME: Shouldn't we use stc::is_found (resp. mlc::is_found) here?
+# ifdef OLENA_USE_NEW_SCOOP2
+ mlc::neq_< oln_deduce_vtype(E, topo, bbox), stc::not_found >
+# else
mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found >
- >
- >
+# endif // OLENA_USE_NEW_SCOOP2
+ > >
{
typedef abstract::classical_1d_image<E> ret;
};
@@ -187,11 +192,16 @@
/// 2D case.
template <typename E>
struct case_< image_hybrid_hierarchy_wrt_classical, E, 2 > :
- where_< mlc::and_list_< mlc::eq_< oln_vtype(E, grid), oln::grid2d >,
+ where_< mlc::and_list_<
+ mlc::eq_< oln_vtype(E, grid), oln::grid2d >,
mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ >,
+ // FIXME: Shouldn't we use stc::is_found (resp. mlc::is_found) here?
+# ifdef OLENA_USE_NEW_SCOOP2
+ mlc::neq_< oln_deduce_vtype(E, topo, bbox), stc::not_found >
+# else
mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found >
- >
- >
+# endif // OLENA_USE_NEW_SCOOP2
+ > >
{
typedef abstract::classical_2d_image<E> ret;
};
@@ -200,11 +210,16 @@
/// 3D case.
template <typename E>
struct case_< image_hybrid_hierarchy_wrt_classical, E, 3 > :
- where_< mlc::and_list_< mlc::eq_< oln_vtype(E, grid), oln::grid3d >,
+ where_< mlc::and_list_<
+ mlc::eq_< oln_vtype(E, grid), oln::grid3d >,
mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ >,
+ // FIXME: Shouldn't we use stc::is_found (resp. mlc::is_found) here?
+# ifdef OLENA_USE_NEW_SCOOP2
+ mlc::neq_< oln_deduce_vtype(E, topo, bbox), stc::not_found >
+# else
mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found >
- >
- >
+# endif // OLENA_USE_NEW_SCOOP2
+ > >
{
typedef abstract::classical_3d_image<E> ret;
};
@@ -213,10 +228,15 @@
/// General case.
template <typename E>
struct case_< image_hybrid_hierarchy_wrt_classical, E, 4 > :
- where_< mlc::and_< mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ >,
+ where_< mlc::and_<
+ mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ >,
+ // FIXME: Shouldn't we use stc::is_found (resp. mlc::is_found) here?
+# ifdef OLENA_USE_NEW_SCOOP2
+ mlc::neq_< oln_deduce_vtype(E, topo, bbox), stc::not_found >
+# else
mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found >
- >
- >
+# endif // OLENA_USE_NEW_SCOOP2
+ > >
{
typedef abstract::classical_image<E> ret;
};
Index: oln/core/abstract/image/mutability/hierarchy.hh
--- oln/core/abstract/image/mutability/hierarchy.hh (revision 722)
+++ oln/core/abstract/image/mutability/hierarchy.hh (working copy)
@@ -108,7 +108,11 @@
/// With mutability.
template <typename E>
struct case_< image_hierarchy_wrt_mutability, E, 1 > :
+# ifdef OLENA_USE_NEW_SCOOP2
+ where_< stc::is_found_< oln_find_vtype(E, lvalue) > >
+# else
where_< mlc::is_found_< oln_find_vtype(E, lvalue) > >
+# endif // OLENA_USE_NEW_SCOOP2
{
typedef abstract::mutable_image<E> ret;
};
Index: oln/core/abstract/image/dimension/hierarchy.hh
--- oln/core/abstract/image/dimension/hierarchy.hh (revision 722)
+++ oln/core/abstract/image/dimension/hierarchy.hh (working copy)
@@ -96,8 +96,14 @@
template <typename E>
struct case_< image_hierarchy_wrt_dimension, E, 1 > :
- where_< mlc::and_< mlc::eq_< oln_grid(E), oln::grid1d >,
- mlc::is_found_< oln_find_vtype(E, lvalue) > > >
+ where_< mlc::and_<
+ mlc::eq_< oln_grid(E), oln::grid1d >,
+# ifdef OLENA_USE_NEW_SCOOP2
+ stc::is_found_< oln_find_vtype(E, lvalue) >
+# else
+ mlc::is_found_< oln_find_vtype(E, lvalue) >
+# endif // OLENA_USE_NEW_SCOOP2
+ > >
{
typedef abstract::mutable_image1d<E> ret;
};
@@ -113,8 +119,14 @@
template <typename E>
struct case_< image_hierarchy_wrt_dimension, E, 3 > :
- where_< mlc::and_< mlc::eq_< oln_grid(E), oln::grid2d >,
- mlc::is_found_< oln_find_vtype(E, lvalue) > > >
+ where_< mlc::and_<
+ mlc::eq_< oln_grid(E), oln::grid2d >,
+# ifdef OLENA_USE_NEW_SCOOP2
+ stc::is_found_< oln_find_vtype(E, lvalue) >
+# else
+ mlc::is_found_< oln_find_vtype(E, lvalue) >
+# endif // OLENA_USE_NEW_SCOOP2
+ > >
{
typedef abstract::mutable_image2d<E> ret;
};
@@ -130,8 +142,14 @@
template <typename E>
struct case_< image_hierarchy_wrt_dimension, E, 5 > :
- where_< mlc::and_< mlc::eq_< oln_grid(E), oln::grid3d >,
- mlc::is_found_< oln_find_vtype(E, lvalue) > > >
+ where_< mlc::and_<
+ mlc::eq_< oln_grid(E), oln::grid3d >,
+# ifdef OLENA_USE_NEW_SCOOP2
+ stc::is_found_< oln_find_vtype(E, lvalue) >
+# else
+ mlc::is_found_< oln_find_vtype(E, lvalue) >
+# endif // OLENA_USE_NEW_SCOOP2
+ > >
{
typedef abstract::mutable_image3d<E> ret;
};
Index: oln/core/abstract/image/neighborhood/hierarchy.hh
--- oln/core/abstract/image/neighborhood/hierarchy.hh (revision 722)
+++ oln/core/abstract/image/neighborhood/hierarchy.hh (working copy)
@@ -106,7 +106,12 @@
/// With neighborhood.
template <typename E>
struct case_< image_hierarchy_wrt_neighborhood, E, 1 > :
+ // FIXME: Shouldn't we use stc::is_found (resp. mlc::is_found) here?
+# ifdef OLENA_USE_NEW_SCOOP2
+ where_< mlc::neq_< oln_find_vtype(E, neighborhood), stc::not_found > >
+# else
where_< mlc::neq_< oln_find_vtype(E, neighborhood), mlc::not_found > >
+# endif // OLENA_USE_NEW_SCOOP2
{
typedef abstract::image_having_neighborhood<E> ret;
};
Index: oln/core/abstract/image/bbox/hierarchy.hh
--- oln/core/abstract/image/bbox/hierarchy.hh (revision 722)
+++ oln/core/abstract/image/bbox/hierarchy.hh (working copy)
@@ -135,7 +135,12 @@
/// With bbox.
template <typename E>
struct case_< image_hierarchy_wrt_bbox, E, 1 > :
+ // FIXME: Shouldn't we use stc::is_found (resp. mlc::is_found) here?
+# ifdef OLENA_USE_NEW_SCOOP2
+ where_< mlc::neq_< oln_deduce_vtype(E, topo, bbox), stc::not_found > >
+# else
where_< mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found > >
+# endif // OLENA_USE_NEW_SCOOP2
{
typedef abstract::image_having_bbox<E> ret;
};
Index: oln/core/abstract/image/value_wise_accessibility/hierarchy.hh
--- oln/core/abstract/image/value_wise_accessibility/hierarchy.hh (revision 722)
+++ oln/core/abstract/image/value_wise_accessibility/hierarchy.hh (working copy)
@@ -133,8 +133,17 @@
/// With mutable value-wise random accessibility.
template <typename E>
struct case_< image_hierarchy_wrt_value_wise_accessibility, E, 1 > :
- where_< mlc_and( mlc_is_ok(oln_find_vtype(E, fwd_viter)),
- mlc_is_ok(oln_find_vtype(E, mutable_value_proxy)) ) >
+# ifdef OLENA_USE_NEW_SCOOP2
+ where_<
+ mlc_and( stc::is_found_< oln_find_vtype(E, fwd_viter) >,
+ stc::is_found_< oln_find_vtype(E, mutable_value_proxy) > )
+ >
+# else
+ where_<
+ mlc_and( mlc::is_found_< oln_find_vtype(E, fwd_viter) >,
+ mlc::is_found_< oln_find_vtype(E, mutable_value_proxy) > )
+ >
+# endif // OLENA_USE_NEW_SCOOP2
{
typedef abstract::mutable_image_being_value_wise_random_accessible<E> ret;
};
@@ -142,7 +151,11 @@
/// With (constant) value-wise random accessibility.
template <typename E>
struct case_< image_hierarchy_wrt_value_wise_accessibility, E, 2 > :
- where_< mlc_is_ok(oln_find_vtype(E, fwd_viter)) >
+# ifdef OLENA_USE_NEW_SCOOP2
+ where_< stc::is_found_< oln_find_vtype(E, fwd_viter) > >
+# else
+ where_< mlc::is_found_< oln_find_vtype(E, fwd_viter) > >
+# endif // OLENA_USE_NEW_SCOOP2
{
typedef abstract::image_being_value_wise_random_accessible<E> ret;
};
Index: oln/core/abstract/grid.hh
--- oln/core/abstract/grid.hh (revision 722)
+++ oln/core/abstract/grid.hh (working copy)
@@ -40,6 +40,13 @@
template <typename E> class grid;
}
+ /// Super type declaration.
+ template <typename E>
+ struct set_super_type< abstract::grid<E> >
+ {
+ typedef mlc::none ret;
+ };
+
/// Virtual types associated to oln::abstract::grid.
template <typename E>
struct vtypes< abstract::grid<E> >
Index: oln/core/abstract/point.hh
--- oln/core/abstract/point.hh (revision 722)
+++ oln/core/abstract/point.hh (working copy)
@@ -69,13 +69,35 @@
// FIXME: Prefer to use final<deduce..> when possible.
typedef stc::abstract grid_type;
typedef stc::abstract dpoint_type;
+# ifndef OLENA_USE_NEW_SCOOP2
typedef oln_deduce_deferred_vtype(E, dpoint, coord) coord_type;
+# endif // !OLENA_USE_NEW_SCOOP2
typedef stc::abstract dim_type;
+# ifndef OLENA_USE_NEW_SCOOP2
typedef oln_dim(E) dim_t;
typedef xtd::vec<mlc_value(dim_t), coord_type> vec_type;
+# endif // !OLENA_USE_NEW_SCOOP2
};
+# ifdef OLENA_USE_NEW_SCOOP2
+ template <typename E>
+ struct single_vtype< abstract::point<E>, typedef_::coord_type>
+ {
+ typedef oln_deduce_vtype(E, dpoint, coord) ret;
+ };
+
+ template <typename E>
+ struct single_vtype< abstract::point<E>, typedef_::vec_type>
+ {
+ private:
+ typedef oln_dim(E) dim_t;
+ typedef oln_coord(E) coord_t;
+ public:
+ typedef xtd::vec<mlc_value(dim_t), coord_t> ret;
+ };
+# endif // OLENA_USE_NEW_SCOOP2
+
namespace abstract
{
Index: oln/core/2d/point2d.hh
--- oln/core/2d/point2d.hh (revision 722)
+++ oln/core/2d/point2d.hh (working copy)
@@ -36,7 +36,6 @@
namespace oln
{
-
/// Fwd decls.
template <unsigned D> struct grid_;
template <typename C> struct dpoint2d_;
Index: oln/core/gen/topo_add_isubset.hh
--- oln/core/gen/topo_add_isubset.hh (revision 722)
+++ oln/core/gen/topo_add_isubset.hh (working copy)
@@ -36,7 +36,7 @@
{
- // Forward declarations.
+ // Forward declaration.
template <typename topo, typename isubset> class topo_add_isubset;
@@ -49,7 +49,7 @@
};
- /// Virtual types associated to oln::bbox_<point>.
+ /// Virtual types associated to oln::topo_add_isubset<topo, isubset>.
template <typename topo, typename isubset>
struct vtypes< topo_add_isubset<topo, isubset> >
{
@@ -57,7 +57,7 @@
};
- /// Bounding box topology based on a point class.
+ /// Topology based on another topology and a subset (encoded in an image).
template <typename topo_t, typename isubset_t>
class topo_add_isubset
: public internal::topology_morpher<topo_t, topo_add_isubset<topo_t, isubset_t> >
Index: oln/core/gen/topo_bbox.hh
--- oln/core/gen/topo_bbox.hh (revision 722)
+++ oln/core/gen/topo_bbox.hh (working copy)
@@ -35,7 +35,7 @@
namespace oln
{
- // Forward declarations.
+ // Forward declaration.
template <typename point> class topo_bbox_;
@@ -48,7 +48,7 @@
};
- /// Virtual types associated to oln::bbox_<point>.
+ /// Virtual types associated to oln::topo_bbox_<point>.
template <typename point>
struct vtypes< topo_bbox_<point> >
{
Index: oln/core/gen/bkd_viter_lut.hh
--- oln/core/gen/bkd_viter_lut.hh (revision 722)
+++ oln/core/gen/bkd_viter_lut.hh (working copy)
@@ -91,7 +91,7 @@
bool impl_is_valid() const;
/// \}
- // Get the value pointed by this iterator (const version).
+ /// Get the value pointed by this iterator.
value_type impl_to_value() const;
void print(std::ostream& ostr) const;
Index: oln/core/gen/topo_lbbox.hh
--- oln/core/gen/topo_lbbox.hh (revision 722)
+++ oln/core/gen/topo_lbbox.hh (working copy)
@@ -34,7 +34,7 @@
namespace oln
{
- // Forward declarations.
+ // Forward declaration.
template <typename point> class topo_lbbox_;
@@ -47,7 +47,7 @@
};
- /// Virtual types associated to oln::bbox_<point>.
+ /// Virtual types associated to oln::topo_lbbox_<point>.
template <typename point>
struct vtypes< topo_lbbox_<point> >
{
Index: oln/core/gen/fwd_viter_lut.hh
--- oln/core/gen/fwd_viter_lut.hh (revision 722)
+++ oln/core/gen/fwd_viter_lut.hh (working copy)
@@ -91,7 +91,7 @@
bool impl_is_valid() const;
/// \}
- // Get the value pointed by this iterator (const version).
+ /// Get the value pointed by this iterator.
value_type impl_to_value() const;
void print(std::ostream& ostr) const;
Index: oln/core/gen/topo_add_nbh.hh
--- oln/core/gen/topo_add_nbh.hh (revision 722)
+++ oln/core/gen/topo_add_nbh.hh (working copy)
@@ -36,7 +36,7 @@
{
- // Forward declarations.
+ // Forward declaration.
template <typename topo, typename nbh> class topo_add_nbh;
@@ -49,7 +49,7 @@
};
- /// Virtual types associated to oln::bbox_<point>.
+ /// Virtual types associated to oln::topo_add_nbh<topo, nbh>.
template <typename topo, typename nbh>
struct vtypes< topo_add_nbh<topo, nbh> >
{
@@ -58,7 +58,7 @@
};
- /// Bounding box topology based on a point class.
+ /// Topology based on another topology and a neighborhood.
template <typename topo_t, typename nbh_t>
class topo_add_nbh : public internal::topology_morpher<topo_t, topo_add_nbh<topo_t, nbh_t> >
{
Index: oln/core/internal/point_nd.hh
--- oln/core/internal/point_nd.hh (revision 722)
+++ oln/core/internal/point_nd.hh (working copy)
@@ -44,7 +44,6 @@
namespace oln
{
-
/// Function \f$point : (n, coord) \rightarrow point type\f$.
template <unsigned n, typename C>
@@ -67,16 +66,16 @@
typedef abstract::point<E> ret;
};
-
- template <typename E>
- struct vtypes< internal::point_nd<E> >
- {
- private:
- typedef oln_deferred_vtype(E, dim) dim_t;
- typedef oln_deferred_vtype(E, coord) coord_t;
- public:
- typedef xtd::vec<mlc_value(dim_t), coord_t> vec_type;
- };
+// FIXME: Already defined in vtypes< abstract::point<E> > (Why?).
+// template <typename E>
+// struct vtypes< internal::point_nd<E> >
+// {
+// private:
+// typedef oln_deferred_vtype(E, dim) dim_t;
+// typedef oln_deferred_vtype(E, coord) coord_t;
+// public:
+// typedef xtd::vec<mlc_value(dim_t), coord_t> vec_type;
+// };
namespace internal
Index: oln/core/internal/bbox_fwd_piter.hh
--- oln/core/internal/bbox_fwd_piter.hh (revision 722)
+++ oln/core/internal/bbox_fwd_piter.hh (working copy)
@@ -45,7 +45,7 @@
}
- // Super type declaration.
+ /// Super type declaration.
template <typename E>
struct set_super_type< internal::bbox_fwd_piter<E> >
{
Index: oln/core/internal/dpoint_nd.hh
--- oln/core/internal/dpoint_nd.hh (revision 722)
+++ oln/core/internal/dpoint_nd.hh (working copy)
@@ -54,13 +54,26 @@
template <typename E>
struct vtypes< internal::dpoint_nd<E> >
{
+# ifndef OLENA_USE_NEW_SCOOP2
private:
typedef oln_deferred_vtype(E, dim) dim_t;
typedef oln_deferred_vtype(E, coord) coord_t;
public:
typedef xtd::vec<mlc_value(dim_t), coord_t> vec_type;
+# endif // !OLENA_USE_NEW_SCOOP2
};
+# ifdef OLENA_USE_NEW_SCOOP2
+ template <typename E>
+ struct single_vtype< internal::dpoint_nd<E>, typedef_::vec_type >
+ {
+ private:
+ typedef oln_deferred_vtype(E, dim) dim_t;
+ typedef oln_deferred_vtype(E, coord) coord_t;
+ public:
+ typedef xtd::vec<mlc_value(dim_t), coord_t> ret;
+ };
+# endif // OLENA_USE_NEW_SCOOP2
namespace internal
{
@@ -68,6 +81,10 @@
template <typename E>
class dpoint_nd : public abstract::dpoint<E>
{
+// #ifdef USE_ALT_SCOOP2
+// typedef typename vtypes< internal::dpoint_nd<E> >::self_type dummy;
+// #endif // USE_ALT_SCOOP2
+
typedef E exact_t;
typedef dpoint_nd<E> self_t;
typedef oln_dim(E) dim_t;
Index: oln/morpher/thru_mfun.hxx
--- oln/morpher/thru_mfun.hxx (revision 722)
+++ oln/morpher/thru_mfun.hxx (working copy)
@@ -31,6 +31,9 @@
namespace oln
{
+ namespace morpher
+ {
+
template <typename Image, typename Fun>
thru_mfun<Image, Fun>::thru_mfun(const Image& image, const Fun& fun) :
super_t(image),
@@ -52,6 +55,8 @@
return fun_(this->image_(p));
}
+ } // end of namespace oln::morpher
+
} // end of namespace oln
#endif // ! OLN_MORPHER_THRU_MFUN_HXX
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/static
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Polish stc/scoop2.hh.
The work is far from beeing finished; we still have to address
the problem of deferred virtual types.
* doc/algorithms.ml: Add a new (non working) example.
Typos.
* stc/scoop.hh (stc_find_deduce_vtype): Add a missing argument.
* stc/scoop2.hh (stc::none): New.
(stc::is_found_, stc::is_not_found_): New.
(SCOOPED_NAMESPACE): Set to oln.
(stc_match_pair_0p_with, stc_match_pair_1p_with
(stc_match_pair_2p_with, stc_match_pair_1p_with_error)
(stc_match_pair_2p_with_error): New macros.
(merge2_): Use them to simplify this struct.
(stc_match_triple_0p_with, stc_match_triple_1p_with)
(stc_match_triple_2p_with, stc_match_triple_3p_with)
(stc_match_triple_2p_with_error, stc_match_triple_3p_with_error):
New macros.
(merge3_): Use them to simplify this struct.
(find): Rename struct as...
(find_vtype): ...this.
(vtype): New struct.
(stc_deferred_vtype, stc_vtype_, stc_vtype)
(stc_find_deduce_vtype_, stc_find_deduce_vtype)
(stc_deduce_deferred_vtype, stc_deduce_vtype_, stc_deduce_vtype):
New macros.
doc/algorithms.ml | 41 +++
stc/scoop.hh | 2
stc/scoop2.hh | 582 +++++++++++++++++++++++++++++++-----------------------
3 files changed, 378 insertions(+), 247 deletions(-)
Index: doc/algorithms.ml
--- doc/algorithms.ml (revision 721)
+++ doc/algorithms.ml (working copy)
@@ -80,8 +80,8 @@
| Stc_Not_found, u -> u
(* local_res == stc::abstract. *)
- | Stc_Abstract, Stc_Abstract -> Stc_Abstract
| Stc_Abstract, Stc_Not_found -> Stc_Abstract
+ | Stc_Abstract, Stc_Abstract -> Stc_Abstract
| Stc_Abstract, Stc_Final _ -> error "Final VT redefined abstract"
| Stc_Abstract, _ -> error "VT redefined abstract."
@@ -182,7 +182,7 @@
end
| _ -> error "find_rec: source is not a SCOOP class."
-(* Like find_rec, but only search in the inheritance branch. *)
+(* Like find_rec, but search only in the inheritance branch. *)
and find_rec_in_supers (source : cxx_type) (target : string) : cxx_type =
match source with
| Stc_None -> Stc_Not_found
@@ -206,7 +206,6 @@
;;
-
(*-----------.
| Examples. |
`-----------*)
@@ -611,3 +610,39 @@
assert (find image2d_int "value_type" = Std_Int);
assert (find value_cast__image2d_int__float "value_type" = Std_Float);;
+
+
+(*--------------.
+| Limitations. |
+`--------------*)
+
+(* Another Olena-like example with recursive definitions.
+
+ class internal_dpoint_nd < stc::none
+ {
+ vtype mydim_type = find dpoint2d "dim_type";
+ }
+
+ class dpoint2d < internal_dpoint_nd
+ {
+ // Dummy value (because our C++ types are limited in this prototype).
+ vtype dim_type = int
+ }
+*)
+(* However, we can't write this
+
+ let rec internal_dpoint_nd =
+ Scoop_Class { super = Stc_None;
+ vtypes = create_vtypes ["mydim_type",
+ (find dpoint2d "dim_type")] }
+ and dpoint2d =
+ Scoop_Class { super = internal_dpoint_nd;
+ vtypes = create_vtypes ["dim_type", Std_Int] }
+ in
+ find dpoint2d "dim_type";;
+
+ because of the limitations of the recursive definitions of OCaml.
+ These limitations reflect issues w.r.t. recursive definitions in
+ C++ too. A new mechanism is needed, both in this OCaml prototype
+ and in its C++ counterpart (stc/scoop2.hh).
+*)
Index: stc/scoop.hh
--- stc/scoop.hh (revision 721)
+++ stc/scoop.hh (working copy)
@@ -801,7 +801,7 @@
Namespace::typedef_::Target1##_type>::ret, \
Namespace::typedef_::Target2##_type>::ret
-# define stc_find_deduce_vtype(Namespace, From, Target) \
+# define stc_find_deduce_vtype(Namespace, From, Target1, Target2) \
typename \
Namespace::find_vtype< typename \
Namespace::find_vtype<From, \
Index: stc/scoop2.hh
--- stc/scoop2.hh (revision 721)
+++ stc/scoop2.hh (working copy)
@@ -39,14 +39,38 @@
namespace stc
{
-
+ /* FIXME: Define a real stc::none, instead of making it an alias of
+ mlc::none. For compatibility purpose with the current
+ implementation of the SCOOP 2 paradigme (see stc/scoop.hh), we
+ need to have stc::none be equal to mlc::none. */
+#if 0
struct none {};
+#endif
+ using mlc::none;
+
struct not_found;
struct abstract;
struct not_delegated;
struct not_delegated_abstract;
template <typename T> struct final;
+
+ /// \brief Shortcuts for comparison with stc::not_found.
+ ///
+ /// Duplicate with their Metalic's homonyms, but still useful, since
+ /// they deal with std::not_found (not mlc::not_found).
+ /// \{
+ template <typename T>
+ struct is_not_found_ : public mlc_is_a(T, stc::not_found)::bexpr
+ {
+ };
+
+ template <typename T>
+ struct is_found_ : public mlc_is_not_a(T, stc::not_found)::bexpr
+ {
+ };
+ /// \}
+
namespace ERROR
{
struct IN_find__VIRTUAL_TYPE_IS_ABSTRACT;
@@ -73,8 +97,10 @@
// Based on doc/algorithm.ml.
-// FIXME: Hack.
-#define SCOOPED_NAMESPACE my
+// FIXME: Temp. hack. The contents of SCOOPED_NAMESPACE will be
+// available later as a macro, as in stc/scoop.hh. Currently, it's
+// easier to work without this macro equipment.
+#define SCOOPED_NAMESPACE oln
// ------------------------------------------------------------ find_local.
@@ -152,106 +178,124 @@
// -------------------------------------------------------------- merge2.
+// Shortcuts macros.
+#define stc_match_pair_0p_with(Local, Super, Res) \
+ template <> \
+ struct match_with< Local, Super > \
+ { \
+ typedef Res ret; \
+ }
+
+#define stc_match_pair_1p_with(T1, Local, Super, Res) \
+ template < typename T1 > \
+ struct match_with< Local, Super > \
+ { \
+ typedef Res ret; \
+ }
+
+#define stc_match_pair_2p_with(T1, T2, Local, Super, Res) \
+ template < typename T1, typename T2 > \
+ struct match_with< Local, Super > \
+ { \
+ typedef Res ret; \
+ }
+
+// Erroneous cases.
+#define stc_match_pair_1p_with_error(T1, Local, Super, Msg) \
+ template < typename T1 > \
+ struct match_with< Local, Super > : \
+ mlc::abort_< T1, Msg > \
+ { \
+ }
+
+#define stc_match_pair_2p_with_error(T1, T2, Local, Super, Msg) \
+ template < typename T1, typename T2 > \
+ struct match_with< Local, Super > : \
+ mlc::abort_< T2, Msg > \
+ { \
+ }
+
+
namespace merge2_
{
// Forward declaration.
template <typename T, typename U> struct match_with;
- // super_res == stc::not_found.
- template <>
- struct match_with<stc::abstract, stc::not_found>
- {
- typedef stc::abstract ret;
- };
- template <>
- struct match_with<stc::not_found, stc::not_found>
- {
- typedef stc::not_found ret;
- };
- template <typename T>
- struct match_with<stc::final<T>, stc::not_found>
- {
- typedef stc::final<T> ret;
- };
+ /*------------------------------.
+ | local_res == stc::not_found. |
+ `------------------------------*/
- template <typename T>
- struct match_with<T, stc::not_found>
- {
- typedef T ret;
- };
+ stc_match_pair_0p_with(stc::not_found, stc::not_found,
+ stc::not_found);
+ stc_match_pair_0p_with(stc::not_found, stc::abstract,
+ stc::not_found);
- // super_res == stc::abstract.
- template <>
- struct match_with<stc::not_found, stc::abstract>
- {
- typedef stc::not_found ret;
- };
+ stc_match_pair_1p_with(U,
+ stc::not_found, stc::final<U>,
+ stc::final<U>);
- template <>
- struct match_with<stc::abstract, stc::abstract>
- {
- typedef stc::abstract ret;
- };
+ stc_match_pair_1p_with(U,
+ stc::not_found, U,
+ U);
- template <typename T>
- struct match_with<stc::final<T>, stc::abstract>
- {
- typedef stc::final<T> ret;
- };
- template <typename T>
- struct match_with<T, stc::abstract>
- {
- typedef T ret;
- };
+ /*-----------------------------.
+ | local_res == stc::abstract. |
+ `-----------------------------*/
+ stc_match_pair_0p_with(stc::abstract, stc::not_found,
+ stc::abstract);
- // super_res == stc::final<U>.
- template <typename U>
- struct match_with<stc::abstract, stc::final<U> > :
- mlc::abort_<U, stc::ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT>
- {
- };
+ stc_match_pair_0p_with(stc::abstract, stc::abstract,
+ stc::abstract);
- template <typename U>
- struct match_with<stc::not_found, stc::final<U> >
- {
- typedef stc::final<U> ret;
- };
+ stc_match_pair_1p_with_error(U,
+ stc::abstract, stc::final<U>,
+ stc::ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT);
- template <typename T, typename U>
- struct match_with<stc::final<T>, stc::final<U> > :
- mlc::abort_<U, stc::ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED_FINAL>
- {
- };
+ stc_match_pair_1p_with_error(U,
+ stc::abstract, U,
+ stc::ERROR::IN_merge2__VIRTUAL_TYPE_REDEFINED_ABSTRACT);
- template <typename T, typename U>
- struct match_with<T, stc::final<U> > :
- mlc::abort_<U, stc::ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED>
- {
- };
+ /*-----------------------------.
+ | local_res == stc::final<T>. |
+ `-----------------------------*/
- // super_res == U.
- template <typename U>
- struct match_with<stc::abstract, U> :
- mlc::abort_<U, stc::ERROR::IN_merge2__VIRTUAL_TYPE_REDEFINED_ABSTRACT>
- {
- };
+ stc_match_pair_1p_with(T,
+ stc::final<T>, stc::not_found,
+ stc::final<T>);
- template <typename U>
- struct match_with<stc::not_found, U>
- {
- typedef U ret;
- };
+ stc_match_pair_1p_with(T,
+ stc::final<T>, stc::abstract,
+ stc::final<T>);
- template <typename T, typename U>
- struct match_with<stc::final<T>, U>
- {
- typedef stc::final<T> ret;
- };
+ stc_match_pair_2p_with_error(T, U,
+ stc::final<T>, stc::final<U>,
+ stc::ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED_FINAL);
+
+ stc_match_pair_2p_with(T, U,
+ stc::final<T>, U,
+ stc::final<T>);
+
+
+ /*-----------------.
+ | local_res == T. |
+ `-----------------*/
+
+ stc_match_pair_1p_with(T,
+ T, stc::not_found,
+ T);
+
+ stc_match_pair_1p_with(T,
+ T, stc::abstract,
+ T);
+
+ stc_match_pair_2p_with_error(T, U,
+ T, stc::final<U>,
+ stc::ERROR::IN_merge2__FINAL_VIRTUAL_TYPE_REDEFINED);
template <typename T, typename U>
struct match_with
@@ -261,6 +305,12 @@
} // end of namespace merge2_
+#undef stc_match_pair_2p_with_error
+#undef stc_match_pair_1p_with_error
+#undef stc_match_pair_2p_with
+#undef stc_match_pair_1p_with
+#undef stc_match_pair_0p_with
+
template <typename local_res, typename super_res>
struct merge2
{
@@ -271,38 +321,50 @@
// -------------------------------------------------------------- merge3.
- // FIXME: Undef these macros after the definition of merge3.
-
-#define stc_match_0p_with(Local, Super, Deleg, Res) \
+// Shortcuts macros.
+#define stc_match_triple_0p_with(Local, Super, Deleg, Res) \
template <> \
struct match_with< Local, Super, Deleg > \
{ \
typedef Res ret; \
}
-#define stc_match_1p_with(T1, Local, Super, Deleg, Res) \
+#define stc_match_triple_1p_with(T1, Local, Super, Deleg, Res) \
template <typename T1> \
struct match_with< Local, Super, Deleg > \
{ \
typedef Res ret; \
}
-#define stc_match_2p_with(T1, T2, Local, Super, Deleg, Res) \
+#define stc_match_triple_2p_with(T1, T2, Local, Super, Deleg, Res) \
template <typename T1, typename T2> \
struct match_with< Local, Super, Deleg > \
{ \
typedef Res ret; \
}
-#define stc_match_3p_with(T1, T2, T3, Local, Super, Deleg, Res) \
+#define stc_match_triple_3p_with(T1, T2, T3, Local, Super, Deleg, Res) \
template <typename T1, typename T2, typename T3> \
struct match_with< Local, Super, Deleg > \
{ \
typedef Res ret; \
}
- // FIXME: Example of use.
- // stc_match_with(stc::not_found, stc::not_found, stc::not_found, stc::not_found);
+// Erroneous cases.
+#define stc_match_triple_2p_with_error(T1, T2, Local, Super, Deleg, Msg) \
+ template < typename T1, typename T2 > \
+ struct match_with< Local, Super, Deleg > : \
+ mlc::abort_< T2, Msg > \
+ { \
+ }
+
+#define stc_match_triple_3p_with_error(T1, T2, T3, Local, Super, Deleg, Msg) \
+ template < typename T1, typename T2, typename T3 > \
+ struct match_with< Local, Super, Deleg > : \
+ mlc::abort_< T3, Msg > \
+ { \
+ }
+
namespace merge3_
{
@@ -310,198 +372,155 @@
template <typename T, typename U, typename V> struct match_with;
- // local_res == stc::not_found.
- template <>
- struct match_with<stc::not_found, stc::not_found, stc::not_found>
- {
- typedef stc::not_found ret;
- };
+ /*------------------------------.
+ | local_res == stc::not_found. |
+ `------------------------------*/
- template <>
- struct match_with<stc::not_found, stc::not_found, stc::abstract>
- {
- typedef stc::not_found ret;
- };
+ // super_res == stc::not_found.
+ stc_match_triple_0p_with(stc::not_found, stc::not_found, stc::not_found,
+ stc::not_found);
- template <typename V>
- struct match_with<stc::not_found, stc::not_found, stc::final<V> >
- {
- typedef stc::final<V> ret;
- };
+ stc_match_triple_0p_with(stc::not_found, stc::not_found, stc::abstract,
+ stc::not_found);
- template <typename V>
- struct match_with<stc::not_found, stc::not_found, V>
- {
- typedef V ret;
- };
+ stc_match_triple_1p_with(V,
+ stc::not_found, stc::not_found, stc::final<V>,
+ stc::final<V>);
+
+ stc_match_triple_1p_with(V,
+ stc::not_found, stc::not_found, V,
+ V);
+ // super_res == stc::abstract.
+ stc_match_triple_0p_with(stc::not_found, stc::abstract, stc::not_found,
+ stc::not_found);
- template <>
- struct match_with<stc::not_found, stc::abstract, stc::not_found>
- {
- typedef stc::not_found ret;
- };
+ stc_match_triple_0p_with(stc::not_found, stc::abstract, stc::abstract,
+ stc::abstract);
- template <>
- struct match_with<stc::not_found, stc::abstract, stc::abstract>
- {
- typedef stc::abstract ret;
- };
+ stc_match_triple_1p_with(V,
+ stc::not_found, stc::abstract, stc::final<V>,
+ stc::final<V>);
- template <typename V>
- struct match_with<stc::not_found, stc::abstract, stc::final<V> >
- {
- typedef stc::final<V> ret;
- };
+ stc_match_triple_1p_with(V,
+ stc::not_found, stc::abstract, V,
+ V);
- template <typename V>
- struct match_with<stc::not_found, stc::abstract, V>
- {
- typedef V ret;
- };
+ // super_res is a concrete type.
+ stc_match_triple_2p_with(U, V,
+ stc::not_found, stc::final<U>, V,
+ stc::final<U>);
+ stc_match_triple_2p_with(U, V,
+ stc::not_found, U, V,
+ U);
- template <typename U, typename V>
- struct match_with<stc::not_found, stc::final<U>, V>
- {
- typedef stc::final<U> ret;
- };
- template <typename U, typename V>
- struct match_with<stc::not_found, U, V>
- {
- typedef U ret;
- };
+ /*-----------------------------.
+ | local_res == stc::abstract. |
+ `-----------------------------*/
+ // super_res == stc::not_found.
+ stc_match_triple_0p_with(stc::abstract, stc::not_found, stc::not_found,
+ stc::abstract);
- // local_res == stc::abstract.
- template <>
- struct match_with<stc::abstract, stc::not_found, stc::not_found>
- {
- typedef stc::abstract ret;
- };
+ stc_match_triple_0p_with(stc::abstract, stc::not_found, stc::abstract,
+ stc::abstract);
- template <>
- struct match_with<stc::abstract, stc::not_found, stc::abstract>
- {
- typedef stc::abstract ret;
- };
+ stc_match_triple_1p_with(V,
+ stc::abstract, stc::not_found, stc::final<V>,
+ stc::final<V>);
+
+ stc_match_triple_1p_with(V,
+ stc::abstract, stc::not_found, V,
+ V);
- template <typename V>
- struct match_with<stc::abstract, stc::not_found, stc::final<V> >
- {
- typedef stc::final<V> ret;
- };
- template <typename V>
- struct match_with<stc::abstract, stc::not_found, V >
- {
- typedef V ret;
- };
+ // super_res == stc::abstract.
+ stc_match_triple_0p_with(stc::abstract, stc::abstract, stc::not_found,
+ stc::abstract);
+ stc_match_triple_0p_with(stc::abstract, stc::abstract, stc::abstract,
+ stc::abstract);
- template <>
- struct match_with<stc::abstract, stc::abstract, stc::not_found>
- {
- typedef stc::abstract ret;
- };
+ stc_match_triple_1p_with(V,
+ stc::abstract, stc::abstract, stc::final<V>,
+ stc::final<V>);
- template <>
- struct match_with<stc::abstract, stc::abstract, stc::abstract>
- {
- typedef stc::abstract ret;
- };
+ stc_match_triple_1p_with(V,
+ stc::abstract, stc::abstract, V,
+ V);
- template <typename V>
- struct match_with<stc::abstract, stc::abstract, stc::final<V> >
- {
- typedef stc::final<V> ret;
- };
- template <typename V>
- struct match_with<stc::abstract, stc::abstract, V>
- {
- typedef V ret;
- };
+ // super_res == stc::not_delegated_abstract.
+ stc_match_triple_1p_with(V,
+ stc::abstract, stc::not_delegated_abstract, V,
+ stc::not_delegated_abstract);
+ stc_match_triple_1p_with(V,
+ stc::abstract, stc::not_delegated, V,
+ stc::not_delegated_abstract);
- template <typename V>
- struct match_with<stc::abstract, stc::not_delegated_abstract, V>
- {
- typedef stc::not_delegated_abstract ret;
- };
- template <typename V>
- struct match_with<stc::abstract, stc::not_delegated, V>
- {
- typedef stc::not_delegated_abstract ret;
- };
+ // super_res is a concrete type.
+ stc_match_triple_2p_with_error(U, V,
+ stc::abstract, stc::final<U>, V,
+ stc::ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT);
+ stc_match_triple_2p_with_error(U, V,
+ stc::abstract, U, V,
+ stc::ERROR::IN_merge3__VIRTUAL_TYPE_REDEFINED_ABSTRACT);
- template <typename U, typename V>
- struct match_with<stc::abstract, stc::final<U>, V> :
- mlc::abort_<V, stc::ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED_ABSTRACT>
- {
- };
- template <typename U, typename V>
- struct match_with<stc::abstract, U, V> :
- mlc::abort_<V, stc::ERROR::IN_merge3__VIRTUAL_TYPE_REDEFINED_ABSTRACT>
- {
- };
+ /*----------------------------------.
+ | local_res == stc::not_delegated. |
+ `----------------------------------*/
+ stc_match_triple_1p_with(V,
+ stc::not_delegated, stc::not_found, V,
+ stc::not_delegated);
- // local_res == stc::not_delegated.
- template <typename V>
- struct match_with<stc::not_delegated, stc::not_found, V>
- {
- typedef stc::not_delegated ret;
- };
+ stc_match_triple_1p_with(V,
+ stc::not_delegated, stc::abstract, V,
+ stc::not_delegated_abstract);
- template <typename V>
- struct match_with<stc::not_delegated, stc::abstract, V>
- {
- typedef stc::not_delegated_abstract ret;
- };
+ stc_match_triple_1p_with(V,
+ stc::not_delegated, stc::not_delegated_abstract, V,
+ stc::not_delegated_abstract);
- template <typename V>
- struct match_with<stc::not_delegated, stc::not_delegated_abstract, V>
- {
- typedef stc::not_delegated_abstract ret;
- };
+ /*----------------------------------------------.
+ | local_res == stc::not_delegated_abstract. *) |
+ `----------------------------------------------*/
- // local_res == stc::not_delegated_abstract. *)
/* FIXME: Shouldn't we introduce a means to tag a vtype both
as abstract *and* not delegated? (Currently, the rule below
prevents this). */
- template <typename U, typename V>
- struct match_with<stc::not_delegated_abstract, U, V> :
- mlc::abort_<V, stc::ERROR::IN_merge3__LOCAL_DECLARATION_OF_NOT_DELEGATED_AND_ABSTRACT>
- {
- };
+ stc_match_triple_2p_with_error(U, V,
+ stc::not_delegated_abstract, U, V,
+ stc::ERROR::IN_merge3__LOCAL_DECLARATION_OF_NOT_DELEGATED_AND_ABSTRACT);
- // local_res == stc::final<T>.
- template <typename T, typename U, typename V>
- struct match_with<stc::final<T>, stc::final<U>, V> :
- mlc::abort_<V, stc::ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED_FINAL>
- {
- };
+ /*-----------------------------.
+ | local_res == stc::final<T>. |
+ `-----------------------------*/
- template <typename T, typename U, typename V>
- struct match_with<stc::final<T>, U, V>
- {
- typedef stc::final<T> ret;
- };
+ stc_match_triple_3p_with_error(T, U, V,
+ stc::final<T>, stc::final<U>, V,
+ stc::ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED_FINAL);
+ stc_match_triple_3p_with(T, U, V,
+ stc::final<T>, U, V,
+ stc::final<T>);
- // local_res == T.
- template <typename T, typename U, typename V>
- struct match_with<T, stc::final<U>, V> :
- mlc::abort_<V, stc::ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED>
- {
- };
+
+ /*-----------------.
+ | local_res == T. |
+ `-----------------*/
+
+ stc_match_triple_3p_with_error(T, U, V,
+ T, stc::final<U>, V,
+ stc::ERROR::IN_merge3__FINAL_VIRTUAL_TYPE_REDEFINED);
template <typename T, typename U, typename V>
struct match_with
@@ -511,6 +530,15 @@
} // end of namespace merge3_
+
+#undef stc_match_triple_3p_with_error
+#undef stc_match_triple_2p_with_error
+#undef stc_match_triple_3p_with
+#undef stc_match_triple_2p_with
+#undef stc_match_triple_1p_with
+#undef stc_match_triple_0p_with
+
+
template <typename local_res, typename super_res, typename delegatee_res>
struct merge3
{
@@ -669,21 +697,89 @@
} // end of namespace find_
+
+ /// Find a virtual type.
template <typename source, typename target>
- struct find
+ struct find_vtype
{
typedef typename find_rec<source, target>::ret res;
// Result.
typedef typename find_::match_with<res>::ret ret;
};
+
+ /// Find a virtual type, and ensure it is found.
+ template <typename from, typename target>
+ struct vtype
+ {
+ typedef typename find_vtype<from, target>::ret res;
+ struct check_ : mlc::assert_< mlc::is_found_<res> >
+ {
+ typedef res ret;
+ };
+ typedef typename check_::ret ret;
+ };
+
} /* end of SCOOPED_NAMESPACE */
+// FIXME: Document all these macros.
+
# define stc_find_vtype_(Namespace, Source, Target) \
- Namespace::find<Source, Namespace::typedef_::Target##_type>::ret
+ Namespace::find_vtype<Source, Namespace::typedef_::Target##_type>::ret
# define stc_find_vtype(Namespace, Source, Target) \
typename stc_find_vtype_(Namespace, Source, Target)
+// Dummy alias, for compatibility purpose (deferred virtual types are
+// not currently handled by this version of stc/scoop2.hh).
+# define stc_deferred_vtype(Namespace, From, Target) \
+ stc_find_vtype(Namespace, From, Target)
+
+# define stc_vtype_(Namespace, From, Target) \
+ Namespace::vtype<From, Namespace::typedef_::Target##_type>::ret
+
+# define stc_vtype(Namespace, From, Target) \
+ typename stc_vtype_(Namespace, From, Target)
+
+# define stc_find_deduce_vtype_(Namespace, From, Target1, Target2) \
+ Namespace::find_vtype< \
+ Namespace::find_vtype< \
+ From, \
+ Namespace::typedef_::Target1##_type \
+ >::ret, \
+ Namespace::typedef_::Target2##_type \
+ >::ret
+
+# define stc_find_deduce_vtype(Namespace, From, Target1, Target2) \
+ typename Namespace::find_vtype< \
+ typename Namespace::find_vtype< \
+ From, \
+ Namespace::typedef_::Target1##_type \
+ >::ret, \
+ Namespace::typedef_::Target2##_type \
+ >::ret
+
+# define stc_deduce_deferred_vtype(Namespace, From, Target1, Target2) \
+ stc_find_deduce_vtype(Namespace, From, Target1, Target2)
+
+# define stc_deduce_vtype_(Namespace, From, Target1, Target2) \
+ Namespace::vtype< \
+ Namespace::vtype< \
+ From, \
+ Namespace::typedef_::Target1##_type \
+ >::ret, \
+ Namespace::typedef_::Target2##_type \
+ >::ret
+
+# define stc_deduce_vtype(Namespace, From, Target1, Target2) \
+ typename Namespace::vtype< \
+ typename Namespace::vtype< \
+ From, \
+ Namespace::typedef_::Target1##_type \
+ >::ret, \
+ Namespace::typedef_::Target2##_type \
+ >::ret
+
+
#endif // ! STC_SCOOP2_HH
1
0
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
URL: https://svn.lrde.epita.fr/svn/oln/trunk/olena
ChangeLog:
2007-01-19 Thomas Moulard <thomas.moulard(a)lrde.epita.fr>
Split morphers' interface and implementation.
* oln/morpher/add_isubset.hh: Split into...
* oln/morpher/add_isubset.hxx: ...this new file.
* oln/morpher/add_neighborhood.hh: Split into...
* oln/morpher/add_neighborhood.hxx: : ...this new file.
* oln/morpher/count_rw.hh: Split into...
* oln/morpher/count_rw.hxx: : ...this new file.
* oln/morpher/identity.hh: Split into...
* oln/morpher/identity.hxx: : ...this new file.
* oln/morpher/stack.hh: Split into...
* oln/morpher/stack.hxx: : ...this new file.
* oln/morpher/stack_rw.hh: Split into...
* oln/morpher/stack_rw.hxx: : ...this new file.
* oln/morpher/thru_fun.hh: Split into...
* oln/morpher/thru_mfun.hh: Split into...
* oln/morpher/thru_mfun.hxx: : ...this new file.
* oln/morpher/two_way.hh: Split into...
* oln/morpher/two_way.hxx: : ...this new file.
* oln/morpher/two_way_rw.hh: Split into...
* oln/morpher/two_way_rw.hxx: : ...this new file.
* oln/morpher/value_cast.hh: Split into...
* oln/morpher/value_cast.hxx: : ...this new file.
* oln/morpher/with_lut.hh: Split into...
* oln/morpher/with_lut.hxx: : ...this new file.
add_isubset.hh | 60 ++----------------------
add_isubset.hxx | 98 +++++++++++++++++++++++++++++++++++++++
add_neighborhood.hh | 40 +---------------
add_neighborhood.hxx | 82 ++++++++++++++++++++++++++++++++
count_rw.hh | 62 +-----------------------
count_rw.hxx | 105 ++++++++++++++++++++++++++++++++++++++++++
identity.hh | 10 ++--
identity.hxx | 55 ++++++++++++++++++++++
stack.hh | 75 +-----------------------------
stack.hxx | 121 ++++++++++++++++++++++++++++++++++++++++++++++++
stack_rw.hh | 92 ++----------------------------------
stack_rw.hxx | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++
thru_fun.hh | 8 +--
thru_mfun.hh | 39 +++------------
thru_mfun.hxx | 64 +++++++++++++++++++++++++
two_way.hh | 52 ++++----------------
two_way.hxx | 80 ++++++++++++++++++++++++++++++++
two_way_rw.hh | 42 +---------------
two_way_rw.hxx | 79 +++++++++++++++++++++++++++++++
value_cast.hh | 35 ++------------
value_cast.hxx | 68 +++++++++++++++++++++++++++
with_lut.hh | 64 +------------------------
with_lut.hxx | 91 ++++++++++++++++++++++++++++++++++++
23 files changed, 1034 insertions(+), 515 deletions(-)
Index: oln/morpher/stack_rw.hxx
===================================================================
- --- oln/morpher/stack_rw.hxx (revision 0)
+++ oln/morpher/stack_rw.hxx (revision 0)
@@ -0,0 +1,127 @@
+// Copyright (C) 2007 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_STACK_RW_HXX
+# define OLN_MORPHER_STACK_RW_HXX
+
+namespace oln
+{
+
+ namespace morpher
+ {
+
+ template <unsigned n, typename I>
+ stack_rw<n, I>::stack_rw(const xtd::vec<n, I>& images) :
+ super_t(images[0]),
+ images_(images)
+ {
+ }
+
+ template <unsigned n, typename I>
+ xtd::vec<n, oln_value(I)>
+ stack_rw<n, I>::impl_op_read(const typename stack_rw<n, I>::psite_t& p) const
+ {
+ xtd::vec<n, oln_value(I)> tmp;
+ for (unsigned i = 0; i < n; ++i)
+ tmp[i] = images_[i](p);
+ return tmp;
+ }
+
+ template <unsigned n, typename I>
+ typename stack_rw<n, I>::lvalue_t
+ stack_rw<n, I>::impl_op_readwrite(const typename stack_rw<n, I>::psite_t& p)
+ {
+ lvalue_t tmp(*this, p);
+ return tmp;
+ }
+
+ template <unsigned n, typename I>
+ const I&
+ stack_rw<n, I>::image(unsigned i) const
+ {
+ precondition(i < n);
+ return images_[i];
+ }
+
+ template <unsigned n, typename I>
+ I&
+ stack_rw<n, I>::image(unsigned i)
+ {
+ precondition(i < n);
+ return images_[i];
+ }
+
+ } // end of namespace oln::morpher
+
+
+ template <typename I>
+ morpher::stack_rw<2, I>
+ stack_rw(abstract::mutable_image<I>& image_0,
+ abstract::mutable_image<I>& image_1)
+ {
+ morpher::stack_rw<2, I> tmp(xtd::mk_vec(image_0.exact(),
+ image_1.exact()));
+ return tmp;
+ }
+
+ template <typename I>
+ morpher::stack_rw<3, I>
+ stack_rw(abstract::mutable_image<I>& image_0,
+ abstract::mutable_image<I>& image_1,
+ abstract::mutable_image<I>& image_2)
+ {
+ morpher::stack_rw<3, I> tmp(xtd::mk_vec(image_0.exact(),
+ image_1.exact(),
+ image_2.exact()));
+ return tmp;
+ }
+
+ template <typename I>
+ morpher::stack_rw<4, I>
+ stack_rw(abstract::mutable_image<I>& image_0,
+ abstract::mutable_image<I>& image_1,
+ abstract::mutable_image<I>& image_2,
+ abstract::mutable_image<I>& image_3)
+ {
+ morpher::stack_rw<4, I> tmp(xtd::mk_vec(image_0.exact(),
+ image_1.exact(),
+ image_2.exact(),
+ image_3.exact()));
+ return tmp;
+ }
+
+} // end of namespace oln
+
+#endif // ! OLN_MORPHER_STACK_RW_HXX
+
+
+
+
+
+
+
+
Index: oln/morpher/add_isubset.hh
===================================================================
- --- oln/morpher/add_isubset.hh (revision 719)
+++ oln/morpher/add_isubset.hh (working copy)
@@ -1,4 +1,4 @@
- -// Copyright (C) 2006 EPITA Research and Development Laboratory
+// Copyright (C) 2006, 2007 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
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
- -#ifndef OLN_MORPHER_ADD_ISUBSET
- -# define OLN_MORPHER_ADD_ISUBSET
+#ifndef OLN_MORPHER_ADD_ISUBSET_HH
+# define OLN_MORPHER_ADD_ISUBSET_HH
# include <oln/core/abstract/image.hh>
# include <oln/core/abstract/image/type/binary.hh>
@@ -93,34 +93,9 @@
protected:
topo_t topo_;
};
- -
- -
- -
- -# ifndef OLN_INCLUDE_ONLY
- -
- - template <typename Image, typename Isubset>
- - add_isubset<Image, Isubset>::add_isubset(const Image& image, const Isubset& isubset) :
- - super_t(image),
- - topo_(image.topo(), isubset)
- - {
- - // mlc::assert_equal_<oln_vtype(Image, grid), oln_vtype(Isubset, grid)>::check();
- - // FIXME: check that Image is without a isubset
- - }
- -
- - template <typename Image, typename Isubset>
- - const typename add_isubset<Image, Isubset>::topo_t&
- - add_isubset<Image, Isubset>::impl_topo() const
- - {
- - return topo_;
- - }
- -
- -# endif
- -
- -
} // end of namespace oln::morpher
- -
template <typename I, typename S>
morpher::add_isubset<I, S>
operator | (const abstract::image<I>& image,
@@ -135,33 +110,10 @@
operator | (const abstract::image<I>& image,
const xtd::abstract::fun_nary_expr_<1,S>& fsubset);
- -
+} // end of namespace oln
# ifndef OLN_INCLUDE_ONLY
- -
- - template <typename I, typename S>
- - morpher::add_isubset<I, S>
- - operator | (const abstract::image<I>& image,
- - const abstract::binary_image<S>& isubset)
- - {
- - mlc::assert_equal_<oln_vtype(I, grid), oln_vtype(S, grid)>::check();
- - // FIXME: check that Image does not have yet a subset
- - morpher::add_isubset<I, S> tmp(image.exact(), isubset.exact());
- - return tmp;
- - }
- -
- - template <typename I, typename S>
- - morpher::add_isubset<I, S>
- - operator | (const abstract::image<I>& image,
- - const xtd::abstract::fun_nary_expr_<1,S>& fsubset)
- - {
- - morpher::add_isubset<I, S> tmp(image.exact(), fsubset.exact_());
- - return tmp;
- - }
- -
+# include "add_isubset.hxx"
# endif
- -} // end of namespace oln
- -
- -
- -#endif // ! OLN_MORPHER_ADD_ISUBSET
+#endif // ! OLN_MORPHER_ADD_ISUBSET_HH
Index: oln/morpher/value_cast.hh
===================================================================
- --- oln/morpher/value_cast.hh (revision 719)
+++ oln/morpher/value_cast.hh (working copy)
@@ -1,4 +1,4 @@
- -// Copyright (C) 2006 EPITA Research and Development Laboratory
+// Copyright (C) 2006, 2007 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
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
- -#ifndef OLN_MORPHER_VALUE_CAST
- -# define OLN_MORPHER_VALUE_CAST
+#ifndef OLN_MORPHER_VALUE_CAST_HH
+# define OLN_MORPHER_VALUE_CAST_HH
# include <xtd/abstract/open_nary_fun.hh>
# include <xtd/res.hh>
@@ -86,17 +86,6 @@
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
@@ -105,21 +94,11 @@
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
+# ifndef OLN_INCLUDE_ONLY
+# include "value_cast.hxx"
+# endif
- -#endif // ! OLN_MORPHER_VALUE_CAST
+#endif // ! OLN_MORPHER_VALUE_CAST_HH
Index: oln/morpher/add_neighborhood.hxx
===================================================================
- --- oln/morpher/add_neighborhood.hxx (revision 0)
+++ oln/morpher/add_neighborhood.hxx (revision 0)
@@ -0,0 +1,82 @@
+// Copyright (C) 2007 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_ADD_NEIGHBORHOOD_HXX
+# define OLN_MORPHER_ADD_NEIGHBORHOOD_HXX
+
+namespace oln
+{
+
+ namespace morpher
+ {
+
+ template <typename Image, typename Neighb>
+ add_neighborhood<Image, Neighb>::add_neighborhood(const Image& image, const Neighb& nbh) :
+ super_t(image),
+ topo_(image.topo(), nbh)
+ {
+ mlc::assert_equal_<oln_vtype(Image, grid), oln_vtype(Neighb, grid)>::check();
+ // FIXME: check that Image is without a nbh
+ }
+
+ template <typename Image, typename Neighb>
+ const typename add_neighborhood<Image, Neighb>::topo_t&
+ add_neighborhood<Image, Neighb>::impl_topo() const
+ {
+ return topo_;
+ }
+
+ } // end of namespace oln::morpher
+
+
+ template <typename I, typename N>
+ morpher::add_neighborhood<I, N>
+ operator + (const abstract::image<I>& image,
+ const abstract::neighborhood<N>& nbh)
+ {
+ mlc::assert_equal_<oln_vtype(I, grid), oln_vtype(N, grid)>::check();
+ // FIXME: check that Image is without a nbh
+ morpher::add_neighborhood<I, N> tmp(image.exact(), nbh.exact());
+ return tmp;
+ }
+
+} // end of namespace oln
+
+#endif // ! ADD_NEIGHBORHOOD_HXX
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: oln/morpher/two_way.hh
===================================================================
- --- oln/morpher/two_way.hh (revision 719)
+++ oln/morpher/two_way.hh (working copy)
@@ -109,56 +109,24 @@
} // end of namespace oln::morpher::ERROR
+ } // end of namespace oln::morpher
+
+} // end of namespace oln
+
# ifndef OLN_INCLUDE_ONLY
+# include "two_way.hxx"
+# endif
- - // public
+# include <oln/value/two_way.hxx>
+
+
+#endif // ! OLN_MORPHER_TWO_WAY_HH
- - template <typename Image, typename Fun>
- - two_way<Image, Fun>::two_way(Image& image) :
- - super_t(image),
- - fun_()
- - {
- - }
- -
- - template <typename Image, typename Fun>
- - two_way<Image, Fun>::two_way(Image& image, Fun fun) :
- - super_t(image),
- - fun_(fun)
- - {
- - }
- -
- - template <typename Image, typename Fun>
- - two_way<Image, Fun>::two_way(oln::abstract::mutable_image<Image>& image,
- - const oln::abstract::fun_v2w2v<Fun>& fun) :
- - super_t(image.exact()),
- - fun_(fun.exact())
- - {
- - }
- -
- - template <typename Image, typename Fun>
- - typename two_way<Image, Fun>::rvalue_t
- - two_way<Image, Fun>::impl_op_read(const typename two_way<Image, Fun>::psite_t& p) const
- - {
- - return fun_.direct(image_(p));
- - }
- -
- - template <typename Image, typename Fun>
- - typename two_way<Image, Fun>::lvalue_t
- - two_way<Image, Fun>::impl_op_readwrite(const typename two_way<Image, Fun>::psite_t& p)
- - {
- - value::two_way<Image, Fun> tmp(image_, fun_, p);
- - return tmp;
- - }
- -# endif
- - } // end of namespace oln::morpher
- -} // end of namespace oln
- -# include <oln/value/two_way.hxx>
- -#endif // ! OLN_MORPHER_TWO_WAY_HH
Index: oln/morpher/identity.hh
===================================================================
- --- oln/morpher/identity.hh (revision 719)
+++ oln/morpher/identity.hh (working copy)
@@ -1,4 +1,4 @@
- -// Copyright (C) 2006 EPITA Research and Development Laboratory
+// Copyright (C) 2006, 2007 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
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
- -#ifndef OLN_MORPHER_IDENTITY
- -# define OLN_MORPHER_IDENTITY
+#ifndef OLN_MORPHER_IDENTITY_HH
+# define OLN_MORPHER_IDENTITY_HH
# include <oln/morpher/internal/image_extension.hh>
@@ -82,4 +82,6 @@
} // end of namespace oln
- -#endif // ! OLN_MORPHER_IDENTITY
+#endif // ! OLN_MORPHER_IDENTITY_HH
+
+
Index: oln/morpher/thru_fun.hh
===================================================================
- --- oln/morpher/thru_fun.hh (revision 719)
+++ oln/morpher/thru_fun.hh (working copy)
@@ -1,4 +1,4 @@
- -// Copyright (C) 2006 EPITA Research and Development Laboratory
+// Copyright (C) 2006, 2007 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
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
- -#ifndef OLN_MORPHER_THRU_FUN
- -# define OLN_MORPHER_THRU_FUN
+#ifndef OLN_MORPHER_THRU_FUN_HH
+# define OLN_MORPHER_THRU_FUN_HH
# include <xtd/res.hh>
// For xtd::case_<xtd::tag::fun_operator_1, mlc::pair_<F, Expr>, 1>
@@ -149,4 +149,4 @@
- -#endif // ! OLN_MORPHER_THRU_FUN
+#endif // ! OLN_MORPHER_THRU_FUN_HH
Index: oln/morpher/value_cast.hxx
===================================================================
- --- oln/morpher/value_cast.hxx (revision 0)
+++ oln/morpher/value_cast.hxx (revision 0)
@@ -0,0 +1,68 @@
+// Copyright (C) 2007 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_HXX
+# define OLN_MORPHER_VALUE_CAST_HXX
+
+namespace oln
+{
+
+ namespace morpher
+ {
+
+ template <typename Image, typename Value>
+ value_cast<Image, Value>::value_cast(const Image& image) :
+ super_t(image)
+ {
+ }
+
+ } // end of namespace oln::morpher
+
+ 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;
+ }
+
+} // end of namespace oln
+
+#endif // ! OLN_MORPHER_VALUE_CAST_HXX
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: oln/morpher/add_isubset.hxx
===================================================================
- --- oln/morpher/add_isubset.hxx (revision 0)
+++ oln/morpher/add_isubset.hxx (revision 0)
@@ -0,0 +1,98 @@
+// Copyright (C) 2007 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_ADD_ISUBSET_HXX
+# define OLN_MORPHER_ADD_ISUBSET_HXX
+
+namespace oln
+{
+
+ namespace morpher
+ {
+
+ template <typename Image, typename Isubset>
+ add_isubset<Image, Isubset>::add_isubset(const Image& image, const Isubset& isubset) :
+ super_t(image),
+ topo_(image.topo(), isubset)
+ {
+ // mlc::assert_equal_<oln_vtype(Image, grid), oln_vtype(Isubset, grid)>::check();
+ // FIXME: check that Image is without a isubset
+ }
+
+ template <typename Image, typename Isubset>
+ const typename add_isubset<Image, Isubset>::topo_t&
+ add_isubset<Image, Isubset>::impl_topo() const
+ {
+ return topo_;
+ }
+
+ } // end of namespace oln::morpher
+
+
+ template <typename I, typename S>
+ morpher::add_isubset<I, S>
+ operator | (const abstract::image<I>& image,
+ const abstract::binary_image<S>& isubset)
+ {
+ mlc::assert_equal_<oln_vtype(I, grid), oln_vtype(S, grid)>::check();
+ // FIXME: check that Image does not have yet a subset
+ morpher::add_isubset<I, S> tmp(image.exact(), isubset.exact());
+ return tmp;
+ }
+
+ template <typename I, typename S>
+ morpher::add_isubset<I, S>
+ operator | (const abstract::image<I>& image,
+ const xtd::abstract::fun_nary_expr_<1,S>& fsubset)
+ {
+ morpher::add_isubset<I, S> tmp(image.exact(), fsubset.exact_());
+ return tmp;
+ }
+
+} // end of namespace oln
+
+
+#endif // ! OLN_MORPHER_ADD_ISUBSET_HXX
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: oln/morpher/with_lut.hh
===================================================================
- --- oln/morpher/with_lut.hh (revision 719)
+++ oln/morpher/with_lut.hh (working copy)
@@ -1,4 +1,4 @@
- -// Copyright (C) 2006 EPITA Research and Development Laboratory
+// Copyright (C) 2006, 2007 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
@@ -122,50 +122,6 @@
lut_type lut_;
};
- -
- -# ifndef OLN_INCLUDE_ONLY
- -
- - template <typename Image, typename Lut>
- - with_lut<Image, Lut>::with_lut(const Image& image, const Lut& lut) :
- - super_t(image),
- - lut_(lut)
- - {
- - mlc::assert_equal_< oln_value(Image), typename Lut::orig_value_type >::check();
- - }
- -
- - template <typename Image, typename Lut>
- - typename with_lut<Image, Lut>::rvalue_type
- - with_lut<Image, Lut>::impl_op_read(const typename with_lut<Image, Lut>::psite_type& p) const
- - {
- - // FIXME: What if lut_ has no value for `this->image_(p)'? At
- - // least, document the behavior of this method (will it abort,
- - // does the LUT have to provide a default value, etc.)
- - return lut_(this->image_(p));
- - }
- -
- - template <typename Image, typename Lut>
- - typename with_lut<Image, Lut>::value_proxy_type
- - with_lut<Image, Lut>::impl_value(const value_type& v) const
- - {
- - return value_proxy_type(lut_, v);
- - }
- -
- - template <typename Image, typename Lut>
- - typename with_lut<Image, Lut>::mutable_value_proxy_type
- - with_lut<Image, Lut>::impl_value(const value_type& v)
- - {
- - return mutable_value_proxy_type(lut_, v);
- - }
- -
- - template <typename Image, typename Lut>
- - const typename with_lut<Image, Lut>::lut_type&
- - with_lut<Image, Lut>::lut() const
- - {
- - return lut_;
- - }
- -
- -# endif
- -
} // end of namespace oln::morpher
@@ -176,23 +132,11 @@
operator + (const abstract::image<I>& image,
lookup_table<K, D>& lut);
+} // end of namespace oln
- -# ifndef OLN_INCLUDE_ONLY
- -
- - template <typename I, typename K, typename D>
- - morpher::with_lut< I, lookup_table<K, D> >
- - operator + (const abstract::image<I>& image,
- - lookup_table<K, D>& lut)
- - {
- - typedef lookup_table<K, D> lut_type;
- - mlc::assert_equal_< oln_value(I), typename lut_type::orig_value_type >::check();
- - morpher::with_lut<I, lut_type> tmp(image.exact(), lut);
- - return tmp;
- - }
+# ifndef OLN_INCLUDE_ONLY
+# include "with_lut.hxx"
# endif
- -} // end of namespace oln
- -
- -
#endif // ! OLN_MORPHER_WITH_LUT_HH
Index: oln/morpher/count_rw.hh
===================================================================
- --- oln/morpher/count_rw.hh (revision 719)
+++ oln/morpher/count_rw.hh (working copy)
@@ -1,4 +1,4 @@
- -// Copyright (C) 2006 EPITA Research and Development Laboratory
+// Copyright (C) 2006, 2007 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
@@ -99,41 +99,6 @@
} // end of namespace oln::morpher::ERROR
- -
- -# ifndef OLN_INCLUDE_ONLY
- -
- - // public
- -
- - template <typename Image>
- - count_rw_<Image>::count_rw_(Image& image) :
- - super_t(image)
- - {
- - }
- -
- - template <typename Image>
- - count_rw_<Image>::count_rw_(oln::abstract::mutable_image<Image>& image) :
- - super_t(image.exact())
- - {
- - }
- -
- - template <typename Image>
- - oln_rvalue(count_rw_<Image>)
- - count_rw_<Image>::impl_op_read(const oln_psite(count_rw_<Image>)& p) const
- - {
- - value::ro_counter<Image> tmp(image_, p);
- - return tmp;
- - }
- -
- - template <typename Image>
- - oln_lvalue(count_rw_<Image>)
- - count_rw_<Image>::impl_op_readwrite(const oln_psite(count_rw_<Image>)& p)
- - {
- - value::rw_counter<Image> tmp(image_, p);
- - return tmp;
- - }
- -
- -# endif
- -
} // end of namespace oln::morpher
@@ -145,31 +110,10 @@
morpher::count_rw_<I>
count_rw(const oln::abstract::mutable_image<I>& input);
+} // end of namespace oln
# ifndef OLN_INCLUDE_ONLY
- -
- - template <typename I>
- - morpher::count_rw_<I>
- - count_rw(oln::abstract::mutable_image<I>& input)
- - {
- - morpher::count_rw_<I> tmp(input.exact());
- - return tmp;
- - }
- -
- - template <typename I>
- - morpher::count_rw_<I>
- - count_rw(const oln::abstract::mutable_image<I>& input)
- - {
- - // FIXME: Hack.
- - I& input_ = const_cast<I&>(input.exact());
- - morpher::count_rw_<I> tmp(input_);
- - return tmp;
- - }
- -
+# include "count_rw.hxx"
# endif
- -
- -} // end of namespace oln
- -
- -
#endif // ! OLN_MORPHER_COUNT_RW_HH
Index: oln/morpher/two_way_rw.hh
===================================================================
- --- oln/morpher/two_way_rw.hh (revision 719)
+++ oln/morpher/two_way_rw.hh (working copy)
@@ -1,4 +1,4 @@
- -// Copyright (C) 2006 EPITA Research and Development Laboratory
+// Copyright (C) 2006, 2007 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
@@ -108,47 +108,13 @@
} // end of namespace oln::morpher::ERROR
- -
- -# ifndef OLN_INCLUDE_ONLY
- -
- - // public
- -
- - template <typename Image, typename Fun>
- - two_way_rw<Image, Fun>::two_way_rw(oln::abstract::mutable_image<Image>& image) :
- - super_t(image.exact()),
- - fun_()
- - {
- - }
- -
- - template <typename Image, typename Fun>
- - two_way_rw<Image, Fun>::two_way_rw(oln::abstract::mutable_image<Image>& image,
- - const oln::abstract::fun_rw<Fun>& fun) :
- - super_t(image.exact()),
- - fun_(fun.exact())
- - {
- - }
- -
- - template <typename Image, typename Fun>
- - typename two_way_rw<Image, Fun>::rvalue_t
- - two_way_rw<Image, Fun>::impl_op_read(const typename two_way_rw<Image, Fun>::psite_t& p) const
- - {
- - return fun_.read(this->delegate(), p);
- - }
- -
- - template <typename Image, typename Fun>
- - typename two_way_rw<Image, Fun>::lvalue_t
- - two_way_rw<Image, Fun>::impl_op_readwrite(const typename two_way_rw<Image, Fun>::psite_t& p)
- - {
- - typename two_way_rw<Image, Fun>::lvalue_t tmp(this->delegate(), p);
- - return tmp;
- - }
- -
- -# endif
- -
} // end of namespace oln::morpher
} // end of namespace oln
+# ifndef OLN_INCLUDE_ONLY
+# include "two_way_rw.hxx"
+# endif
# include <oln/value/two_way.hxx>
Index: oln/morpher/identity.hxx
===================================================================
- --- oln/morpher/identity.hxx (revision 0)
+++ oln/morpher/identity.hxx (revision 0)
@@ -0,0 +1,55 @@
+// Copyright (C) 2007 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_IDENTITY_HXX
+# define OLN_MORPHER_IDENTITY_HXX
+
+namespace oln
+{
+
+ namespace morpher
+ {
+
+ template <typename Image>
+ identity<Image>::identity(const Image& image) :
+ super_t(image)
+ {
+ }
+
+ } // end of namespace oln::morpher
+
+} // end of namespace oln
+
+
+# endif // ! OLN_MORPHER_IDENTITY_HXX
+
+
+
+
+
+
+
Index: oln/morpher/two_way.hxx
===================================================================
- --- oln/morpher/two_way.hxx (revision 0)
+++ oln/morpher/two_way.hxx (revision 0)
@@ -0,0 +1,80 @@
+// Copyright (C) 2007 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_TWO_WAY_HXX
+# define OLN_MORPHER_TWO_WAY_HXX
+
+namespace oln
+{
+
+ namespace morpher
+ {
+
+ // public
+
+ template <typename Image, typename Fun>
+ two_way<Image, Fun>::two_way(Image& image) :
+ super_t(image),
+ fun_()
+ {
+ }
+
+ template <typename Image, typename Fun>
+ two_way<Image, Fun>::two_way(Image& image, Fun fun) :
+ super_t(image),
+ fun_(fun)
+ {
+ }
+
+ template <typename Image, typename Fun>
+ two_way<Image, Fun>::two_way(oln::abstract::mutable_image<Image>& image,
+ const oln::abstract::fun_v2w2v<Fun>& fun) :
+ super_t(image.exact()),
+ fun_(fun.exact())
+ {
+ }
+
+ template <typename Image, typename Fun>
+ typename two_way<Image, Fun>::rvalue_t
+ two_way<Image, Fun>::impl_op_read(const typename two_way<Image, Fun>::psite_t& p) const
+ {
+ return fun_.direct(image_(p));
+ }
+
+ template <typename Image, typename Fun>
+ typename two_way<Image, Fun>::lvalue_t
+ two_way<Image, Fun>::impl_op_readwrite(const typename two_way<Image, Fun>::psite_t& p)
+ {
+ value::two_way<Image, Fun> tmp(image_, fun_, p);
+ return tmp;
+ }
+
+ } // end of namespace oln::morpher
+
+} // end of namespace oln
+
+#endif // ! OLN_MORPHER_TWO_WAY_HXX
Index: oln/morpher/stack.hh
===================================================================
- --- oln/morpher/stack.hh (revision 719)
+++ oln/morpher/stack.hh (working copy)
@@ -1,4 +1,4 @@
- -// Copyright (C) 2006 EPITA Research and Development Laboratory
+// Copyright (C) 2006, 2007 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
@@ -90,36 +90,6 @@
xtd::vec<n, I> images_;
};
- -
- -# ifndef OLN_INCLUDE_ONLY
- -
- - template <unsigned n, typename I>
- - stack<n, I>::stack(const xtd::vec<n, I>& images) :
- - super_t(images[0]),
- - images_(images)
- - {
- - }
- -
- - template <unsigned n, typename I>
- - xtd::vec<n, oln_value(I)>
- - stack<n, I>::impl_op_read(const typename stack<n, I>::psite_t& p) const
- - {
- - xtd::vec<n, oln_value(I)> tmp;
- - for (unsigned i = 0; i < n; ++i)
- - tmp[i] = images_[i](p);
- - return tmp;
- - }
- -
- - template <unsigned n, typename I>
- - const I&
- - stack<n, I>::image(unsigned i) const
- - {
- - precondition(i < n);
- - return images_[i];
- - }
- -
- -# endif
- -
} // end of namespace oln::morpher
@@ -141,49 +111,10 @@
const abstract::image<I>& image_2,
const abstract::image<I>& image_3);
+} // end of namespace oln
# ifndef OLN_INCLUDE_ONLY
- -
- -
- - template <typename I>
- - morpher::stack<2, I>
- - stack(const abstract::image<I>& image_0,
- - const abstract::image<I>& image_1)
- - {
- - morpher::stack<2, I> tmp(xtd::mk_vec(image_0.exact(),
- - image_1.exact()));
- - return tmp;
- - }
- -
- - template <typename I>
- - morpher::stack<3, I>
- - stack(const abstract::image<I>& image_0,
- - const abstract::image<I>& image_1,
- - const abstract::image<I>& image_2)
- - {
- - morpher::stack<3, I> tmp(xtd::mk_vec(image_0.exact(),
- - image_1.exact(),
- - image_2.exact()));
- - return tmp;
- - }
- -
- - template <typename I>
- - morpher::stack<4, I>
- - stack(const abstract::image<I>& image_0,
- - const abstract::image<I>& image_1,
- - const abstract::image<I>& image_2,
- - const abstract::image<I>& image_3)
- - {
- - morpher::stack<4, I> tmp(xtd::mk_vec(image_0.exact(),
- - image_1.exact(),
- - image_2.exact(),
- - image_3.exact()));
- - return tmp;
- - }
- -
+# include "stack.hxx"
# endif
- -} // end of namespace oln
- -
- -
#endif // ! OLN_MORPHER_STACK_HH
Index: oln/morpher/thru_mfun.hh
===================================================================
- --- oln/morpher/thru_mfun.hh (revision 719)
+++ oln/morpher/thru_mfun.hh (working copy)
@@ -1,4 +1,4 @@
- -// Copyright (C) 2006 EPITA Research and Development Laboratory
+// Copyright (C) 2006, 2007 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
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
- -#ifndef OLN_MORPHER_THRU_MFUN
- -# define OLN_MORPHER_THRU_MFUN
+#ifndef OLN_MORPHER_THRU_MFUN_HH
+# define OLN_MORPHER_THRU_MFUN_HH
# include <xtd/res.hh>
# include <xtd/abstract/open_nary_fun.hh>
@@ -107,35 +107,8 @@
} // end of namespace oln::morpher::ERROR
- -
- -# ifndef OLN_INCLUDE_ONLY
- -
- - template <typename Image, typename Fun>
- - thru_mfun<Image, Fun>::thru_mfun(const Image& image, const Fun& fun) :
- - super_t(image),
- - fun_(fun)
- - {
- - }
- -
- - template <typename Image, typename Fun>
- - typename thru_mfun<Image, Fun>::rvalue_t
- - thru_mfun<Image, Fun>::impl_op_read(const typename thru_mfun<Image, Fun>::psite_t& p) const
- - {
- - return fun_(this->image_(p));
- - }
- -
- - template <typename Image, typename Fun>
- - typename thru_mfun<Image, Fun>::lvalue_t
- - thru_mfun<Image, Fun>::impl_op_readwrite(const typename thru_mfun<Image, Fun>::psite_t& p)
- - {
- - return fun_(this->image_(p));
- - }
- -
- -# endif
- -
} // end of namespace oln::morpher
- -
} // end of namespace oln
@@ -177,5 +150,9 @@
} // end of namespace xtd
+# ifndef OLN_INCLUDE_ONLY
+# include "thru_mfun.hxx"
+# endif
+
+#endif // ! OLN_MORPHER_THRU_MFUN_HH
- -#endif // ! OLN_MORPHER_THRU_MFUN
Index: oln/morpher/with_lut.hxx
===================================================================
- --- oln/morpher/with_lut.hxx (revision 0)
+++ oln/morpher/with_lut.hxx (revision 0)
@@ -0,0 +1,91 @@
+// Copyright (C) 2007 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_WITH_LUT_HXX
+# define OLN_MORPHER_WITH_LUT_HXX
+
+namespace oln
+{
+
+ namespace morpher
+ {
+
+ template <typename Image, typename Lut>
+ with_lut<Image, Lut>::with_lut(const Image& image, const Lut& lut) :
+ super_t(image),
+ lut_(lut)
+ {
+ mlc::assert_equal_< oln_value(Image), typename Lut::orig_value_type >::check();
+ }
+
+ template <typename Image, typename Lut>
+ typename with_lut<Image, Lut>::rvalue_type
+ with_lut<Image, Lut>::impl_op_read(const typename with_lut<Image, Lut>::psite_type& p) const
+ {
+ // FIXME: What if lut_ has no value for `this->image_(p)'? At
+ // least, document the behavior of this method (will it abort,
+ // does the LUT have to provide a default value, etc.)
+ return lut_(this->image_(p));
+ }
+
+ template <typename Image, typename Lut>
+ typename with_lut<Image, Lut>::value_proxy_type
+ with_lut<Image, Lut>::impl_value(const value_type& v) const
+ {
+ return value_proxy_type(lut_, v);
+ }
+
+ template <typename Image, typename Lut>
+ typename with_lut<Image, Lut>::mutable_value_proxy_type
+ with_lut<Image, Lut>::impl_value(const value_type& v)
+ {
+ return mutable_value_proxy_type(lut_, v);
+ }
+
+ template <typename Image, typename Lut>
+ const typename with_lut<Image, Lut>::lut_type&
+ with_lut<Image, Lut>::lut() const
+ {
+ return lut_;
+ }
+
+ } // end of namespace oln::morpher
+
+ template <typename I, typename K, typename D>
+ morpher::with_lut< I, lookup_table<K, D> >
+ operator + (const abstract::image<I>& image,
+ lookup_table<K, D>& lut)
+ {
+ typedef lookup_table<K, D> lut_type;
+ mlc::assert_equal_< oln_value(I), typename lut_type::orig_value_type >::check();
+ morpher::with_lut<I, lut_type> tmp(image.exact(), lut);
+ return tmp;
+ }
+
+} // end of namespace oln
+
+#endif // ! OLN_MORPHER_WITH_LUT_HXX
Index: oln/morpher/count_rw.hxx
===================================================================
- --- oln/morpher/count_rw.hxx (revision 0)
+++ oln/morpher/count_rw.hxx (revision 0)
@@ -0,0 +1,105 @@
+// Copyright (C) 2007 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_COUNT_RW_HXX
+# define OLN_MORPHER_COUNT_RW_HXX
+
+namespace oln
+{
+
+ namespace morpher
+ {
+ // public
+
+ template <typename Image>
+ count_rw_<Image>::count_rw_(Image& image) :
+ super_t(image)
+ {
+ }
+
+ template <typename Image>
+ count_rw_<Image>::count_rw_(oln::abstract::mutable_image<Image>& image) :
+ super_t(image.exact())
+ {
+ }
+
+ template <typename Image>
+ oln_rvalue(count_rw_<Image>)
+ count_rw_<Image>::impl_op_read(const oln_psite(count_rw_<Image>)& p) const
+ {
+ value::ro_counter<Image> tmp(image_, p);
+ return tmp;
+ }
+
+ template <typename Image>
+ oln_lvalue(count_rw_<Image>)
+ count_rw_<Image>::impl_op_readwrite(const oln_psite(count_rw_<Image>)& p)
+ {
+ value::rw_counter<Image> tmp(image_, p);
+ return tmp;
+ }
+
+ } // end of namespace oln::morpher
+
+
+ template <typename I>
+ morpher::count_rw_<I>
+ count_rw(oln::abstract::mutable_image<I>& input)
+ {
+ morpher::count_rw_<I> tmp(input.exact());
+ return tmp;
+ }
+
+ template <typename I>
+ morpher::count_rw_<I>
+ count_rw(const oln::abstract::mutable_image<I>& input)
+ {
+ // FIXME: Hack.
+ I& input_ = const_cast<I&>(input.exact());
+ morpher::count_rw_<I> tmp(input_);
+ return tmp;
+ }
+
+} // end of namespace oln
+
+#endif // ! OLN_MORPHER_COUNT_RW_HH
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: oln/morpher/two_way_rw.hxx
===================================================================
- --- oln/morpher/two_way_rw.hxx (revision 0)
+++ oln/morpher/two_way_rw.hxx (revision 0)
@@ -0,0 +1,79 @@
+// Copyright (C) 2007 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_TWO_WAY_RW_HXX
+# define OLN_MORPHER_TWO_WAY_RW_HXX
+
+namespace oln
+{
+
+ namespace morpher
+ {
+ // public
+
+ template <typename Image, typename Fun>
+ two_way_rw<Image, Fun>::two_way_rw(oln::abstract::mutable_image<Image>& image) :
+ super_t(image.exact()),
+ fun_()
+ {
+ }
+
+ template <typename Image, typename Fun>
+ two_way_rw<Image, Fun>::two_way_rw(oln::abstract::mutable_image<Image>& image,
+ const oln::abstract::fun_rw<Fun>& fun) :
+ super_t(image.exact()),
+ fun_(fun.exact())
+ {
+ }
+
+ template <typename Image, typename Fun>
+ typename two_way_rw<Image, Fun>::rvalue_t
+ two_way_rw<Image, Fun>::impl_op_read(const typename two_way_rw<Image, Fun>::psite_t& p) const
+ {
+ return fun_.read(this->delegate(), p);
+ }
+
+ template <typename Image, typename Fun>
+ typename two_way_rw<Image, Fun>::lvalue_t
+ two_way_rw<Image, Fun>::impl_op_readwrite(const typename two_way_rw<Image, Fun>::psite_t& p)
+ {
+ typename two_way_rw<Image, Fun>::lvalue_t tmp(this->delegate(), p);
+ return tmp;
+ }
+
+ } // end of namespace oln::morpher
+
+} // end of namespace oln
+
+#endif // ! OLN_MORPHER_TWO_WAY_RW_HXX
+
+
+
+
+
+
+
Index: oln/morpher/stack_rw.hh
===================================================================
- --- oln/morpher/stack_rw.hh (revision 719)
+++ oln/morpher/stack_rw.hh (working copy)
@@ -1,4 +1,4 @@
- -// Copyright (C) 2006 EPITA Research and Development Laboratory
+// Copyright (C) 2006, 2007 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
@@ -120,52 +120,6 @@
xtd::vec<n, I> images_;
};
- -
- -# ifndef OLN_INCLUDE_ONLY
- -
- - template <unsigned n, typename I>
- - stack_rw<n, I>::stack_rw(const xtd::vec<n, I>& images) :
- - super_t(images[0]),
- - images_(images)
- - {
- - }
- -
- - template <unsigned n, typename I>
- - xtd::vec<n, oln_value(I)>
- - stack_rw<n, I>::impl_op_read(const typename stack_rw<n, I>::psite_t& p) const
- - {
- - xtd::vec<n, oln_value(I)> tmp;
- - for (unsigned i = 0; i < n; ++i)
- - tmp[i] = images_[i](p);
- - return tmp;
- - }
- -
- - template <unsigned n, typename I>
- - typename stack_rw<n, I>::lvalue_t
- - stack_rw<n, I>::impl_op_readwrite(const typename stack_rw<n, I>::psite_t& p)
- - {
- - lvalue_t tmp(*this, p);
- - return tmp;
- - }
- -
- - template <unsigned n, typename I>
- - const I&
- - stack_rw<n, I>::image(unsigned i) const
- - {
- - precondition(i < n);
- - return images_[i];
- - }
- -
- - template <unsigned n, typename I>
- - I&
- - stack_rw<n, I>::image(unsigned i)
- - {
- - precondition(i < n);
- - return images_[i];
- - }
- -
- -# endif
- -
} // end of namespace oln::morpher
@@ -187,52 +141,18 @@
abstract::mutable_image<I>& image_2,
abstract::mutable_image<I>& image_3);
+} // end of namespace oln
# ifndef OLN_INCLUDE_ONLY
+# include "stack_rw.hxx"
+# endif
+# include <oln/value/two_way.hxx>
- - template <typename I>
- - morpher::stack_rw<2, I>
- - stack_rw(abstract::mutable_image<I>& image_0,
- - abstract::mutable_image<I>& image_1)
- - {
- - morpher::stack_rw<2, I> tmp(xtd::mk_vec(image_0.exact(),
- - image_1.exact()));
- - return tmp;
- - }
- -
- - template <typename I>
- - morpher::stack_rw<3, I>
- - stack_rw(abstract::mutable_image<I>& image_0,
- - abstract::mutable_image<I>& image_1,
- - abstract::mutable_image<I>& image_2)
- - {
- - morpher::stack_rw<3, I> tmp(xtd::mk_vec(image_0.exact(),
- - image_1.exact(),
- - image_2.exact()));
- - return tmp;
- - }
- -
- - template <typename I>
- - morpher::stack_rw<4, I>
- - stack_rw(abstract::mutable_image<I>& image_0,
- - abstract::mutable_image<I>& image_1,
- - abstract::mutable_image<I>& image_2,
- - abstract::mutable_image<I>& image_3)
- - {
- - morpher::stack_rw<4, I> tmp(xtd::mk_vec(image_0.exact(),
- - image_1.exact(),
- - image_2.exact(),
- - image_3.exact()));
- - return tmp;
- - }
- -# endif
+#endif // ! OLN_MORPHER_STACK_RW_HH
- -} // end of namespace oln
- -# include <oln/value/two_way.hxx>
- -#endif // ! OLN_MORPHER_STACK_RW_HH
Index: oln/morpher/stack.hxx
===================================================================
- --- oln/morpher/stack.hxx (revision 0)
+++ oln/morpher/stack.hxx (revision 0)
@@ -0,0 +1,121 @@
+// Copyright (C) 2007 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_STACK_HXX
+# define OLN_MORPHER_STACK_HXX
+
+namespace oln
+{
+
+ namespace morpher
+ {
+
+ template <unsigned n, typename I>
+ stack<n, I>::stack(const xtd::vec<n, I>& images) :
+ super_t(images[0]),
+ images_(images)
+ {
+ }
+
+ template <unsigned n, typename I>
+ xtd::vec<n, oln_value(I)>
+ stack<n, I>::impl_op_read(const typename stack<n, I>::psite_t& p) const
+ {
+ xtd::vec<n, oln_value(I)> tmp;
+ for (unsigned i = 0; i < n; ++i)
+ tmp[i] = images_[i](p);
+ return tmp;
+ }
+
+ template <unsigned n, typename I>
+ const I&
+ stack<n, I>::image(unsigned i) const
+ {
+ precondition(i < n);
+ return images_[i];
+ }
+
+ } // end of namespace oln::morpher
+
+
+ template <typename I>
+ morpher::stack<2, I>
+ stack(const abstract::image<I>& image_0,
+ const abstract::image<I>& image_1)
+ {
+ morpher::stack<2, I> tmp(xtd::mk_vec(image_0.exact(),
+ image_1.exact()));
+ return tmp;
+ }
+
+ template <typename I>
+ morpher::stack<3, I>
+ stack(const abstract::image<I>& image_0,
+ const abstract::image<I>& image_1,
+ const abstract::image<I>& image_2)
+ {
+ morpher::stack<3, I> tmp(xtd::mk_vec(image_0.exact(),
+ image_1.exact(),
+ image_2.exact()));
+ return tmp;
+ }
+
+ template <typename I>
+ morpher::stack<4, I>
+ stack(const abstract::image<I>& image_0,
+ const abstract::image<I>& image_1,
+ const abstract::image<I>& image_2,
+ const abstract::image<I>& image_3)
+ {
+ morpher::stack<4, I> tmp(xtd::mk_vec(image_0.exact(),
+ image_1.exact(),
+ image_2.exact(),
+ image_3.exact()));
+ return tmp;
+ }
+
+
+} // end of namespace oln
+
+#endif // ! OLN_MORPHER_STACK_HXX
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: oln/morpher/add_neighborhood.hh
===================================================================
- --- oln/morpher/add_neighborhood.hh (revision 719)
+++ oln/morpher/add_neighborhood.hh (working copy)
@@ -1,4 +1,4 @@
- -// Copyright (C) 2006 EPITA Research and Development Laboratory
+// Copyright (C) 2006, 2007 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
@@ -95,27 +95,6 @@
topo_t topo_;
};
- -
- -# ifndef OLN_INCLUDE_ONLY
- -
- - template <typename Image, typename Neighb>
- - add_neighborhood<Image, Neighb>::add_neighborhood(const Image& image, const Neighb& nbh) :
- - super_t(image),
- - topo_(image.topo(), nbh)
- - {
- - mlc::assert_equal_<oln_vtype(Image, grid), oln_vtype(Neighb, grid)>::check();
- - // FIXME: check that Image is without a nbh
- - }
- -
- - template <typename Image, typename Neighb>
- - const typename add_neighborhood<Image, Neighb>::topo_t&
- - add_neighborhood<Image, Neighb>::impl_topo() const
- - {
- - return topo_;
- - }
- -
- -# endif
- -
} // end of namespace oln::morpher
@@ -124,23 +103,10 @@
morpher::add_neighborhood<I, N>
operator + (const abstract::image<I>& image, const abstract::neighborhood<N>& nbh);
+} // end of namespace oln
# ifndef OLN_INCLUDE_ONLY
- -
- - template <typename I, typename N>
- - morpher::add_neighborhood<I, N>
- - operator + (const abstract::image<I>& image,
- - const abstract::neighborhood<N>& nbh)
- - {
- - mlc::assert_equal_<oln_vtype(I, grid), oln_vtype(N, grid)>::check();
- - // FIXME: check that Image is without a nbh
- - morpher::add_neighborhood<I, N> tmp(image.exact(), nbh.exact());
- - return tmp;
- - }
- -
+# include "add_neighborhood.hxx"
# endif
- -} // end of namespace oln
- -
- -
#endif // ! OLN_MORPHER_ADD_NEIGHBORHOOD_HH
Index: oln/morpher/thru_mfun.hxx
===================================================================
- --- oln/morpher/thru_mfun.hxx (revision 0)
+++ oln/morpher/thru_mfun.hxx (revision 0)
@@ -0,0 +1,64 @@
+// Copyright (C) 2007 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_THRU_MFUN_HXX
+# define OLN_MORPHER_THRU_MFUN_HXX
+
+namespace oln
+{
+
+ template <typename Image, typename Fun>
+ thru_mfun<Image, Fun>::thru_mfun(const Image& image, const Fun& fun) :
+ super_t(image),
+ fun_(fun)
+ {
+ }
+
+ template <typename Image, typename Fun>
+ typename thru_mfun<Image, Fun>::rvalue_t
+ thru_mfun<Image, Fun>::impl_op_read(const typename thru_mfun<Image, Fun>::psite_t& p) const
+ {
+ return fun_(this->image_(p));
+ }
+
+ template <typename Image, typename Fun>
+ typename thru_mfun<Image, Fun>::lvalue_t
+ thru_mfun<Image, Fun>::impl_op_readwrite(const typename thru_mfun<Image, Fun>::psite_t& p)
+ {
+ return fun_(this->image_(p));
+ }
+
+} // end of namespace oln
+
+#endif // ! OLN_MORPHER_THRU_MFUN_HXX
+
+
+
+
+
+
+
- --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFFsPgX8QvmnUS5oeMRAmnZAJ98z1U0wa1aaIrCpzYqTlE1R4qW1wCgjCrC
7+Mj9v9MonIXqSS1lLptrYA=
=TXwv
-----END PGP SIGNATURE-----
1
0