LRE
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
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
List overview
Download
Olena-patches
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
olena-patches@lrde.epita.fr
9625 discussions
Start a n
N
ew thread
714: Propagate scoop update to oln.
by Thierry GERAUD
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_vtype_, oln_vtype, oln_deduce_vtype): ...these. (oln_deferred_vtype, oln_deduce_deferred_vtype): New. (oln_find_vtype, oln_find_deferred_vtype): New. * tests/morphers/add_neighborhood_morpher.cc: Update. * tests/morphers/morphers.cc: Likewise. * tests/core/image_entry.cc: Likewise. * tests/core/grid.cc: Likewise. * tests/core/image1d.cc: Likewise. * tests/core/image2d.cc: Likewise. * tests/core/image3d.cc: Likewise. * tests/core/npoints.cc: Likewise. * oln/debug/print.hh: Likewise. * 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_having_neighborhood.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/spe/row.hh: Likewise. * oln/core/spe/col.hh: Likewise. * oln/core/spe/slice.hh: Likewise. * oln/core/iterator_vtypes.hh: Likewise. * oln/core/abstract/iterator_on_points.hh: Likewise. * oln/core/abstract/image/hybrid/classical.hh: Likewise. * oln/core/abstract/image/type/integre.hh: Likewise. * oln/core/abstract/image/type/hierarchy.hh: Likewise. * oln/core/abstract/image/computability/hierarchy.hh: Likewise. * oln/core/abstract/image/dimension/1d.hh: Likewise. * oln/core/abstract/image/dimension/2d.hh: Likewise. * oln/core/abstract/image/dimension/3d.hh: Likewise. * oln/core/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_having_subset.hh: Likewise. * oln/core/abstract/topology/topology_having_neighborhood.hh: Likewise. * oln/core/abstract/internal/image_impl.hh: Likewise. * oln/core/gen/piter_isubset.hh: Likewise. * oln/core/gen/topo_add_isubset.hh: Likewise. * oln/core/gen/bbox.hh: Likewise. * oln/core/gen/topo_bbox.hh: Likewise. * oln/core/gen/neighb.hh: Likewise. * oln/core/gen/bkd_viter_lut.hh: Likewise. * oln/core/gen/pset_list.hh: Likewise. * oln/core/gen/window.hh: Likewise. * oln/core/gen/topo_lbbox.hh: Likewise. * oln/core/gen/pset_vec.hh: Likewise. * oln/core/gen/pset_.hh: Likewise. * oln/core/gen/fwd_viter_lut.hh: Likewise. * oln/core/gen/mapimage.hh: Likewise. * oln/core/gen/topo_add_nbh.hh: Likewise. * oln/core/internal/topology_morpher.hh: Likewise. * oln/core/internal/point_nd.hh: Likewise. * oln/core/internal/bbox_bkd_piter.hh: Likewise. * oln/core/internal/bbox_fwd_piter.hh: Likewise. * oln/core/internal/dpoint_nd.hh: Likewise. * oln/morpher/add_isubset.hh: Likewise. * oln/morpher/value_cast.hh: Likewise. * oln/morpher/thru_fun.hh: Likewise. * oln/morpher/slice.hh: Likewise. * oln/morpher/with_lut.hh: Likewise. * oln/morpher/thru_mfun.hh: Likewise. * oln/morpher/internal/image_value_morpher.hh: Likewise. * oln/morpher/internal/image_extension.hh: Likewise. * oln/morpher/add_neighborhood.hh: Likewise. Entry classes now use: - 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. * oln/core/neighborhood_entry.hh: Likewise. * oln/core/topology_entry.hh: Likewise. * oln/core/image_entry.hh: Likewise. * oln/core/abstract/grid.hh: Likewise. * oln/core/abstract/image.hh: Likewise. (decl): Re-activate static checks. * oln/core/abstract/iterator.hh: Likewise. * oln/core/abstract/point.hh: Likewise. * oln/core/abstract/dpoint.hh: Likewise. * oln/core/abstract/iterator_on_values.hh: Likewise. * 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. Update from 'delegated' to 'delegatee'. * oln/core/abstract/internal/image_impl.hh: Update. * oln/core/gen/topo_add_nbh.hh: Likewise. * oln/core/internal/topology_morpher.hh: Likewise. * oln/morpher/internal/image_value_morpher.hh: Likewise. * oln/morpher/internal/image_extension.hh: Likewise. * 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. * oln/core/gen/pset_vec.hh: Likewise. * oln/core/gen/pset_.hh: Likewise. * tests/core/image_entry.cc (is_computed_type): Fix missing. Index: tests/morphers/add_neighborhood_morpher.cc =================================================================== --- tests/morphers/add_neighborhood_morpher.cc (revision 712) +++ tests/morphers/add_neighborhood_morpher.cc (working copy) @@ -61,11 +61,11 @@ // same interfaces as the underlying morphed image. mlc::assert_< mlc_is_a_(image_with_nbh_t, oln::abstract::image2d) >::check(); // Check the type of neighborhood. - mlc::assert_< mlc_eq(oln_type_of_(image_with_nbh_t, neighborhood), + mlc::assert_< mlc_eq(oln_vtype_(image_with_nbh_t, neighborhood), oln::neighb2d) >::check(); // Instantiate a neighborhood for this image type. - oln_type_of_(image_with_nbh_t, neighborhood) nbh; + oln_vtype_(image_with_nbh_t, neighborhood) nbh; // Instantiate an object, and check its methods. image_with_nbh_t ima_with_nbh(ima, nbh); oln::neighb2d nbh2 = ima_with_nbh.neighborhood(); Index: tests/morphers/morphers.cc =================================================================== --- tests/morphers/morphers.cc (revision 712) +++ tests/morphers/morphers.cc (working copy) @@ -65,11 +65,11 @@ mlc::assert_< mlc_is_a_(image_with_nbh_t, oln::abstract::image_having_neighborhood) >::check(); // Check the type of neighborhood. - mlc::assert_< mlc_eq(oln_type_of_(image_with_nbh_t, neighborhood), + mlc::assert_< mlc_eq(oln_vtype_(image_with_nbh_t, neighborhood), oln::neighb2d) >::check(); // Instantiate a neighborhood for this image type. - oln_type_of_(image_with_nbh_t, neighborhood) nbh; + oln_vtype_(image_with_nbh_t, neighborhood) nbh; // Instantiate an object, and check its methods. image_with_nbh_t ima_with_nbh(ima, nbh); oln::neighb2d nbh2 = ima_with_nbh.neighborhood(); @@ -88,7 +88,7 @@ mlc::assert_< mlc_is_a_(image_with_nbh_id_t, oln::abstract::image_having_neighborhood) >::check(); // Check the type of neighborhood. - mlc::assert_< mlc_eq(oln_type_of_(image_with_nbh_id_t, neighborhood), + mlc::assert_< mlc_eq(oln_vtype_(image_with_nbh_id_t, neighborhood), oln::neighb2d) >::check(); // Instantiate an object, and check its methods. Index: tests/core/image_entry.cc =================================================================== --- tests/core/image_entry.cc (revision 712) +++ tests/core/image_entry.cc (working copy) @@ -57,21 +57,20 @@ template<> struct vtypes<my::image> { - // The switch for image_dimension (above image_entry) plugs the - // inheritance relation to the right abstract::image_dimension - // class using the sole grid information (the grid can be seen - // here as a ``tag''). - typedef oln::grid2d grid_type; - // Likewise, for the switch of image_typeness using the type of // the value of the image. typedef char value_type; + // The switch for image_dimension (above image_entry) plugs the + // inheritance relation to the right abstract::image_dimension + // class using the grid information fetched from the point type. + typedef point2d point_type; + // FIXME: Dummy values. typedef topo2d topo_type; - typedef point2d point_type; typedef my::image concrete_type; typedef my::dummy morpher_type; + typedef mlc::true_ is_computed_type; }; template<> Index: tests/core/at.cc =================================================================== --- tests/core/at.cc (revision 712) +++ tests/core/at.cc (working copy) @@ -38,10 +38,12 @@ { using namespace oln; - image2d<int> ima(1, 1); + typedef image2d<int> I; + I ima(1, 1); point2d p(0, 0); (ima + c4).at(0, 0) = 51; + assert(ima(p) == 51); image1d<int> sig(1); Index: tests/core/grid.cc =================================================================== --- tests/core/grid.cc (revision 712) +++ tests/core/grid.cc (working copy) @@ -39,7 +39,7 @@ // The extra pairs of parenthesis around mlc_value are needed to // prevent the assert macro from interpreting the arguments of // mlc_value as its own. - assert((mlc_value(oln_type_of_(oln::grid1d, dimvalue))) == 1); - assert((mlc_value(oln_type_of_(oln::grid2d, dimvalue))) == 2); - assert((mlc_value(oln_type_of_(oln::grid3d, dimvalue))) == 3); + assert((mlc_value(oln_vtype_(oln::grid1d, dimvalue))) == 1); + assert((mlc_value(oln_vtype_(oln::grid2d, dimvalue))) == 2); + assert((mlc_value(oln_vtype_(oln::grid3d, dimvalue))) == 3); } Index: tests/core/image1d.cc =================================================================== --- tests/core/image1d.cc (revision 712) +++ tests/core/image1d.cc (working copy) @@ -38,7 +38,7 @@ { // Fill a 1D image using its iterator. oln::image1d<char> ima1(3); - oln_type_of_(oln::image1d<char>, piter) p1(ima1.topo()); + oln_vtype_(oln::image1d<char>, piter) p1(ima1.topo()); for_all(p1) ima1(p1) = 1; @@ -54,7 +54,7 @@ // Add the three images. oln::image1d<long> sum(ima1.topo()); - oln_type_of_(oln::image1d<long>, piter) p(sum.topo()); + oln_vtype_(oln::image1d<long>, piter) p(sum.topo()); for_all(p) sum(p) = ima1(p) + ima2(p) + ima3(p); // And check the sum. Index: tests/core/image2d.cc =================================================================== --- tests/core/image2d.cc (revision 712) +++ tests/core/image2d.cc (working copy) @@ -38,7 +38,7 @@ { // Fill a 2D image using its iterator. oln::image2d<char> ima1(3, 3); - oln_type_of_(oln::image2d<char>, piter) p1(ima1.topo()); + oln_vtype_(oln::image2d<char>, piter) p1(ima1.topo()); for_all(p1) ima1(p1) = 1; @@ -55,7 +55,7 @@ // Add the three images. oln::image2d<long> sum(ima1.topo()); - oln_type_of_(oln::image2d<long>, piter) p(sum.topo()); + oln_vtype_(oln::image2d<long>, piter) p(sum.topo()); for_all(p) sum(p) = ima1(p) + ima2(p) + ima3(p); // And check the sum. Index: tests/core/image3d.cc =================================================================== --- tests/core/image3d.cc (revision 712) +++ tests/core/image3d.cc (working copy) @@ -38,7 +38,7 @@ { // Fill a 3D image using its iterator. oln::image3d<char> ima1(3, 3, 3); - oln_type_of_(oln::image3d<char>, piter) p1(ima1.topo()); + oln_vtype_(oln::image3d<char>, piter) p1(ima1.topo()); for_all(p1) ima1(p1) = 1; @@ -56,7 +56,7 @@ // Add the three images. oln::image3d<long> sum(ima1.topo()); - oln_type_of_(oln::image3d<long>, piter) p(sum.topo()); + oln_vtype_(oln::image3d<long>, piter) p(sum.topo()); for_all(p) sum(p) = ima1(p) + ima2(p) + ima3(p); // And check the sum. Index: tests/core/npoints.cc =================================================================== --- tests/core/npoints.cc (revision 712) +++ tests/core/npoints.cc (working copy) @@ -34,7 +34,7 @@ template <typename I> unsigned npoints(const oln::abstract::image<I>& input) { - oln_type_of(I, piter) p(input.topo()); + oln_vtype(I, piter) p(input.topo()); unsigned count = 0; for_all(p) ++count; Index: oln/debug/print.hh =================================================================== --- oln/debug/print.hh (revision 712) +++ oln/debug/print.hh (working copy) @@ -73,7 +73,7 @@ template <typename I> void print(const abstract::image<I>& input, std::ostream& ostr) { - oln_type_of(I, fwd_piter) p(input.topo()); + oln_vtype(I, fwd_piter) p(input.topo()); for_all(p) ostr << p.to_point() << ':' << format(input(p)) << ' '; } Index: oln/core/typedefs.hh =================================================================== --- oln/core/typedefs.hh (revision 712) +++ oln/core/typedefs.hh (working copy) @@ -125,7 +125,7 @@ mlc_decl_typedef(neighborhood_type); mlc_decl_typedef(subset_type); - mlc_decl_typedef(delegated_type); + mlc_decl_typedef(delegated_type); // FIXME: soon obsolete mlc_decl_typedef(topo_type); mlc_decl_typedef(bbox_type); @@ -168,85 +168,85 @@ /// Shortcuts formed such as "oln_something(T) means -/// oln_type_of(T, something)". +/// oln_vtype(T, something)". /// \{ -# define oln_dim(T) oln_type_of(T, dim) -# define oln_dim_(T) oln_type_of_(T, dim) +# define oln_dim(T) oln_vtype(T, dim) +# define oln_dim_(T) oln_vtype_(T, dim) -# define oln_vec(T) oln_type_of(T, vec) -# define oln_vec_(T) oln_type_of_(T, vec) +# define oln_vec(T) oln_vtype(T, vec) +# define oln_vec_(T) oln_vtype_(T, vec) -# define oln_bbox(T) oln_type_of(T, bbox) -# define oln_bbox_(T) oln_type_of_(T, bbox) +# define oln_bbox(T) oln_vtype(T, bbox) +# define oln_bbox_(T) oln_vtype_(T, bbox) -# define oln_coord(T) oln_type_of(T, coord) -# define oln_coord_(T) oln_type_of_(T, coord) +# define oln_coord(T) oln_vtype(T, coord) +# define oln_coord_(T) oln_vtype_(T, coord) -# define oln_grid(T) oln_type_of(T, grid) -# define oln_grid_(T) oln_type_of_(T, grid) +# define oln_grid(T) oln_vtype(T, grid) +# define oln_grid_(T) oln_vtype_(T, grid) -# define oln_topo(T) oln_type_of(T, topo) -# define oln_topo_(T) oln_type_of_(T, topo) +# define oln_topo(T) oln_vtype(T, topo) +# define oln_topo_(T) oln_vtype_(T, topo) -# define oln_point(T) oln_type_of(T, point) -# define oln_point_(T) oln_type_of_(T, point) +# define oln_point(T) oln_vtype(T, point) +# define oln_point_(T) oln_vtype_(T, point) -# define oln_psite(T) oln_type_of(T, psite) -# define oln_psite_(T) oln_type_of_(T, psite) +# define oln_psite(T) oln_vtype(T, psite) +# define oln_psite_(T) oln_vtype_(T, psite) -# define oln_dpoint(T) oln_type_of(T, dpoint) -# define oln_dpoint_(T) oln_type_of_(T, dpoint) +# define oln_dpoint(T) oln_vtype(T, dpoint) +# define oln_dpoint_(T) oln_vtype_(T, dpoint) -# define oln_is_computed(T) oln_type_of(T, is_computed) -# define oln_is_computed_(T) oln_type_of_(T, is_computed) +# define oln_is_computed(T) oln_vtype(T, is_computed) +# define oln_is_computed_(T) oln_vtype_(T, is_computed) -# define oln_value(T) oln_type_of(T, value) -# define oln_value_(T) oln_type_of_(T, value) +# define oln_value(T) oln_vtype(T, value) +# define oln_value_(T) oln_vtype_(T, value) -# define oln_rvalue(T) oln_type_of(T, rvalue) -# define oln_rvalue_(T) oln_type_of_(T, rvalue) +# define oln_rvalue(T) oln_vtype(T, rvalue) +# define oln_rvalue_(T) oln_vtype_(T, rvalue) -# define oln_lvalue(T) oln_type_of(T, lvalue) -# define oln_lvalue_(T) oln_type_of_(T, lvalue) +# define oln_lvalue(T) oln_vtype(T, lvalue) +# define oln_lvalue_(T) oln_vtype_(T, lvalue) -# define oln_fwd_piter(T) oln_type_of(T, fwd_piter) -# define oln_fwd_piter_(T) oln_type_of_(T, fwd_piter) +# define oln_fwd_piter(T) oln_vtype(T, fwd_piter) +# define oln_fwd_piter_(T) oln_vtype_(T, fwd_piter) -# define oln_bkd_piter(T) oln_type_of(T, bkd_piter) -# define oln_bkd_piter_(T) oln_type_of_(T, bkd_piter) +# define oln_bkd_piter(T) oln_vtype(T, bkd_piter) +# define oln_bkd_piter_(T) oln_vtype_(T, bkd_piter) -# define oln_fwd_qiter(T) oln_type_of(T, fwd_qiter) -# define oln_fwd_qiter_(T) oln_type_of_(T, fwd_qiter) +# define oln_fwd_qiter(T) oln_vtype(T, fwd_qiter) +# define oln_fwd_qiter_(T) oln_vtype_(T, fwd_qiter) -# define oln_bkd_qiter(T) oln_type_of(T, bkd_qiter) -# define oln_bkd_qiter_(T) oln_type_of_(T, bkd_qiter) +# define oln_bkd_qiter(T) oln_vtype(T, bkd_qiter) +# define oln_bkd_qiter_(T) oln_vtype_(T, bkd_qiter) -# define oln_fwd_niter(T) oln_type_of(T, fwd_niter) -# define oln_fwd_niter_(T) oln_type_of_(T, fwd_niter) +# define oln_fwd_niter(T) oln_vtype(T, fwd_niter) +# define oln_fwd_niter_(T) oln_vtype_(T, fwd_niter) -# define oln_bkd_niter(T) oln_type_of(T, bkd_niter) -# define oln_bkd_niter_(T) oln_type_of_(T, bkd_niter) +# define oln_bkd_niter(T) oln_vtype(T, bkd_niter) +# define oln_bkd_niter_(T) oln_vtype_(T, bkd_niter) -# define oln_fwd_viter(T) oln_type_of(T, fwd_viter) -# define oln_fwd_viter_(T) oln_type_of_(T, fwd_viter) +# define oln_fwd_viter(T) oln_vtype(T, fwd_viter) +# define oln_fwd_viter_(T) oln_vtype_(T, fwd_viter) -# define oln_bkd_viter(T) oln_type_of(T, bkd_viter) -# define oln_bkd_viter_(T) oln_type_of_(T, bkd_viter) +# define oln_bkd_viter(T) oln_vtype(T, bkd_viter) +# define oln_bkd_viter_(T) oln_vtype_(T, bkd_viter) /// Even shorter shortcuts. /// \{ -# define oln_piter(T) oln_type_of(T, fwd_piter) -# define oln_piter_(T) oln_type_of_(T, fwd_piter) +# define oln_piter(T) oln_vtype(T, fwd_piter) +# define oln_piter_(T) oln_vtype_(T, fwd_piter) -# define oln_qiter(T) oln_type_of(T, fwd_qiter) -# define oln_qiter_(T) oln_type_of_(T, fwd_qiter) +# define oln_qiter(T) oln_vtype(T, fwd_qiter) +# define oln_qiter_(T) oln_vtype_(T, fwd_qiter) -# define oln_niter(T) oln_type_of(T, fwd_niter) -# define oln_niter_(T) oln_type_of_(T, fwd_niter) +# define oln_niter(T) oln_vtype(T, fwd_niter) +# define oln_niter_(T) oln_vtype_(T, fwd_niter) -# define oln_viter(T) oln_type_of(T, fwd_viter) -# define oln_viter_(T) oln_type_of_(T, fwd_viter) +# define oln_viter(T) oln_vtype(T, fwd_viter) +# define oln_viter_(T) oln_vtype_(T, fwd_viter) /// \} /// \} Index: oln/core/macros.hh =================================================================== --- oln/core/macros.hh (revision 712) +++ oln/core/macros.hh (working copy) @@ -32,30 +32,36 @@ # include <oln/core/typedefs.hh> -# define oln_type_of_(OlnType, Alias) \ - oln::direct_type_of_<OlnType, oln::typedef_:: Alias##_type>::ret +# define oln_vtype_(OlnType, Alias) \ + stc_vtype_(oln, OlnType, Alias) -# define oln_type_of(OlnType, Alias) \ - typename oln_type_of_(OlnType, Alias) +# define oln_vtype(OlnType, Alias) \ + stc_vtype(oln, OlnType, Alias) +# define oln_find_vtype(OlnType, Alias) \ + stc_find_vtype(oln, OlnType, Alias) -# define oln_deduce_type_of(OlnType, Alias1, Alias2) \ -typename oln::direct_type_of_<typename oln::direct_type_of_<OlnType, oln::typedef_::Alias1##_type >::ret, \ - oln::typedef_::Alias2##_type >::ret -# define oln_deduce(OlnType, Alias1, Alias2) \ - oln_deduce_type_of(OlnType, Alias1, Alias2) +# define oln_deferred_vtype(OlnType, Alias) \ + stc_deferred_vtype(oln, OlnType, Alias) +# define oln_deduce_deferred_vtype(OlnType, Alias1, Alias2) \ + stc_deduce_deferred_vtype(oln, OlnType, Alias1, Alias2) +# define oln_deduce_vtype(OlnType, Alias1, Alias2) \ + stc_deduce_vtype(oln, OlnType, Alias1, Alias2) + +# define oln_find_deduce_vtype(OlnType, Alias1, Alias2) \ + stc_find_deduce_vtype(oln, OlnType, Alias1, Alias2) + + + #define oln_virtual_typedef(Typedef) \ - typedef oln_type_of(E, Typedef) Typedef + typedef oln_vtype(E, Typedef) Typedef -// FIXME: Rec? The macro below is to ensure that static checks are removed during "Rec" tests. -// #define oln_virtual_typedef(Typedef) typedef void Typedef - #endif // ! OLN_CORE_MACROS_HH Index: oln/core/point_set_entry.hh =================================================================== --- oln/core/point_set_entry.hh (revision 712) +++ oln/core/point_set_entry.hh (working copy) @@ -39,6 +39,11 @@ template <typename E> struct point_set_entry; + template <typename E> + struct set_super_type< point_set_entry<E> > + { + typedef mlc::none ret; + }; /// Virtual types associated to point_set_entry<E>. @@ -46,20 +51,20 @@ template <typename E> struct vtypes< point_set_entry<E> > { - typedef mlc::undefined point_type; + typedef stc::abstract point_type; - typedef mlc::undefined fwd_piter_type; - typedef mlc::undefined bkd_piter_type; + typedef stc::abstract fwd_piter_type; + typedef stc::abstract bkd_piter_type; typedef mlc::none bbox_type; - typedef mlc::undefined is_random_accessible_type; - typedef mlc::undefined has_known_size_type; - typedef mlc::undefined is_connected_type; + typedef stc::abstract is_random_accessible_type; + typedef stc::abstract has_known_size_type; + typedef stc::abstract is_connected_type; // final. - typedef oln_deduce(E, point, coord) coord_type; - typedef oln_deduce(E, point, grid) grid_type; - typedef oln_deduce(E, point, dim) dim_type; + typedef oln_deduce_vtype(E, point, coord) coord_type; + typedef oln_deduce_vtype(E, point, grid) grid_type; + typedef oln_deduce_vtype(E, point, dim) dim_type; typedef oln_fwd_piter(E) piter_type; }; Index: oln/core/neighborhood_entry.hh =================================================================== --- oln/core/neighborhood_entry.hh (revision 712) +++ oln/core/neighborhood_entry.hh (working copy) @@ -40,11 +40,18 @@ template <typename E> struct neighborhood_entry; + template <typename E> + struct set_super_type< neighborhood_entry<E> > + { + typedef mlc::none ret; + }; + + /// Virtual types associated to neighborhood_entry<E>. template <typename E> struct vtypes< neighborhood_entry<E> > { - typedef mlc::undefined grid_type; + typedef stc::abstract grid_type; }; Index: oln/core/automatic/impl.hh =================================================================== --- oln/core/automatic/impl.hh (revision 712) +++ oln/core/automatic/impl.hh (working copy) @@ -44,7 +44,7 @@ /// Specialization of oln::automatic::get_impl saving the user /// the need to specify the morpher type as tag. template < template <class> class abstraction, typename E > - class get_impl : public set_impl< abstraction, oln_type_of(E, morpher), E > + class get_impl : public set_impl< abstraction, oln_vtype(E, morpher), E > { }; Index: oln/core/automatic/image/image.hh =================================================================== --- oln/core/automatic/image/image.hh (revision 712) +++ oln/core/automatic/image/image.hh (working copy) @@ -53,9 +53,9 @@ { private: - typedef oln_type_of(E, topo) topo_t; - typedef oln_type_of(E, rvalue) rvalue_t; - typedef oln_type_of(E, psite) psite_t; + typedef oln_vtype(E, topo) topo_t; + typedef oln_vtype(E, rvalue) rvalue_t; + typedef oln_vtype(E, psite) psite_t; public: Index: oln/core/automatic/image/image_being_point_wise_random_accessible.hh =================================================================== --- oln/core/automatic/image/image_being_point_wise_random_accessible.hh (revision 712) +++ oln/core/automatic/image/image_being_point_wise_random_accessible.hh (working copy) @@ -55,7 +55,7 @@ { private: - typedef oln_type_of(E, point) point_t; + typedef oln_vtype(E, point) point_t; public: Index: oln/core/automatic/image/image_having_neighborhood.hh =================================================================== --- oln/core/automatic/image/image_having_neighborhood.hh (revision 712) +++ oln/core/automatic/image/image_having_neighborhood.hh (working copy) @@ -53,7 +53,7 @@ public virtual stc::any__simple<E> { private: - typedef oln_type_of(E, neighborhood) neighborhood_t; + typedef oln_vtype(E, neighborhood) neighborhood_t; public: /// Accessor delegation. Index: oln/core/automatic/image/image_being_value_wise_random_accessible.hh =================================================================== --- oln/core/automatic/image/image_being_value_wise_random_accessible.hh (revision 712) +++ oln/core/automatic/image/image_being_value_wise_random_accessible.hh (working copy) @@ -54,8 +54,8 @@ public virtual stc::any__simple<E> { public: - typedef oln_type_of(E, value) value_type; - typedef oln_type_of(E, fwd_viter) fwd_viter_type; + typedef oln_vtype(E, value) value_type; + typedef oln_vtype(E, fwd_viter) fwd_viter_type; public: fwd_viter_type impl_value(const value_type& v) const; @@ -70,8 +70,8 @@ public virtual stc::any__simple<E> { public: - typedef oln_type_of(E, value) value_type; - typedef oln_type_of(E, fwd_viter) fwd_viter_type; + typedef oln_vtype(E, value) value_type; + typedef oln_vtype(E, fwd_viter) fwd_viter_type; public: fwd_viter_type impl_value(const value_type& v); Index: oln/core/automatic/topology/topology_having_bbox.hh =================================================================== --- oln/core/automatic/topology/topology_having_bbox.hh (revision 712) +++ oln/core/automatic/topology/topology_having_bbox.hh (working copy) @@ -56,7 +56,7 @@ public virtual stc::any__simple<E> { private: - typedef oln_type_of(E, bbox) bbox_t; + typedef oln_vtype(E, bbox) bbox_t; public: Index: oln/core/automatic/topology/topology_having_subset.hh =================================================================== --- oln/core/automatic/topology/topology_having_subset.hh (revision 712) +++ oln/core/automatic/topology/topology_having_subset.hh (working copy) @@ -56,7 +56,7 @@ public virtual stc::any__simple<E> { private: - typedef oln_type_of(E, subset) subset_t; + typedef oln_vtype(E, subset) subset_t; public: Index: oln/core/automatic/topology/topology_being_random_accessible.hh =================================================================== --- oln/core/automatic/topology/topology_being_random_accessible.hh (revision 712) +++ oln/core/automatic/topology/topology_being_random_accessible.hh (working copy) @@ -57,7 +57,7 @@ public virtual stc::any__simple<E> { private: - typedef oln_type_of(E, point) point_t; + typedef oln_vtype(E, point) point_t; public: Index: oln/core/automatic/topology/topology_having_neighborhood.hh =================================================================== --- oln/core/automatic/topology/topology_having_neighborhood.hh (revision 712) +++ oln/core/automatic/topology/topology_having_neighborhood.hh (working copy) @@ -56,7 +56,7 @@ public virtual stc::any__simple<E> { private: - typedef oln_type_of(E, neighborhood) neighborhood_t; + typedef oln_vtype(E, neighborhood) neighborhood_t; public: Index: oln/core/spe/row.hh =================================================================== --- oln/core/spe/row.hh (revision 712) +++ oln/core/spe/row.hh (working copy) @@ -81,14 +81,14 @@ template <typename P> oln_coord(P) row(const abstract::point<P>& p) { - typedef oln_type_of(P, row_comp) comp_t; + typedef oln_vtype(P, row_comp) comp_t; return p.vec()[mlc_value(comp_t)]; } template <typename P> oln_coord(P)& row(abstract::point<P>& p) { - typedef oln_type_of(P, row_comp) comp_t; + typedef oln_vtype(P, row_comp) comp_t; return p.vec()[mlc_value(comp_t)]; } @@ -97,14 +97,14 @@ template <typename D> oln_coord(D) row(const abstract::dpoint<D>& p) { - typedef oln_type_of(D, row_comp) comp_t; + typedef oln_vtype(D, row_comp) comp_t; return p.vec()[mlc_value(comp_t)]; } template <typename D> oln_coord(D)& row(abstract::dpoint<D>& p) { - typedef oln_type_of(D, row_comp) comp_t; + typedef oln_vtype(D, row_comp) comp_t; return p.vec()[mlc_value(comp_t)]; } @@ -113,7 +113,7 @@ template <typename P> oln_coord(P) row(const abstract::iterator_on_points<P>& it) { - typedef oln_deduce_type_of(P, point, row_comp) comp_t; + typedef oln_deduce_vtype(P, point, row_comp) comp_t; return it.to_point().vec()[mlc_value(comp_t)]; } @@ -122,14 +122,14 @@ template <typename Ps> oln_coord(Ps) min_row(const abstract::point_set_having_bbox<Ps>& ps) { - typedef oln_deduce_type_of(Ps, point, row_comp) comp_t; + typedef oln_deduce_vtype(Ps, point, row_comp) comp_t; return ps.pmin().vec()[mlc_value(comp_t)]; } template <typename Ps> oln_coord(Ps) max_row(const abstract::point_set_having_bbox<Ps>& ps) { - typedef oln_deduce_type_of(Ps, point, row_comp) comp_t; + typedef oln_deduce_vtype(Ps, point, row_comp) comp_t; return ps.pmax().vec()[mlc_value(comp_t)]; } @@ -138,14 +138,14 @@ template <typename I> oln_coord(I) min_row(const abstract::image_having_bbox<I>& ps) { - typedef oln_deduce_type_of(I, point, row_comp) comp_t; + typedef oln_deduce_vtype(I, point, row_comp) comp_t; return ps.pmin().vec()[mlc_value(comp_t)]; } template <typename I> oln_coord(I) max_row(const abstract::image_having_bbox<I>& ps) { - typedef oln_deduce_type_of(I, point, row_comp) comp_t; + typedef oln_deduce_vtype(I, point, row_comp) comp_t; return ps.pmax().vec()[mlc_value(comp_t)]; } Index: oln/core/spe/col.hh =================================================================== --- oln/core/spe/col.hh (revision 712) +++ oln/core/spe/col.hh (working copy) @@ -81,14 +81,14 @@ template <typename P> oln_coord(P) col(const abstract::point<P>& p) { - typedef oln_type_of(P, col_comp) comp_t; + typedef oln_vtype(P, col_comp) comp_t; return p.vec()[mlc_value(comp_t)]; } template <typename P> oln_coord(P)& col(abstract::point<P>& p) { - typedef oln_type_of(P, col_comp) comp_t; + typedef oln_vtype(P, col_comp) comp_t; return p.vec()[mlc_value(comp_t)]; } @@ -97,14 +97,14 @@ template <typename D> oln_coord(D) col(const abstract::dpoint<D>& p) { - typedef oln_type_of(D, col_comp) comp_t; + typedef oln_vtype(D, col_comp) comp_t; return p.vec()[mlc_value(comp_t)]; } template <typename D> oln_coord(D)& col(abstract::dpoint<D>& p) { - typedef oln_type_of(D, col_comp) comp_t; + typedef oln_vtype(D, col_comp) comp_t; return p.vec()[mlc_value(comp_t)]; } @@ -113,7 +113,7 @@ template <typename P> oln_coord(P) col(const abstract::iterator_on_points<P>& it) { - typedef oln_deduce_type_of(P, point, col_comp) comp_t; + typedef oln_deduce_vtype(P, point, col_comp) comp_t; return it.to_point().vec()[mlc_value(comp_t)]; } @@ -122,14 +122,14 @@ template <typename Ps> oln_coord(Ps) min_col(const abstract::point_set_having_bbox<Ps>& ps) { - typedef oln_deduce_type_of(Ps, point, col_comp) comp_t; + typedef oln_deduce_vtype(Ps, point, col_comp) comp_t; return ps.pmin().vec()[mlc_value(comp_t)]; } template <typename Ps> oln_coord(Ps) max_col(const abstract::point_set_having_bbox<Ps>& ps) { - typedef oln_deduce_type_of(Ps, point, col_comp) comp_t; + typedef oln_deduce_vtype(Ps, point, col_comp) comp_t; return ps.pmax().vec()[mlc_value(comp_t)]; } @@ -138,14 +138,14 @@ template <typename I> oln_coord(I) min_col(const abstract::image_having_bbox<I>& ps) { - typedef oln_deduce_type_of(I, point, col_comp) comp_t; + typedef oln_deduce_vtype(I, point, col_comp) comp_t; return ps.pmin().vec()[mlc_value(comp_t)]; } template <typename I> oln_coord(I) max_col(const abstract::image_having_bbox<I>& ps) { - typedef oln_deduce_type_of(I, point, col_comp) comp_t; + typedef oln_deduce_vtype(I, point, col_comp) comp_t; return ps.pmax().vec()[mlc_value(comp_t)]; } Index: oln/core/spe/slice.hh =================================================================== --- oln/core/spe/slice.hh (revision 712) +++ oln/core/spe/slice.hh (working copy) @@ -81,14 +81,14 @@ template <typename P> oln_coord(P) slice(const abstract::point<P>& p) { - typedef oln_type_of(P, slice_comp) comp_t; + typedef oln_vtype(P, slice_comp) comp_t; return p.vec()[mlc_value(comp_t)]; } template <typename P> oln_coord(P)& slice(abstract::point<P>& p) { - typedef oln_type_of(P, slice_comp) comp_t; + typedef oln_vtype(P, slice_comp) comp_t; return p.vec()[mlc_value(comp_t)]; } @@ -97,14 +97,14 @@ template <typename D> oln_coord(D) slice(const abstract::dpoint<D>& p) { - typedef oln_type_of(D, slice_comp) comp_t; + typedef oln_vtype(D, slice_comp) comp_t; return p.vec()[mlc_value(comp_t)]; } template <typename D> oln_coord(D)& slice(abstract::dpoint<D>& p) { - typedef oln_type_of(D, slice_comp) comp_t; + typedef oln_vtype(D, slice_comp) comp_t; return p.vec()[mlc_value(comp_t)]; } @@ -113,7 +113,7 @@ template <typename P> oln_coord(P) slice(const abstract::iterator_on_points<P>& it) { - typedef oln_deduce_type_of(P, point, slice_comp) comp_t; + typedef oln_deduce_vtype(P, point, slice_comp) comp_t; return it.to_point().vec()[mlc_value(comp_t)]; } @@ -122,14 +122,14 @@ template <typename Ps> oln_coord(Ps) min_slice(const abstract::point_set_having_bbox<Ps>& ps) { - typedef oln_deduce_type_of(Ps, point, slice_comp) comp_t; + typedef oln_deduce_vtype(Ps, point, slice_comp) comp_t; return ps.pmin().vec()[mlc_value(comp_t)]; } template <typename Ps> oln_coord(Ps) max_slice(const abstract::point_set_having_bbox<Ps>& ps) { - typedef oln_deduce_type_of(Ps, point, slice_comp) comp_t; + typedef oln_deduce_vtype(Ps, point, slice_comp) comp_t; return ps.pmax().vec()[mlc_value(comp_t)]; } @@ -138,14 +138,14 @@ template <typename I> oln_coord(I) min_slice(const abstract::image_having_bbox<I>& ps) { - typedef oln_deduce_type_of(I, point, slice_comp) comp_t; + typedef oln_deduce_vtype(I, point, slice_comp) comp_t; return ps.pmin().vec()[mlc_value(comp_t)]; } template <typename I> oln_coord(I) max_slice(const abstract::image_having_bbox<I>& ps) { - typedef oln_deduce_type_of(I, point, slice_comp) comp_t; + typedef oln_deduce_vtype(I, point, slice_comp) comp_t; return ps.pmax().vec()[mlc_value(comp_t)]; } Index: oln/core/topology_entry.hh =================================================================== --- oln/core/topology_entry.hh (revision 712) +++ oln/core/topology_entry.hh (working copy) @@ -39,15 +39,22 @@ template <typename E> struct topology_entry; + template <typename E> + struct set_super_type< topology_entry<E> > + { + typedef mlc::none ret; + }; + + /// Virtual types associated to topology_entry<E>. template <typename E> struct vtypes< topology_entry<E> > { - typedef mlc::undefined point_type; - typedef mlc::undefined bbox_type; + typedef stc::abstract point_type; + typedef stc::abstract bbox_type; typedef mlc::none neighborhood_type; - typedef mlc::undefined is_random_accessible_type; + typedef stc::abstract is_random_accessible_type; typedef mlc::none subset_type; typedef mlc::none morpher_type; Index: oln/core/image_entry.hh =================================================================== --- oln/core/image_entry.hh (revision 712) +++ oln/core/image_entry.hh (working copy) @@ -42,29 +42,34 @@ template <typename E> struct image_entry; + template <typename E> + struct set_super_type< image_entry<E> > + { + typedef mlc::none ret; + }; + /// Virtual types associated to image_entry<E>. template <typename E> struct vtypes< image_entry<E> > { - typedef mlc::undefined topo_type; - typedef mlc::undefined grid_type; - typedef mlc::undefined point_type; - typedef mlc::undefined is_computed_type; - typedef mlc::undefined value_type; + typedef stc::abstract topo_type; - typedef mlc::undefined fwd_piter_type; - typedef mlc::undefined bkd_piter_type; + typedef stc::abstract point_type; + typedef stc::final<oln_deduce_deferred_vtype(E, point, grid)> grid_type; + typedef stc::final<oln_deduce_deferred_vtype(E, point, coord)> coord_type; - typedef mlc::undefined fwd_qiter_type; - typedef mlc::undefined bkd_qiter_type; + typedef stc::abstract is_computed_type; + typedef stc::abstract value_type; - // final definitions: - typedef oln_deduce(E, point, coord) coord_type; - typedef oln_fwd_piter(E) piter_type; + typedef stc::abstract fwd_piter_type; + typedef stc::abstract bkd_piter_type; - // default definitions: + // FIXME: final definitions: + typedef oln_fwd_piter(E) piter_type; + + // FIXME: default definitions: typedef oln_point(E) psite_type; typedef oln_value(E) rvalue_type; Index: oln/core/iterator_vtypes.hh =================================================================== --- oln/core/iterator_vtypes.hh (revision 712) +++ oln/core/iterator_vtypes.hh (working copy) @@ -183,7 +183,7 @@ struct single_vtype< morpher::add_isubset<Image, Isubset>, typedef_::fwd_piter_type > { - typedef piter_isubset_<oln_type_of(Image, fwd_piter), Isubset> ret; + typedef piter_isubset_<oln_vtype(Image, fwd_piter), Isubset> ret; }; /// bkd_piter vtype on morpher::add_isubset. @@ -191,7 +191,7 @@ struct single_vtype< morpher::add_isubset<Image, Isubset>, typedef_::bkd_piter_type > { - typedef piter_isubset_<oln_type_of(Image, bkd_piter), Isubset> ret; + typedef piter_isubset_<oln_vtype(Image, bkd_piter), Isubset> ret; }; @@ -202,7 +202,7 @@ struct single_vtype< morpher::add_isubset<Image, Isubset>, typedef_::fwd_qiter_type > { - typedef piter_isubset_<oln_type_of(Image, fwd_qiter), Isubset> ret; + typedef piter_isubset_<oln_vtype(Image, fwd_qiter), Isubset> ret; }; /// bkd_qiter vtype on morpher::add_isubset. @@ -210,7 +210,7 @@ struct single_vtype< morpher::add_isubset<Image, Isubset>, typedef_::bkd_qiter_type > { - typedef piter_isubset_<oln_type_of(Image, bkd_qiter), Isubset> ret; + typedef piter_isubset_<oln_vtype(Image, bkd_qiter), Isubset> ret; }; @@ -221,7 +221,7 @@ struct single_vtype< morpher::add_isubset<Image, Isubset>, typedef_::fwd_niter_type > { - typedef piter_isubset_<oln_type_of(Image, fwd_niter), Isubset> ret; + typedef piter_isubset_<oln_vtype(Image, fwd_niter), Isubset> ret; }; /// bkd_niter vtype on morpher::add_isubset. @@ -229,7 +229,7 @@ struct single_vtype< morpher::add_isubset<Image, Isubset>, typedef_::bkd_niter_type > { - typedef piter_isubset_<oln_type_of(Image, bkd_niter), Isubset> ret; + typedef piter_isubset_<oln_vtype(Image, bkd_niter), Isubset> ret; }; @@ -254,7 +254,7 @@ typedef_::fwd_niter_type > { private: - typedef oln_type_of(Image, point) point_t; + typedef oln_vtype(Image, point) point_t; public: typedef fwd_niter_neighb_<point_t> ret; }; @@ -265,7 +265,7 @@ typedef_::bkd_niter_type > { private: - typedef oln_type_of(Image, point) point_t; + typedef oln_vtype(Image, point) point_t; public: typedef bkd_niter_neighb_<point_t> ret; }; Index: oln/core/abstract/iterator_on_points.hh =================================================================== --- oln/core/abstract/iterator_on_points.hh (revision 712) +++ oln/core/abstract/iterator_on_points.hh (working copy) @@ -53,8 +53,8 @@ template <typename E> struct vtypes< abstract::iterator_on_points<E> > { - typedef mlc::undefined point_type; - typedef oln_deduce(E, point, coord) coord_type; + typedef stc::abstract point_type; + typedef oln_deduce_deferred_vtype(E, point, coord) coord_type; }; Index: oln/core/abstract/image.hh =================================================================== --- oln/core/abstract/image.hh (revision 712) +++ oln/core/abstract/image.hh (working copy) @@ -79,8 +79,8 @@ oln_virtual_typedef(point); // FIXME: Rec? -// oln_virtual_typedef(fwd_piter); -// oln_virtual_typedef(bkd_piter); + oln_virtual_typedef(fwd_piter); + oln_virtual_typedef(bkd_piter); oln_virtual_typedef(is_computed); oln_virtual_typedef(value); @@ -144,11 +144,11 @@ image<E>::decl::decl() { // FIXME: Rec? -// mlc::assert_< mlc_is_a(topo, abstract::topology) >::check(); -// mlc::assert_< mlc_is_a(grid, abstract::grid) >::check(); -// mlc::assert_< mlc_is_a(point, abstract::point) >::check(); -// mlc::assert_< mlc_is_a(fwd_piter, abstract::iterator_on_points) >::check(); -// mlc::assert_< mlc_is_a(bkd_piter, abstract::iterator_on_points) >::check(); + mlc::assert_< mlc_is_a(topo, abstract::topology) >::check(); + mlc::assert_< mlc_is_a(grid, abstract::grid) >::check(); + mlc::assert_< mlc_is_a(point, abstract::point) >::check(); + mlc::assert_< mlc_is_a(fwd_piter, abstract::iterator_on_points) >::check(); + mlc::assert_< mlc_is_a(bkd_piter, abstract::iterator_on_points) >::check(); // FIXME: Rec? // mlc::assert_< mlc_is_a(plain, abstract::image) >::check(); Index: oln/core/abstract/image/hybrid/classical.hh =================================================================== --- oln/core/abstract/image/hybrid/classical.hh (revision 712) +++ oln/core/abstract/image/hybrid/classical.hh (working copy) @@ -174,9 +174,9 @@ /// 1D case. template <typename E> struct case_< image_hybrid_hierarchy_wrt_classical, E, 1 > : - where_< mlc::and_list_< mlc::eq_< oln_type_of(E, grid), oln::grid1d >, - mlc::eq_< oln_deduce_type_of(E, topo, is_random_accessible), mlc::true_ >, - mlc::neq_< oln_deduce_type_of(E, topo, bbox), mlc::not_found > + where_< mlc::and_list_< mlc::eq_< oln_vtype(E, grid), oln::grid1d >, + mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ >, + mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found > > > { @@ -187,9 +187,9 @@ /// 2D case. template <typename E> struct case_< image_hybrid_hierarchy_wrt_classical, E, 2 > : - where_< mlc::and_list_< mlc::eq_< oln_type_of(E, grid), oln::grid2d >, - mlc::eq_< oln_deduce_type_of(E, topo, is_random_accessible), mlc::true_ >, - mlc::neq_< oln_deduce_type_of(E, topo, bbox), mlc::not_found > + where_< mlc::and_list_< mlc::eq_< oln_vtype(E, grid), oln::grid2d >, + mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ >, + mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found > > > { @@ -200,9 +200,9 @@ /// 3D case. template <typename E> struct case_< image_hybrid_hierarchy_wrt_classical, E, 3 > : - where_< mlc::and_list_< mlc::eq_< oln_type_of(E, grid), oln::grid3d >, - mlc::eq_< oln_deduce_type_of(E, topo, is_random_accessible), mlc::true_ >, - mlc::neq_< oln_deduce_type_of(E, topo, bbox), mlc::not_found > + where_< mlc::and_list_< mlc::eq_< oln_vtype(E, grid), oln::grid3d >, + mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ >, + mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found > > > { @@ -213,8 +213,8 @@ /// General case. template <typename E> struct case_< image_hybrid_hierarchy_wrt_classical, E, 4 > : - where_< mlc::and_< mlc::eq_< oln_deduce_type_of(E, topo, is_random_accessible), mlc::true_ >, - mlc::neq_< oln_deduce_type_of(E, topo, bbox), mlc::not_found > + where_< mlc::and_< mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ >, + mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found > > > { Index: oln/core/abstract/image/type/integre.hh =================================================================== --- oln/core/abstract/image/type/integre.hh (revision 712) +++ oln/core/abstract/image/type/integre.hh (working copy) @@ -97,9 +97,9 @@ /// Binary case. template <typename E> struct case_< image_hierarchy_wrt_type, E, 5 > : - where_< mlc::or_list_< mlc::eq_<oln_type_of(E, value), ntg::bin>, - ntg::eq_<ntg::int_u, 1, oln_type_of(E, value)>, - ntg::eq_<ntg::int_s, 1, oln_type_of(E, value)> > > + where_< mlc::or_list_< mlc::eq_<oln_vtype(E, value), ntg::bin>, + ntg::eq_<ntg::int_u, 1, oln_vtype(E, value)>, + ntg::eq_<ntg::int_s, 1, oln_vtype(E, value)> > > { // Definition of the super class corresponding to this case. typedef abstract::binary_image<E> ret; @@ -108,7 +108,7 @@ /// Grey-level case. template <typename E> struct case_< image_hierarchy_wrt_type, E, 6 > : - where_< mlc_is_a( oln_type_of(E, value), ntg::real_value ) > + where_< mlc_is_a( oln_vtype(E, value), ntg::real_value ) > { // Definition of the super class corresponding to this case // (abstract::grey_level_image_ is the conjunction of @@ -119,7 +119,7 @@ /// Label case. template <typename E> struct case_< image_hierarchy_wrt_type, E, 7 > : - where_< mlc_is_a( oln_type_of(E, value), ntg::enum_value ) > + where_< mlc_is_a( oln_vtype(E, value), ntg::enum_value ) > { // Definition of the super class corresponding to this case // (abstract::label_image_ is the conjunction of @@ -130,7 +130,7 @@ /// Color case. template <typename E> struct case_< image_hierarchy_wrt_type, E, 8 > : - where_< mlc_is_a( oln_type_of(E, value), ntg::color_value ) > + where_< mlc_is_a( oln_vtype(E, value), ntg::color_value ) > { // Definition of the super class corresponding to this case // (abstract::color_image_ is the conjunction of Index: oln/core/abstract/image/type/hierarchy.hh =================================================================== --- oln/core/abstract/image/type/hierarchy.hh (revision 712) +++ oln/core/abstract/image/type/hierarchy.hh (working copy) @@ -66,7 +66,7 @@ (a concrete image) - Default case: If no known value type is returned by `oln_type_of(I, value)', + Default case: If no known value type is returned by `oln_vtype(I, value)', the entry is plugged to abstract::data_image<I>. */ @@ -103,7 +103,7 @@ /// Binary case. template <typename E> struct case_< image_hierarchy_wrt_type, E, 1 > : - where_< value::is_binary<oln_type_of(E, value)> > + where_< value::is_binary<oln_vtype(E, value)> > { // Definition of the super class corresponding to this case. typedef abstract::binary_image<E> ret; @@ -112,7 +112,7 @@ /// Color case. template <typename E> struct case_< image_hierarchy_wrt_type, E, 2 > : - where_< value::is_color<oln_type_of(E, value)> > + where_< value::is_color<oln_vtype(E, value)> > { // Definition of the super class corresponding to this case. typedef abstract::color_image<E> ret; @@ -121,7 +121,7 @@ /// Grey-level case. template <typename E> struct case_< image_hierarchy_wrt_type, E, 3 > : - where_< value::is_grey_level<oln_type_of(E, value)> > + where_< value::is_grey_level<oln_vtype(E, value)> > { // Definition of the super class corresponding to this case. typedef abstract::grey_level_image<E> ret; @@ -130,7 +130,7 @@ /// Label case. template <typename E> struct case_< image_hierarchy_wrt_type, E, 4 > : - where_< value::is_label<oln_type_of(E, value)> > + where_< value::is_label<oln_vtype(E, value)> > { // Definition of the super class corresponding to this case. typedef abstract::label_image<E> ret; Index: oln/core/abstract/image/mutability/hierarchy.hh =================================================================== --- oln/core/abstract/image/mutability/hierarchy.hh (revision 712) +++ oln/core/abstract/image/mutability/hierarchy.hh (working copy) @@ -108,7 +108,7 @@ /// With mutability. template <typename E> struct case_< image_hierarchy_wrt_mutability, E, 1 > : - where_< mlc_is_ok(oln_lvalue(E)) > + where_< mlc::is_found_< oln_find_vtype(E, lvalue) > > { typedef abstract::mutable_image<E> ret; }; Index: oln/core/abstract/image/computability/hierarchy.hh =================================================================== --- oln/core/abstract/image/computability/hierarchy.hh (revision 712) +++ oln/core/abstract/image/computability/hierarchy.hh (working copy) @@ -105,14 +105,14 @@ /// With computability. template <typename E> struct case_< image_hierarchy_wrt_computability, E, 1 > : - where_< mlc::eq_< oln_type_of(E, is_computed), mlc::true_ > > + where_< mlc::eq_< oln_vtype(E, is_computed), mlc::true_ > > { typedef abstract::computed_image<E> ret; }; template <typename E> struct case_< image_hierarchy_wrt_computability, E, 2 > : - where_< mlc::eq_< oln_type_of(E, is_computed), mlc::false_ > > + where_< mlc::eq_< oln_vtype(E, is_computed), mlc::false_ > > { typedef abstract::plain_image<E> ret; }; Index: oln/core/abstract/image/dimension/1d.hh =================================================================== --- oln/core/abstract/image/dimension/1d.hh (revision 712) +++ oln/core/abstract/image/dimension/1d.hh (working copy) @@ -67,8 +67,8 @@ public: // Resolve an ambiguity w.r.t. impl_at(). // FIXME: Too hacky! - using automatic::set_impl<abstract::image1d, oln_type_of(E, morpher), E>::impl_at; - using automatic::set_impl<abstract::mutable_image1d, oln_type_of(E, morpher), E>::impl_at; + using automatic::set_impl<abstract::image1d, oln_vtype(E, morpher), E>::impl_at; + using automatic::set_impl<abstract::mutable_image1d, oln_vtype(E, morpher), E>::impl_at; using image1d<E>::at; Index: oln/core/abstract/image/dimension/2d.hh =================================================================== --- oln/core/abstract/image/dimension/2d.hh (revision 712) +++ oln/core/abstract/image/dimension/2d.hh (working copy) @@ -67,8 +67,8 @@ public: // Resolve an ambiguity w.r.t. impl_at(). // FIXME: Too hacky! - using automatic::set_impl<abstract::image2d, oln_type_of(E, morpher), E>::impl_at; - using automatic::set_impl<abstract::mutable_image2d, oln_type_of(E, morpher), E>::impl_at; + using automatic::set_impl<abstract::image2d, oln_vtype(E, morpher), E>::impl_at; + using automatic::set_impl<abstract::mutable_image2d, oln_vtype(E, morpher), E>::impl_at; using image2d<E>::at; Index: oln/core/abstract/image/dimension/3d.hh =================================================================== --- oln/core/abstract/image/dimension/3d.hh (revision 712) +++ oln/core/abstract/image/dimension/3d.hh (working copy) @@ -72,8 +72,8 @@ public: // Resolve an ambiguity w.r.t. impl_at(). // FIXME: Too hacky! - using automatic::set_impl<abstract::image3d, oln_type_of(E, morpher), E>::impl_at; - using automatic::set_impl<abstract::mutable_image3d, oln_type_of(E, morpher), E>::impl_at; + using automatic::set_impl<abstract::image3d, oln_vtype(E, morpher), E>::impl_at; + using automatic::set_impl<abstract::mutable_image3d, oln_vtype(E, morpher), E>::impl_at; using image3d<E>::at; Index: oln/core/abstract/image/dimension/hierarchy.hh =================================================================== --- oln/core/abstract/image/dimension/hierarchy.hh (revision 712) +++ oln/core/abstract/image/dimension/hierarchy.hh (working copy) @@ -62,7 +62,7 @@ (a concrete image) - Default case: If no known grid type is returned by `oln_type_of(I, grid)', + Default case: If no known grid type is returned by `oln_vtype(I, grid)', the entry is directly plugged to abstract::image<I>. */ // FIXME: Figure above is obsolete because of the introduction of @@ -97,7 +97,7 @@ template <typename E> struct case_< image_hierarchy_wrt_dimension, E, 1 > : where_< mlc::and_< mlc::eq_< oln_grid(E), oln::grid1d >, - mlc_is_ok(oln_lvalue(E)) > > + mlc::is_found_< oln_find_vtype(E, lvalue) > > > { typedef abstract::mutable_image1d<E> ret; }; @@ -114,7 +114,7 @@ template <typename E> struct case_< image_hierarchy_wrt_dimension, E, 3 > : where_< mlc::and_< mlc::eq_< oln_grid(E), oln::grid2d >, - mlc_is_ok(oln_lvalue(E)) > > + mlc::is_found_< oln_find_vtype(E, lvalue) > > > { typedef abstract::mutable_image2d<E> ret; }; @@ -131,7 +131,7 @@ template <typename E> struct case_< image_hierarchy_wrt_dimension, E, 5 > : where_< mlc::and_< mlc::eq_< oln_grid(E), oln::grid3d >, - mlc_is_ok(oln_lvalue(E)) > > + mlc::is_found_< oln_find_vtype(E, lvalue) > > > { typedef abstract::mutable_image3d<E> ret; }; Index: oln/core/abstract/image/neighborhood/hierarchy.hh =================================================================== --- oln/core/abstract/image/neighborhood/hierarchy.hh (revision 712) +++ oln/core/abstract/image/neighborhood/hierarchy.hh (working copy) @@ -50,7 +50,7 @@ public automatic::get_impl<image_having_neighborhood, E> { private: - typedef oln_type_of(E, neighborhood) neighborhood_t; + typedef oln_vtype(E, neighborhood) neighborhood_t; public: @@ -106,7 +106,7 @@ /// With neighborhood. template <typename E> struct case_< image_hierarchy_wrt_neighborhood, E, 1 > : - where_< mlc::neq_< oln_type_of(E, neighborhood), mlc::not_found > > + where_< mlc::neq_< oln_find_vtype(E, neighborhood), mlc::not_found > > { typedef abstract::image_having_neighborhood<E> ret; }; Index: oln/core/abstract/image/point_wise_accessibility/hierarchy.hh =================================================================== --- oln/core/abstract/image/point_wise_accessibility/hierarchy.hh (revision 712) +++ oln/core/abstract/image/point_wise_accessibility/hierarchy.hh (working copy) @@ -49,7 +49,7 @@ public virtual image<E>, public automatic::get_impl< image_being_point_wise_random_accessible, E > { - typedef oln_type_of(E, point) point_t; + typedef oln_vtype(E, point) point_t; public: @@ -98,7 +98,7 @@ /// With point-wise accessibility. template <typename E> struct case_< image_hierarchy_wrt_point_wise_accessibility, E, 1 > : - where_< mlc::eq_< oln_deduce_type_of(E, topo, is_random_accessible), mlc::true_ > > + where_< mlc::eq_< oln_deduce_vtype(E, topo, is_random_accessible), mlc::true_ > > { typedef abstract::image_being_point_wise_random_accessible<E> ret; }; Index: oln/core/abstract/image/bbox/hierarchy.hh =================================================================== --- oln/core/abstract/image/bbox/hierarchy.hh (revision 712) +++ oln/core/abstract/image/bbox/hierarchy.hh (working copy) @@ -51,8 +51,8 @@ { private: - typedef oln_type_of(E, bbox) bbox_t; - typedef oln_type_of(E, point) point_t; + typedef oln_vtype(E, bbox) bbox_t; + typedef oln_vtype(E, point) point_t; public: @@ -135,7 +135,7 @@ /// With bbox. template <typename E> struct case_< image_hierarchy_wrt_bbox, E, 1 > : - where_< mlc::neq_< oln_deduce(E, topo, bbox), mlc::not_found > > + where_< mlc::neq_< oln_deduce_vtype(E, topo, bbox), mlc::not_found > > { typedef abstract::image_having_bbox<E> ret; }; @@ -146,7 +146,7 @@ template <typename E> struct single_vtype< image_entry<E>, typedef_::bbox_type > { - typedef oln_deduce(E, topo, bbox) ret; + typedef oln_deduce_vtype(E, topo, bbox) ret; }; } // end of namespace oln Index: oln/core/abstract/image/value_wise_accessibility/hierarchy.hh =================================================================== --- oln/core/abstract/image/value_wise_accessibility/hierarchy.hh (revision 712) +++ oln/core/abstract/image/value_wise_accessibility/hierarchy.hh (working copy) @@ -52,8 +52,8 @@ public virtual image<E>, public automatic::get_impl< image_being_value_wise_random_accessible, E > { - typedef oln_type_of(E, value) value_t; - typedef oln_type_of(E, value_proxy) value_proxy_t; + typedef oln_vtype(E, value) value_t; + typedef oln_vtype(E, value_proxy) value_proxy_t; public: /// Get a (read-only) value descriptor from a value. @@ -75,8 +75,8 @@ public virtual image_being_value_wise_random_accessible<E>, public automatic::get_impl< mutable_image_being_value_wise_random_accessible, E > { - typedef oln_type_of(E, value) value_t; - typedef oln_type_of(E, mutable_value_proxy) mutable_value_proxy_t; + typedef oln_vtype(E, value) value_t; + typedef oln_vtype(E, mutable_value_proxy) mutable_value_proxy_t; public: using image_being_value_wise_random_accessible<E>::value; @@ -133,8 +133,8 @@ /// 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_type_of(E, fwd_viter)), - mlc_is_ok(oln_type_of(E, mutable_value_proxy)) ) > + where_< mlc_and( mlc_is_ok(oln_find_vtype(E, fwd_viter)), + mlc_is_ok(oln_find_vtype(E, mutable_value_proxy)) ) > { typedef abstract::mutable_image_being_value_wise_random_accessible<E> ret; }; @@ -142,7 +142,7 @@ /// With (constant) value-wise random accessibility. template <typename E> struct case_< image_hierarchy_wrt_value_wise_accessibility, E, 2 > : - where_< mlc_is_ok(oln_type_of(E, fwd_viter)) > + where_< mlc_is_ok(oln_find_vtype(E, fwd_viter)) > { typedef abstract::image_being_value_wise_random_accessible<E> ret; }; Index: oln/core/abstract/grid.hh =================================================================== --- oln/core/abstract/grid.hh (revision 712) +++ oln/core/abstract/grid.hh (working copy) @@ -44,7 +44,7 @@ template <typename E> struct vtypes< abstract::grid<E> > { - typedef mlc::undefined dimvalue_type; + typedef stc::abstract dimvalue_type; }; namespace abstract { Index: oln/core/abstract/iterator.hh =================================================================== --- oln/core/abstract/iterator.hh (revision 712) +++ oln/core/abstract/iterator.hh (working copy) @@ -35,7 +35,16 @@ namespace oln { + namespace abstract { template <typename E> class iterator; } + + template <typename E> + struct set_super_type< abstract::iterator<E> > + { + typedef mlc::none ret; + }; + + namespace abstract { Index: oln/core/abstract/point.hh =================================================================== --- oln/core/abstract/point.hh (revision 712) +++ oln/core/abstract/point.hh (working copy) @@ -55,14 +55,22 @@ namespace abstract { template <typename E> class point; } + template <typename E> + struct set_super_type< abstract::point<E> > + { + typedef mlc::none ret; + }; + + /// Virtual types associated to abstract::point<E>. template <typename E> struct vtypes< abstract::point<E> > { - typedef mlc::undefined grid_type; - typedef mlc::undefined dpoint_type; - typedef oln_deduce(E, dpoint, coord) coord_type; - typedef mlc::undefined dim_type; + // FIXME: Prefer to use final<deduce..> when possible. + typedef stc::abstract grid_type; + typedef stc::abstract dpoint_type; + typedef oln_deduce_deferred_vtype(E, dpoint, coord) coord_type; + typedef stc::abstract dim_type; typedef oln_dim(E) dim_t; typedef xtd::vec<mlc_value(dim_t), coord_type> vec_type; @@ -232,8 +240,8 @@ template <typename P> bool point<E>::operator==(const abstract::point<P>& rhs) const { - mlc::assert_equal_< oln_type_of(E, grid), - oln_type_of(P, grid), + mlc::assert_equal_< oln_vtype(E, grid), + oln_vtype(P, grid), oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check(); return this->exact().impl_equal(rhs.exact()); } @@ -248,8 +256,8 @@ template <typename P> bool point<E>::operator!=(const abstract::point<P>& rhs) const { - mlc::assert_equal_< oln_type_of(E, grid), - oln_type_of(P, grid), + mlc::assert_equal_< oln_vtype(E, grid), + oln_vtype(P, grid), oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check(); return not (*this == rhs); } @@ -264,8 +272,8 @@ template <typename P> bool point<E>::operator<(const abstract::point<P>& rhs) const { - mlc::assert_equal_< oln_type_of(E, grid), - oln_type_of(P, grid), + mlc::assert_equal_< oln_vtype(E, grid), + oln_vtype(P, grid), oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check(); return this->exact().impl_less(rhs.exact()); } @@ -280,8 +288,8 @@ template <typename P> bool point<E>::operator>(const abstract::point<P>& rhs) const { - mlc::assert_equal_< oln_type_of(E, grid), - oln_type_of(P, grid), + mlc::assert_equal_< oln_vtype(E, grid), + oln_vtype(P, grid), oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check(); return rhs < *this; } @@ -296,8 +304,8 @@ template <typename P> bool point<E>::operator>=(const abstract::point<P>& rhs) const { - mlc::assert_equal_< oln_type_of(E, grid), - oln_type_of(P, grid), + mlc::assert_equal_< oln_vtype(E, grid), + oln_vtype(P, grid), oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check(); return not (*this < rhs); } @@ -312,8 +320,8 @@ template <typename P> bool point<E>::operator<=(const abstract::point<P>& rhs) const { - mlc::assert_equal_< oln_type_of(E, grid), - oln_type_of(P, grid), + mlc::assert_equal_< oln_vtype(E, grid), + oln_vtype(P, grid), oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check(); return not (rhs < *this); } @@ -328,8 +336,8 @@ template <typename D> E& point<E>::operator+=(const abstract::dpoint<D>& rhs) { - mlc::assert_equal_< oln_type_of(E, grid), - oln_type_of(D, grid), + mlc::assert_equal_< oln_vtype(E, grid), + oln_vtype(D, grid), oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check(); return this->exact().impl_plus_equal(rhs.exact()); } @@ -344,8 +352,8 @@ template <typename D> xtd_op_plus_trait(E,D) point<E>::operator+(const abstract::dpoint<D>& rhs) const { - mlc::assert_equal_< oln_type_of(E, grid), - oln_type_of(D, grid), + mlc::assert_equal_< oln_vtype(E, grid), + oln_vtype(D, grid), oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check(); return this->exact().impl_plus(rhs.exact()); } @@ -360,8 +368,8 @@ template <typename D> E& point<E>::operator-=(const abstract::dpoint<D>& rhs) const { - mlc::assert_equal_< oln_type_of(E, grid), - oln_type_of(D, grid), + mlc::assert_equal_< oln_vtype(E, grid), + oln_vtype(D, grid), oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check(); return this->exact().impl_minus_equal(rhs.exact()); } @@ -376,8 +384,8 @@ template <typename D> xtd_op_minus_trait(E, D) point<E>::operator-(const abstract::dpoint<D>& rhs) const { - mlc::assert_equal_< oln_type_of(E, grid), - oln_type_of(D, grid), + mlc::assert_equal_< oln_vtype(E, grid), + oln_vtype(D, grid), oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check(); return this->exact().impl_minus(rhs.exact()); } @@ -392,8 +400,8 @@ template <typename P> xtd_op_minus_trait(E, P) point<E>::operator-(const abstract::point<P>& rhs) const { - mlc::assert_equal_< oln_type_of(E, grid), - oln_type_of(P, grid), + mlc::assert_equal_< oln_vtype(E, grid), + oln_vtype(P, grid), oln::ERROR::OPERANDS_ARE_NOT_COMPATIBLE >::check(); return this->exact().impl_minus(rhs.exact()); } @@ -420,10 +428,10 @@ // template <typename E> // point<E>::~point() // { -// mlc::assert_defined_< oln_type_of(E, grid) >::check(); -// mlc::assert_defined_< oln_type_of(E, dpoint) >::check(); -// mlc::assert_defined_< oln_type_of(E, coord) >::check(); -// mlc::assert_defined_< oln_type_of(E, dim) >::check(); +// mlc::assert_defined_< oln_vtype(E, grid) >::check(); +// mlc::assert_defined_< oln_vtype(E, dpoint) >::check(); +// mlc::assert_defined_< oln_vtype(E, coord) >::check(); +// mlc::assert_defined_< oln_vtype(E, dim) >::check(); // } # endif Index: oln/core/abstract/dpoint.hh =================================================================== --- oln/core/abstract/dpoint.hh (revision 712) +++ oln/core/abstract/dpoint.hh (working copy) @@ -50,14 +50,22 @@ namespace abstract { template <typename E> class dpoint; } + template <typename E> + struct set_super_type< abstract::dpoint<E> > + { + typedef mlc::none ret; + }; + + /// Virtual types associated to abstract::dpoint<E>. template <typename E> struct vtypes< abstract::dpoint<E> > { - typedef mlc::undefined grid_type; - typedef mlc::undefined point_type; - typedef mlc::undefined coord_type; - typedef mlc::undefined dim_type; + // FIXME: Prefer to use final<deduce..> when possible. + typedef stc::abstract grid_type; + typedef stc::abstract point_type; + typedef stc::abstract coord_type; + typedef stc::abstract dim_type; }; @@ -123,10 +131,10 @@ // template <typename E> // dpoint<E>::~dpoint() { -// mlc::assert_defined_< oln_type_of(E, grid) >::check(); -// mlc::assert_defined_< oln_type_of(E, point) >::check(); -// mlc::assert_defined_< oln_type_of(E, coord) >::check(); -// mlc::assert_defined_< oln_type_of(E, dim) >::check(); +// mlc::assert_defined_< oln_vtype(E, grid) >::check(); +// mlc::assert_defined_< oln_vtype(E, point) >::check(); +// mlc::assert_defined_< oln_vtype(E, coord) >::check(); +// mlc::assert_defined_< oln_vtype(E, dim) >::check(); // } # endif Index: oln/core/abstract/iterator_on_values.hh =================================================================== --- oln/core/abstract/iterator_on_values.hh (revision 712) +++ oln/core/abstract/iterator_on_values.hh (working copy) @@ -52,7 +52,7 @@ template <typename E> struct vtypes< abstract::iterator_on_values<E> > { - typedef mlc::undefined value_type; + typedef stc::abstract value_type; }; @@ -64,7 +64,7 @@ class iterator_on_values : public abstract::iterator<E> { public: - typedef oln_type_of(E, value) value_type; + typedef oln_vtype(E, value) value_type; value_type to_value() const; Index: oln/core/abstract/point_set/point_set_being_random_accessible.hh =================================================================== --- oln/core/abstract/point_set/point_set_being_random_accessible.hh (revision 712) +++ oln/core/abstract/point_set/point_set_being_random_accessible.hh (working copy) @@ -43,7 +43,7 @@ template <typename E> class point_set_being_random_accessible : public virtual point_set<E> { - typedef oln_type_of(E, point) point_t; + typedef oln_vtype(E, point) point_t; public: @@ -75,7 +75,7 @@ template <typename E> struct case_ < point_set_hierarchy_wrt_accessibility, E, 1 > - : where_< mlc::eq_< oln_type_of(E, is_random_accessible), mlc::true_ > > + : where_< mlc::eq_< oln_vtype(E, is_random_accessible), mlc::true_ > > { typedef abstract::point_set_being_random_accessible<E> ret; }; Index: oln/core/abstract/point_set/point_set_having_known_size.hh =================================================================== --- oln/core/abstract/point_set/point_set_having_known_size.hh (revision 712) +++ oln/core/abstract/point_set/point_set_having_known_size.hh (working copy) @@ -73,7 +73,7 @@ template <typename E> struct case_ < point_set_hierarchy_wrt_known_size, E, 1 > - : where_< mlc::eq_< oln_type_of(E, has_known_size), mlc::true_ > > + : where_< mlc::eq_< oln_vtype(E, has_known_size), mlc::true_ > > { typedef abstract::point_set_having_known_size<E> ret; }; Index: oln/core/abstract/point_set/point_set_being_connected.hh =================================================================== --- oln/core/abstract/point_set/point_set_being_connected.hh (revision 712) +++ oln/core/abstract/point_set/point_set_being_connected.hh (working copy) @@ -166,9 +166,9 @@ template <typename E> struct case_ < point_set_hierarchy_wrt_connectivity, E, 1 > : where_< mlc::and_list_< - mlc::neq_< oln_type_of(E, bbox), mlc::none >, - mlc::eq_< oln_type_of(E, is_connected), mlc::true_ >, - mlc::eq_< oln_type_of(E, grid), grid1d > + mlc::neq_< oln_vtype(E, bbox), mlc::none >, + mlc::eq_< oln_vtype(E, is_connected), mlc::true_ >, + mlc::eq_< oln_vtype(E, grid), grid1d > > > { typedef abstract::point_set_being_1d_connected<E> ret; @@ -177,9 +177,9 @@ template <typename E> struct case_ < point_set_hierarchy_wrt_connectivity, E, 2 > : where_< mlc::and_list_< - mlc::neq_< oln_type_of(E, bbox), mlc::none >, - mlc::eq_< oln_type_of(E, is_connected), mlc::true_ >, - mlc::eq_< oln_type_of(E, grid), grid2d > + mlc::neq_< oln_vtype(E, bbox), mlc::none >, + mlc::eq_< oln_vtype(E, is_connected), mlc::true_ >, + mlc::eq_< oln_vtype(E, grid), grid2d > > > { typedef abstract::point_set_being_2d_connected<E> ret; @@ -188,9 +188,9 @@ template <typename E> struct case_ < point_set_hierarchy_wrt_connectivity, E, 3 > : where_< mlc::and_list_< - mlc::neq_< oln_type_of(E, bbox), mlc::none >, - mlc::eq_< oln_type_of(E, is_connected), mlc::true_ >, - mlc::eq_< oln_type_of(E, grid), grid3d > + mlc::neq_< oln_vtype(E, bbox), mlc::none >, + mlc::eq_< oln_vtype(E, is_connected), mlc::true_ >, + mlc::eq_< oln_vtype(E, grid), grid3d > > > { typedef abstract::point_set_being_3d_connected<E> ret; Index: oln/core/abstract/point_set/point_set_having_bbox.hh =================================================================== --- oln/core/abstract/point_set/point_set_having_bbox.hh (revision 712) +++ oln/core/abstract/point_set/point_set_having_bbox.hh (working copy) @@ -138,7 +138,7 @@ template <typename E> struct case_ < point_set_hierarchy_wrt_bbox, E, 1 > - : where_< mlc::eq_< oln_type_of(E, bbox), E > > + : where_< mlc::eq_< oln_vtype(E, bbox), E > > { typedef abstract::bbox<E> ret; }; @@ -146,7 +146,7 @@ template <typename E> struct case_ < point_set_hierarchy_wrt_bbox, E, 2 > - : where_< mlc::neq_< oln_type_of(E, bbox), mlc::none > > + : where_< mlc::neq_< oln_vtype(E, bbox), mlc::none > > { typedef abstract::point_set_having_bbox<E> ret; }; Index: oln/core/abstract/window.hh =================================================================== --- oln/core/abstract/window.hh (revision 712) +++ oln/core/abstract/window.hh (working copy) @@ -34,6 +34,16 @@ namespace oln { + namespace abstract { template <typename E> class window; } + + + template <typename E> + struct set_super_type< abstract::window<E> > + { + typedef mlc::none ret; + }; + + namespace abstract { Index: oln/core/abstract/topology/topology_having_bbox.hh =================================================================== --- oln/core/abstract/topology/topology_having_bbox.hh (revision 712) +++ oln/core/abstract/topology/topology_having_bbox.hh (working copy) @@ -44,7 +44,7 @@ : public virtual topology<E>, public automatic::get_impl<topology_having_bbox, E> { - typedef oln_type_of(E, bbox) bbox_t; + typedef oln_vtype(E, bbox) bbox_t; public: @@ -66,21 +66,21 @@ # ifndef OLN_INCLUDE_ONLY template <typename E> - const oln_type_of(E, bbox)& + const oln_vtype(E, bbox)& topology_having_bbox<E>::bbox() const { return this->exact().impl_bbox(); } template <typename E> - oln_type_of(E, bbox)& + oln_vtype(E, bbox)& topology_having_bbox<E>::bbox() { return this->exact().impl_bbox(); } template <typename E> - topology_having_bbox<E>::operator oln_type_of(E, bbox)() const + topology_having_bbox<E>::operator oln_vtype(E, bbox)() const { return this->bbox(); } @@ -98,7 +98,7 @@ template <typename E> struct case_ < topology_hierarchy_wrt_bbox, E, 1 > - : where_< mlc::neq_< oln_type_of(E, bbox), mlc::none > > + : where_< mlc::neq_< oln_vtype(E, bbox), mlc::none > > { typedef abstract::topology_having_bbox<E> ret; }; Index: oln/core/abstract/topology/topology_being_random_accessible.hh =================================================================== --- oln/core/abstract/topology/topology_being_random_accessible.hh (revision 712) +++ oln/core/abstract/topology/topology_being_random_accessible.hh (working copy) @@ -44,7 +44,7 @@ : public virtual topology<E>, public automatic::get_impl<topology_being_random_accessible, E> { - typedef oln_type_of(E, point) point_t; + typedef oln_vtype(E, point) point_t; public: @@ -62,13 +62,13 @@ # ifndef OLN_INCLUDE_ONLY template <typename E> - bool topology_being_random_accessible<E>::has(const oln_type_of(E, point)& p) const + bool topology_being_random_accessible<E>::has(const oln_vtype(E, point)& p) const { return this->exact().impl_has(p); } template <typename E> - bool topology_being_random_accessible<E>::has_large(const oln_type_of(E, point)& p) const + bool topology_being_random_accessible<E>::has_large(const oln_vtype(E, point)& p) const { return this->exact().impl_has_large(p); } @@ -86,7 +86,7 @@ template <typename E> struct case_ < topology_hierarchy_wrt_accessibility, E, 1 > - : where_< mlc::eq_< oln_type_of(E, is_random_accessible), mlc::true_ > > + : where_< mlc::eq_< oln_vtype(E, is_random_accessible), mlc::true_ > > { typedef abstract::topology_being_random_accessible<E> ret; }; Index: oln/core/abstract/topology/topology_having_subset.hh =================================================================== --- oln/core/abstract/topology/topology_having_subset.hh (revision 712) +++ oln/core/abstract/topology/topology_having_subset.hh (working copy) @@ -44,7 +44,7 @@ : public virtual topology<E>, public automatic::get_impl<topology_having_subset, E> { - typedef oln_type_of(E, subset) subset_t; + typedef oln_vtype(E, subset) subset_t; public: @@ -60,7 +60,7 @@ # ifndef OLN_INCLUDE_ONLY template <typename E> - const oln_type_of(E, subset)& + const oln_vtype(E, subset)& topology_having_subset<E>::subset() const { return this->exact().impl_subset(); @@ -78,7 +78,7 @@ template <typename E> struct case_ < topology_hierarchy_wrt_subset, E, 1 > - : where_< mlc::neq_< oln_type_of(E, subset), mlc::none > > + : where_< mlc::neq_< oln_vtype(E, subset), mlc::none > > { typedef abstract::topology_having_subset<E> ret; }; Index: oln/core/abstract/topology/topology_having_neighborhood.hh =================================================================== --- oln/core/abstract/topology/topology_having_neighborhood.hh (revision 712) +++ oln/core/abstract/topology/topology_having_neighborhood.hh (working copy) @@ -44,7 +44,7 @@ : public virtual topology<E>, public automatic::get_impl<topology_having_neighborhood, E> { - typedef oln_type_of(E, neighborhood) neighborhood_t; + typedef oln_vtype(E, neighborhood) neighborhood_t; public: @@ -64,14 +64,14 @@ # ifndef OLN_INCLUDE_ONLY template <typename E> - const oln_type_of(E, neighborhood)& + const oln_vtype(E, neighborhood)& topology_having_neighborhood<E>::neighborhood() const { return this->exact().impl_neighborhood(); } template <typename E> - topology_having_neighborhood<E>::operator oln_type_of(E, neighborhood)() const + topology_having_neighborhood<E>::operator oln_vtype(E, neighborhood)() const { return this->neighborhood(); } @@ -89,7 +89,7 @@ template <typename E> struct case_ < topology_hierarchy_wrt_neighborhood, E, 1 > - : where_< mlc::neq_< oln_type_of(E, neighborhood), mlc::none > > + : where_< mlc::neq_< oln_vtype(E, neighborhood), mlc::none > > { typedef abstract::topology_having_neighborhood<E> ret; }; Index: oln/core/abstract/internal/image_impl.hh =================================================================== --- oln/core/abstract/internal/image_impl.hh (revision 712) +++ oln/core/abstract/internal/image_impl.hh (working copy) @@ -75,8 +75,8 @@ (client) - The D parameter is the delegated type. If there is no - delegated type (i.e. D = mlc::none), get_image_impl inherits + The D parameter is the delegatee type. If there is no + delegatee type (i.e. D = mlc::none), get_image_impl inherits from oln::any_best_speed (trough get_image_impl_helper); otherwise, get_image_impl is plugged to set_image_impl, a class than can be specialized by the user. @@ -91,7 +91,7 @@ // Entry point. template <typename A, typename E> struct get_image_impl : - public get_image_impl_helper <A, oln_type_of(E, delegated), E> + public get_image_impl_helper <A, oln_vtype(E, delegatee), E> { }; @@ -120,7 +120,7 @@ struct image_impl : public virtual oln::abstract::any_best_speed<E> { - typedef oln_type_of(E, delegated) D; + typedef oln_vtype(E, delegatee) D; D& delegate() { return this->exact().impl_delegate(); } const D& delegate() const { return this->exact().impl_delegate(); } }; Index: oln/core/1d/image1d.hh =================================================================== --- oln/core/1d/image1d.hh (revision 712) +++ oln/core/1d/image1d.hh (working copy) @@ -51,7 +51,6 @@ struct vtypes< image1d<T> > { typedef topo1d topo_type; - typedef grid1d grid_type; typedef point1d point_type; Index: oln/core/2d/image2d.hh =================================================================== --- oln/core/2d/image2d.hh (revision 712) +++ oln/core/2d/image2d.hh (working copy) @@ -51,7 +51,6 @@ struct vtypes< image2d<T> > { typedef topo2d topo_type; - typedef grid2d grid_type; typedef point2d point_type; Index: oln/core/3d/image3d.hh =================================================================== --- oln/core/3d/image3d.hh (revision 712) +++ oln/core/3d/image3d.hh (working copy) @@ -51,7 +51,6 @@ struct vtypes< image3d<T> > { typedef topo3d topo_type; - typedef grid3d grid_type; typedef point3d point_type; Index: oln/core/gen/piter_isubset.hh =================================================================== --- oln/core/gen/piter_isubset.hh (revision 712) +++ oln/core/gen/piter_isubset.hh (working copy) @@ -54,10 +54,10 @@ template <typename piter_t, typename isubset_t> struct vtypes< piter_isubset_<piter_t, isubset_t> > { - typedef oln_type_of(piter_t, point) point_type; - typedef oln_type_of(piter_t, grid) grid_type; + typedef oln_vtype(piter_t, point) point_type; + typedef oln_vtype(piter_t, grid) grid_type; - typedef topo_add_isubset<oln_type_of(piter_t, topo), isubset_t> topo_type; + typedef topo_add_isubset<oln_vtype(piter_t, topo), isubset_t> topo_type; }; @@ -69,8 +69,8 @@ typedef piter_isubset_<piter_t, isubset_t> self_t; typedef abstract::iterator_on_points<self_t> super_t; - typedef oln_type_of(self_t, topo) topo_t; - typedef oln_type_of(self_t, point) point_t; + typedef oln_vtype(self_t, topo) topo_t; + typedef oln_vtype(self_t, point) point_t; public: Index: oln/core/gen/topo_add_isubset.hh =================================================================== --- oln/core/gen/topo_add_isubset.hh (revision 712) +++ oln/core/gen/topo_add_isubset.hh (working copy) @@ -63,7 +63,7 @@ : public internal::topology_morpher<topo_t, topo_add_isubset<topo_t, isubset_t> > { typedef topo_add_isubset<topo_t, isubset_t> self_t; - typedef oln_type_of(self_t, point) point_t; + typedef oln_vtype(self_t, point) point_t; public: Index: oln/core/gen/bbox.hh =================================================================== --- oln/core/gen/bbox.hh (revision 712) +++ oln/core/gen/bbox.hh (working copy) @@ -62,7 +62,7 @@ typedef bbox_<point_t> bbox_type; typedef mlc::true_ is_random_accessible_type; - typedef mlc::true_ has_know_size_type; + typedef mlc::true_ has_known_size_type; typedef mlc::true_ is_connected_type; }; @@ -80,9 +80,9 @@ private: typedef point_set_entry<self_type> super_t; - typedef oln_type_of(point_t, coord) coord_t; + typedef oln_vtype(point_t, coord) coord_t; - typedef oln_type_of(point_t, dim) dim; + typedef oln_vtype(point_t, dim) dim; enum { n = mlc_value(dim) }; public: Index: oln/core/gen/topo_bbox.hh =================================================================== --- oln/core/gen/topo_bbox.hh (revision 712) +++ oln/core/gen/topo_bbox.hh (working copy) @@ -118,7 +118,7 @@ { typedef topo_bbox_<point> self_t; typedef topology_entry<self_t> super_t; - typedef oln_type_of(self_t, bbox) bbox_t; + typedef oln_vtype(self_t, bbox) bbox_t; public: Index: oln/core/gen/neighb.hh =================================================================== --- oln/core/gen/neighb.hh (revision 712) +++ oln/core/gen/neighb.hh (working copy) @@ -56,15 +56,17 @@ template <typename dpoint> struct vtypes< neighb_<dpoint> > { - typedef oln_type_of(dpoint, grid) grid_type; + typedef oln_vtype(dpoint, grid) grid_type; }; + struct FIXME_ERR; + /// Abstract forward dpoint iterator class. template <typename dpoint> class neighb_ : public neighborhood_entry< neighb_<dpoint> >, - private mlc::assert_< mlc_is_a(dpoint, abstract::dpoint) > + private mlc::assert_< mlc_is_a(dpoint, abstract::dpoint), FIXME_ERR > { typedef neighb_<dpoint> self_t; typedef neighborhood_entry<self_t> super_t; Index: oln/core/gen/bkd_viter_lut.hh =================================================================== --- oln/core/gen/bkd_viter_lut.hh (revision 712) +++ oln/core/gen/bkd_viter_lut.hh (working copy) @@ -70,11 +70,11 @@ { typedef bkd_viter_lut<Lut> self_t; typedef abstract::iterator_on_values<self_t> super_t; - typedef oln_type_of(self_t, lut_iter) lut_iter_t; + typedef oln_vtype(self_t, lut_iter) lut_iter_t; public: - typedef oln_type_of(self_t, lut) lut_type; - typedef oln_type_of(self_t, value) value_type; + typedef oln_vtype(self_t, lut) lut_type; + typedef oln_vtype(self_t, value) value_type; public: /// Construct a backward value iterator from a look-up table (LUT). Index: oln/core/gen/pset_list.hh =================================================================== --- oln/core/gen/pset_list.hh (revision 712) +++ oln/core/gen/pset_list.hh (working copy) @@ -61,7 +61,7 @@ typedef bkd_piter_on_std_based_pset< std::list<point_t> > bkd_piter_type; typedef mlc::false_ is_random_accessible_type; - typedef mlc::true_ has_know_size_type; + typedef mlc::true_ has_known_size_type; typedef mlc::false_ is_connected_type; }; Index: oln/core/gen/window.hh =================================================================== --- oln/core/gen/window.hh (revision 712) +++ oln/core/gen/window.hh (working copy) @@ -44,9 +44,16 @@ template <typename dpoint> + struct set_super_type< window_<dpoint> > + { + typedef abstract::window< window_<dpoint> > ret; + }; + + + template <typename dpoint> struct vtypes< window_<dpoint> > { - typedef oln_type_of(dpoint, grid) grid_type; + typedef oln_vtype(dpoint, grid) grid_type; }; Index: oln/core/gen/topo_lbbox.hh =================================================================== --- oln/core/gen/topo_lbbox.hh (revision 712) +++ oln/core/gen/topo_lbbox.hh (working copy) @@ -66,7 +66,7 @@ private mlc::assert_< mlc_is_a(point, abstract::point) > { typedef topo_lbbox_<point> self_t; - typedef oln_type_of(self_t, bbox) bbox_t; + typedef oln_vtype(self_t, bbox) bbox_t; public: @@ -103,7 +103,7 @@ unsigned border) : bb_(bb), border_(border) { - typedef oln_type_of(point, dpoint) dpoint_t; + typedef oln_vtype(point, dpoint) dpoint_t; dpoint_t dp; dp.set_all(border); lbb_ = bbox_<point>(bb_.pmin() - dp, bb_.pmax() + dp); @@ -114,7 +114,7 @@ unsigned border) : bb_(pmin, pmax), border_(border) { - typedef oln_type_of(point, dpoint) dpoint_t; + typedef oln_vtype(point, dpoint) dpoint_t; dpoint_t dp; dp.set_all(border); lbb_ = bbox_<point>(bb_.pmin() - dp, bb_.pmax() + dp); Index: oln/core/gen/pset_vec.hh =================================================================== --- oln/core/gen/pset_vec.hh (revision 712) +++ oln/core/gen/pset_vec.hh (working copy) @@ -61,7 +61,7 @@ typedef bkd_piter_on_std_based_pset< std::vector<point_t> > bkd_piter_type; typedef mlc::false_ is_random_accessible_type; - typedef mlc::true_ has_know_size_type; + typedef mlc::true_ has_known_size_type; typedef mlc::false_ is_connected_type; }; Index: oln/core/gen/pset_.hh =================================================================== --- oln/core/gen/pset_.hh (revision 712) +++ oln/core/gen/pset_.hh (working copy) @@ -61,7 +61,7 @@ typedef bkd_piter_on_std_based_pset< std::set<point_t> > bkd_piter_type; typedef mlc::false_ is_random_accessible_type; - typedef mlc::true_ has_know_size_type; + typedef mlc::true_ has_known_size_type; typedef mlc::false_ is_connected_type; }; Index: oln/core/gen/fwd_viter_lut.hh =================================================================== --- oln/core/gen/fwd_viter_lut.hh (revision 712) +++ oln/core/gen/fwd_viter_lut.hh (working copy) @@ -70,11 +70,11 @@ { typedef fwd_viter_lut<Lut> self_t; typedef abstract::iterator_on_values<self_t> super_t; - typedef oln_type_of(self_t, lut_iter) lut_iter_t; + typedef oln_vtype(self_t, lut_iter) lut_iter_t; public: - typedef oln_type_of(self_t, lut) lut_type; - typedef oln_type_of(self_t, value) value_type; + typedef oln_vtype(self_t, lut) lut_type; + typedef oln_vtype(self_t, value) value_type; public: /// Construct a forward value iterator from a look-up table (LUT). Index: oln/core/gen/mapimage.hh =================================================================== --- oln/core/gen/mapimage.hh (revision 712) +++ oln/core/gen/mapimage.hh (working copy) @@ -48,7 +48,6 @@ struct vtypes< mapimage<point_t, value_t> > { typedef topo_bbox_<point_t> topo_type; - typedef oln_type_of(point_t, grid) grid_type; typedef point_t point_type; @@ -77,7 +76,7 @@ class mapimage : public image_entry< mapimage<point_t, value_t> > { typedef mapimage<point_t, value_t> self_t; - typedef oln_type_of(self_t, topo) topo_t; + typedef oln_vtype(self_t, topo) topo_t; public: Index: oln/core/gen/topo_add_nbh.hh =================================================================== --- oln/core/gen/topo_add_nbh.hh (revision 712) +++ oln/core/gen/topo_add_nbh.hh (working copy) @@ -54,7 +54,7 @@ struct vtypes< topo_add_nbh<topo, nbh> > { typedef nbh neighborhood_type; - typedef topo delegated_type; + typedef topo delegatee_type; }; Index: oln/core/internal/topology_morpher.hh =================================================================== --- oln/core/internal/topology_morpher.hh (revision 712) +++ oln/core/internal/topology_morpher.hh (working copy) @@ -42,17 +42,23 @@ } // end of namespace oln::internal + + /// Super type. template <typename Topo, typename E> - struct set_pseudosuper_type< internal::topology_morpher<Topo, E> > + struct set_super_type< internal::topology_morpher<Topo, E> > { - typedef Topo ret; + typedef topology_entry<E> ret; }; + + /// Vtypes. template <typename Topo, typename E> struct vtypes< internal::topology_morpher<Topo, E> > { typedef morpher::tag::identity morpher_type; - typedef Topo delegated_type; + + /// Delegatee type. + typedef Topo delegatee_type; }; Index: oln/core/internal/point_nd.hh =================================================================== --- oln/core/internal/point_nd.hh (revision 712) +++ oln/core/internal/point_nd.hh (working copy) @@ -72,8 +72,8 @@ struct vtypes< internal::point_nd<E> > { private: - typedef oln_dim(E) dim_t; - typedef oln_coord(E) coord_t; + 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; }; @@ -124,9 +124,7 @@ point_nd(const vec_t& v); /// Dtor. - ~point_nd() - { - } + ~point_nd(); vec_t v_; }; @@ -221,9 +219,9 @@ v_(v) {} -// template <typename E> -// point_nd<E>::~point_nd() -// {} + template <typename E> + point_nd<E>::~point_nd() + {} # endif @@ -256,10 +254,10 @@ : where_< mlc::and_< mlc_is_a(P, internal::point_nd), mlc_is_a(D, internal::dpoint_nd) > > { - typedef oln_type_of(P, coord) P_coord; - typedef oln_type_of(D, coord) D_coord; + typedef oln_vtype(P, coord) P_coord; + typedef oln_vtype(D, coord) D_coord; typedef xtd_op_plus_trait(P_coord, D_coord) coord; - typedef oln_type_of(P, dim) dim; + typedef oln_vtype(P, dim) dim; typedef typename point_<mlc_value(dim), coord>::ret ret; }; @@ -271,10 +269,10 @@ : where_< mlc::and_< mlc_is_a(P, internal::point_nd), mlc_is_a(D, internal::dpoint_nd) > > { - typedef oln_type_of(P, coord) P_coord; - typedef oln_type_of(D, coord) D_coord; + typedef oln_vtype(P, coord) P_coord; + typedef oln_vtype(D, coord) D_coord; typedef xtd_op_minus_trait(P_coord, D_coord) coord; - typedef oln_type_of(P, dim) dim; + typedef oln_vtype(P, dim) dim; typedef typename point_<mlc_value(dim), coord>::ret ret; }; @@ -286,10 +284,10 @@ : where_< mlc::and_< mlc_is_a(P1, internal::point_nd), mlc_is_a(P2, internal::point_nd) > > { - typedef oln_type_of(P1, coord) P1_coord; - typedef oln_type_of(P2, coord) P2_coord; + typedef oln_vtype(P1, coord) P1_coord; + typedef oln_vtype(P2, coord) P2_coord; typedef xtd_op_minus_trait(P1_coord, P2_coord) coord; - typedef oln_type_of(P1, dim) dim; + typedef oln_vtype(P1, dim) dim; typedef typename dpoint_<mlc_value(dim), coord>::ret ret; }; Index: oln/core/internal/bbox_bkd_piter.hh =================================================================== --- oln/core/internal/bbox_bkd_piter.hh (revision 712) +++ oln/core/internal/bbox_bkd_piter.hh (working copy) @@ -61,7 +61,7 @@ template <typename E> class bbox_bkd_piter : public abstract::iterator_on_points<E> { - typedef oln_type_of(E, point) point_t; + typedef oln_vtype(E, point) point_t; public: @@ -95,7 +95,7 @@ # ifndef OLN_INCLUDE_ONLY template <typename E> - bbox_bkd_piter<E>::bbox_bkd_piter(const bbox_<oln_type_of(E, point)>& bb) + bbox_bkd_piter<E>::bbox_bkd_piter(const bbox_<oln_vtype(E, point)>& bb) : p_(), bb_(bb) { @@ -104,7 +104,7 @@ } template <typename E> - const bbox_<oln_type_of(E, point)>& + const bbox_<oln_vtype(E, point)>& bbox_bkd_piter<E>::bbox() const { return bb_; @@ -122,7 +122,7 @@ void bbox_bkd_piter<E>::impl_next() { - typedef oln_type_of(E, point) point_t; + typedef oln_vtype(E, point) point_t; invariant(implies(p_ != nop_, bb_.has(p_))); for (int i = point_t::n - 1; i >= 0; --i) if (p_[i] == bb_.pmin(i)) @@ -153,14 +153,14 @@ } template <typename E> - oln_type_of(E, point) + oln_vtype(E, point) bbox_bkd_piter<E>::impl_to_point() const { return p_; } template <typename E> - const oln_type_of(E, point)* + const oln_vtype(E, point)* bbox_bkd_piter<E>::impl_point_adr() const { return &p_; Index: oln/core/internal/bbox_fwd_piter.hh =================================================================== --- oln/core/internal/bbox_fwd_piter.hh (revision 712) +++ oln/core/internal/bbox_fwd_piter.hh (working copy) @@ -61,7 +61,7 @@ template <typename E> class bbox_fwd_piter : public abstract::iterator_on_points<E> { - typedef oln_type_of(E, point) point_t; + typedef oln_vtype(E, point) point_t; public: Index: oln/core/internal/dpoint_nd.hh =================================================================== --- oln/core/internal/dpoint_nd.hh (revision 712) +++ oln/core/internal/dpoint_nd.hh (working copy) @@ -55,8 +55,8 @@ struct vtypes< internal::dpoint_nd<E> > { private: - typedef oln_dim(E) dim_t; - typedef oln_coord(E) coord_t; + 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; }; @@ -72,7 +72,7 @@ typedef dpoint_nd<E> self_t; typedef oln_dim(E) dim_t; typedef oln_coord(E) coord_t; - typedef xtd::vec< mlc_value(dim_t), coord_t> vec_t; + typedef xtd::vec< mlc_value(dim_t), coord_t> vec_t; public: Index: oln/morpher/add_isubset.hh =================================================================== --- oln/morpher/add_isubset.hh (revision 712) +++ oln/morpher/add_isubset.hh (working copy) @@ -103,7 +103,7 @@ super_t(image), topo_(image.topo(), isubset) { - // mlc::assert_equal_<oln_type_of(Image, grid), oln_type_of(Isubset, grid)>::check(); + // mlc::assert_equal_<oln_vtype(Image, grid), oln_vtype(Isubset, grid)>::check(); // FIXME: check that Image is without a isubset } @@ -144,7 +144,7 @@ operator | (const abstract::image<I>& image, const abstract::binary_image<S>& isubset) { - mlc::assert_equal_<oln_type_of(I, grid), oln_type_of(S, grid)>::check(); + 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; Index: oln/morpher/value_cast.hh =================================================================== --- oln/morpher/value_cast.hh (revision 712) +++ oln/morpher/value_cast.hh (working copy) @@ -78,8 +78,8 @@ typedef value_cast<Image, Value> self_t; typedef internal::image_value_morpher<Image, self_t> super_t; - typedef oln_type_of(self_t, psite) psite_t; - typedef oln_type_of(self_t, rvalue) rvalue_t; + typedef oln_vtype(self_t, psite) psite_t; + typedef oln_vtype(self_t, rvalue) rvalue_t; public: Index: oln/morpher/thru_fun.hh =================================================================== --- oln/morpher/thru_fun.hh (revision 712) +++ oln/morpher/thru_fun.hh (working copy) @@ -59,7 +59,7 @@ struct vtypes< morpher::thru_fun<Image, Fun> > { private: - typedef oln_type_of(Image, rvalue) old_value_type; + typedef oln_vtype(Image, rvalue) old_value_type; typedef morpher::thru_fun<Image, Fun> self_t; public: typedef mlc::true_ is_computed_type; Index: oln/morpher/slice.hh =================================================================== --- oln/morpher/slice.hh (revision 712) +++ oln/morpher/slice.hh (working copy) @@ -61,6 +61,7 @@ }; + /// Virtual types associated to oln::morpher::slice<Image> /// \{ template <typename Image> @@ -69,28 +70,24 @@ private: typedef morpher::slice<Image> self_t; - typedef oln_deduce_type_of(Image, grid, dimvalue) orig_dimvalue_type; + typedef oln_deduce_vtype(Image, grid, dimvalue) orig_dimvalue_type; typedef mlc::uint_< mlc_value(orig_dimvalue_type) - 1 > dimvalue_type; - typedef oln_type_of(Image, fwd_piter) orig_fwd_piter; - typedef oln_type_of(Image, bkd_piter) orig_bkd_piter; - typedef oln_type_of(Image, fwd_qiter) orig_fwd_qiter; - typedef oln_type_of(Image, bkd_qiter) orig_bkd_qiter; + typedef oln_vtype(Image, fwd_piter) orig_fwd_piter; + typedef oln_vtype(Image, bkd_piter) orig_bkd_piter; + typedef oln_vtype(Image, fwd_qiter) orig_fwd_qiter; + typedef oln_vtype(Image, bkd_qiter) orig_bkd_qiter; public: typedef typename - type_fun::slice_topo< oln_type_of(Image, topo) >::ret topo_type; + type_fun::slice_topo< oln_vtype(Image, topo) >::ret topo_type; - typedef grid_<mlc_value(orig_dimvalue_type) - 1> grid_type; + typedef typename point_< mlc_value(dimvalue_type), + oln_deduce_vtype(Image, point, coord) >::ret point_type; + typedef point_type psite_type; + // FIXME: A better (when overriding is involved) is oln_deferred_vtype(self_t, point). - // psite_type: see below. - typedef typename - point_< mlc_value(dimvalue_type), - oln_deduce_type_of(Image, point, coord) >::ret - point_type; - - // piter_type: see below. - + typedef oln_is_computed(Image) is_computed_type; typedef oln_value(Image) value_type; // rvalue_type: see below. // lvalue_type: see below. @@ -104,8 +101,6 @@ typedef oln::morpher::tag::slice morpher_type; // Final. - typedef oln_deduce(Image, point, coord) coord_type; - typedef oln_point(self_t) psite_type; typedef oln_fwd_piter(Image) piter_type; typedef oln_rvalue(Image) rvalue_type; typedef oln_lvalue(Image) lvalue_type; @@ -127,15 +122,15 @@ { typedef slice<Image> self_t; - typedef oln_type_of(self_t, topo) topo_t; - typedef oln_type_of(self_t, rvalue) rvalue_t; - typedef oln_type_of(self_t, lvalue) lvalue_t; - typedef oln_type_of(self_t, point) point_t; + typedef oln_vtype(self_t, topo) topo_t; + typedef oln_vtype(self_t, rvalue) rvalue_t; + typedef oln_vtype(self_t, lvalue) lvalue_t; + typedef oln_vtype(self_t, point) point_t; - typedef oln_type_of(Image, topo) orig_topo_t; - typedef oln_type_of(Image, point) orig_point_t; + typedef oln_vtype(Image, topo) orig_topo_t; + typedef oln_vtype(Image, point) orig_point_t; - typedef oln_deduce_type_of(Image, point, coord) coord_t; + typedef oln_deduce_vtype(Image, point, coord) coord_t; public: Index: oln/morpher/with_lut.hh =================================================================== --- oln/morpher/with_lut.hh (revision 712) +++ oln/morpher/with_lut.hh (working copy) @@ -60,7 +60,7 @@ struct vtypes< morpher::with_lut<Image, Lut> > { private: - typedef oln_type_of(Image, rvalue) orig_value_type; + typedef oln_vtype(Image, rvalue) orig_value_type; typedef morpher::with_lut<Image, Lut> self_t; public: typedef mlc::true_ is_computed_type; @@ -68,7 +68,6 @@ // Value type. typedef typename Lut::new_value_type value_type; typedef value_type rvalue_type; - typedef mlc::not_ok lvalue_type; // Look-up table type. typedef Lut lut_type; @@ -103,11 +102,11 @@ public: typedef Lut lut_type; - typedef oln_type_of(self_t, value) value_type; - typedef oln_type_of(self_t, rvalue) rvalue_type; - typedef oln_type_of(self_t, psite) psite_type; - typedef oln_type_of(self_t, value_proxy) value_proxy_type; - typedef oln_type_of(self_t, mutable_value_proxy) mutable_value_proxy_type; + typedef oln_vtype(self_t, value) value_type; + typedef oln_vtype(self_t, rvalue) rvalue_type; + typedef oln_vtype(self_t, psite) psite_type; + typedef oln_vtype(self_t, value_proxy) value_proxy_type; + typedef oln_vtype(self_t, mutable_value_proxy) mutable_value_proxy_type; public: with_lut(const Image& image, const Lut& lut); Index: oln/morpher/thru_mfun.hh =================================================================== --- oln/morpher/thru_mfun.hh (revision 712) +++ oln/morpher/thru_mfun.hh (working copy) @@ -59,7 +59,7 @@ struct vtypes< morpher::thru_mfun<Image, Fun> > { private: - typedef oln_type_of(Image, rvalue) old_value_type; + typedef oln_vtype(Image, rvalue) old_value_type; typedef morpher::thru_mfun<Image, Fun> self_t; public: typedef mlc::false_ is_computed_type; Index: oln/morpher/internal/image_value_morpher.hh =================================================================== --- oln/morpher/internal/image_value_morpher.hh (revision 712) +++ oln/morpher/internal/image_value_morpher.hh (working copy) @@ -48,27 +48,30 @@ } // end of namespace oln::morpher - /// Create an ``uplink'' from - /// oln::morpher::internal::image_value_morpher to the morphed \a Image, - /// so as to get all its virtual types. + /// Super type. template <typename Image, typename Exact> - struct - set_pseudosuper_type< morpher::internal::image_value_morpher<Image, Exact> > + struct set_super_type< morpher::internal::image_value_morpher<Image, Exact> > { - typedef Image ret; + typedef oln::image_entry<Exact> ret; }; + /// Vtypes. template <typename Image, typename Exact> struct vtypes< morpher::internal::image_value_morpher<Image, Exact> > { // Morpher type. typedef oln::morpher::tag::identity morpher_type; // FIXME: Wrong! - typedef mlc::not_found is_computed_type; - typedef mlc::not_found value_type; - typedef mlc::not_found lvalue_type; - typedef mlc::not_found rvalue_type; + typedef stc::not_delegated is_computed_type; + typedef stc::not_delegated value_type; + typedef stc::not_delegated lvalue_type; + typedef stc::not_delegated rvalue_type; + + /// Create an ``uplink'' from + /// oln::morpher::internal::image_value_morpher to the morphed \a Image, + /// so as to get all its virtual types. + typedef Image delegatee_type; }; Index: oln/morpher/internal/image_extension.hh =================================================================== --- oln/morpher/internal/image_extension.hh (revision 712) +++ oln/morpher/internal/image_extension.hh (working copy) @@ -48,22 +48,26 @@ } // end of namespace oln::morpher - /// Create an ``uplink'' from - /// oln::morpher::internal::image_extension to the morphed \a Image, - /// so as to get all its virtual types. + /// Super type. template <typename Image, typename Exact> - struct - set_pseudosuper_type< morpher::internal::image_extension<Image, Exact> > + struct set_super_type< morpher::internal::image_extension<Image, Exact> > { - typedef Image ret; + typedef oln::image_entry<Exact> ret; }; + /// Vtypes. template <typename Image, typename Exact> struct vtypes< morpher::internal::image_extension<Image, Exact> > { // Morpher type. typedef oln::morpher::tag::identity morpher_type; + + /// Delegatee type: + /// Create an ``uplink'' from + /// oln::morpher::internal::image_extension to the morphed \a Image, + /// so as to get all its virtual types. + typedef Image delegatee_type; }; Index: oln/morpher/add_neighborhood.hh =================================================================== --- oln/morpher/add_neighborhood.hh (revision 712) +++ oln/morpher/add_neighborhood.hh (working copy) @@ -58,7 +58,7 @@ struct vtypes< morpher::add_neighborhood<Image, Neighb> > { // Topology type. - typedef topo_add_nbh< oln_type_of(Image, topo), Neighb > topo_type; + typedef topo_add_nbh< oln_vtype(Image, topo), Neighb > topo_type; // Neighborhood type. typedef Neighb neighborhood_type; @@ -103,7 +103,7 @@ super_t(image), topo_(image.topo(), nbh) { - mlc::assert_equal_<oln_type_of(Image, grid), oln_type_of(Neighb, grid)>::check(); + mlc::assert_equal_<oln_vtype(Image, grid), oln_vtype(Neighb, grid)>::check(); // FIXME: check that Image is without a nbh } @@ -132,7 +132,7 @@ operator + (const abstract::image<I>& image, const abstract::neighborhood<N>& nbh) { - mlc::assert_equal_<oln_type_of(I, grid), oln_type_of(N, grid)>::check(); + 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;
18Â years, 1Â month
1
0
0
0
713: stc/scoop.hh: Convert to Unix line terminators.
by Roland Levillain
https://svn.lrde.epita.fr/svn/oln/trunk/static
Index: ChangeLog from Roland Levillain <roland(a)lrde.epita.fr> * stc/scoop.hh: Convert to Unix line terminators. 0 files changed Index: stc/scoop.hh
18Â years, 1Â month
1
0
0
0
712: Rewrite stc/scoop.hh.
by Thierry GERAUD
2006-11-30 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr> * stc/scoop.hh (stc_scoop_equipment_for_namespace): Rewrite. Index: stc/scoop.hh =================================================================== --- stc/scoop.hh (revision 711) +++ stc/scoop.hh (working copy) @@ -1,325 +1,835 @@ -// Copyright (C) 2005, 2006 EPITA Research and Development Laboratory -// -// This file is part of the Olena Library. This library is free -// software; you can redistribute it and/or modify it under the terms -// of the GNU General Public License version 2 as published by the -// Free Software Foundation. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this library; see the file COPYING. If not, write to -// the Free Software Foundation, 51 Franklin Street, Fifth Floor, -// Boston, MA 02111-1307, USA. -// -// As a special exception, you may use this file as part of a free -// software library without restriction. Specifically, if other files -// instantiate templates or use macros or inline functions from this -// file, or you compile this file and link it with other files to -// produce an executable, this file does not by itself cause the -// resulting executable to be covered by the GNU General Public -// License. This exception does not however invalidate any other -// reasons why the executable file might be covered by the GNU General -// Public License. - -/* \file stc/vtypes.hh - - \brief Equipment for SCOOP: notably, Virtual types (also known as - ``properties'') mechanism. - - Based on Theo's presentation from January 2006 (olena-06-jan.pdf). */ - -#ifndef STC_SCOOP_HH -# define STC_SCOOP_HH - -# include <mlc/flags.hh> -# include <mlc/typedef.hh> -# include <mlc/ret.hh> - -# include <mlc/assert.hh> -# include <mlc/abort.hh> - -# include <mlc/bool.hh> - -# include <mlc/cmp.hh> -# include <mlc/if.hh> -# include <mlc/is_a.hh> - - -namespace stc -{ - - /// Error messages raised by static assertions/abortions. - namespace ERROR - { - - /// Errors from check_type_of_ and check_exact_type_of_. - /// \{ - struct VIRTUAL_TYPE_NOT_FOUND; - /// \} - - } // end of namespace stc::ERROR - -} // end of namespace stc - - - -# define stc_internal_get_typedef(Type, TypedefName) \ - typename TypedefName::template from_< Type >::ret - - -# define stc_internal_get_super(Type) \ - typename typedef_::super_type::template from_< Type >::ret - - - - - - -# define stc_scoop_equipment_for_namespace(SCOOPED_NAMESPACE) \ - \ -namespace SCOOPED_NAMESPACE \ -{ \ - \ - template <typename from_type> \ - struct set_super_type \ - { \ - typedef mlc::none ret; \ - }; \ - \ - template <typename type> \ - struct set_pseudosuper_type \ - { \ - typedef mlc::not_found ret; \ - }; \ - \ - template <typename from_type> \ - struct vtypes \ - { \ - }; \ - \ - template <typename from_type, typename type> \ - struct single_vtype \ - { \ - typedef mlc::not_found ret; \ - }; \ - \ - \ - namespace internal \ - { \ - \ - /* retrieve_from_single_vtype */ \ - \ - template <typename from_type, typename type> \ - struct retrieve_from_single_vtype; \ - \ - template <typename res, typename super, typename type> \ - struct helper_retrieve_from_single_vtype \ - { \ - typedef res ret; \ - }; \ - \ - template <typename super, typename type> \ - struct helper_retrieve_from_single_vtype < mlc::not_found, super, type > \ - { \ - typedef typename retrieve_from_single_vtype<super, type>::ret ret; \ - }; \ - \ - template <typename type> \ - struct helper_retrieve_from_single_vtype < mlc::not_found, mlc::none, type > \ - { \ - typedef mlc::not_found ret; \ - }; \ - \ - template <typename type> \ - struct helper_retrieve_from_single_vtype < mlc::not_found, mlc::not_found, type > \ - { \ - }; \ - \ - template <typename from_type, typename type> \ - struct retrieve_from_single_vtype \ - { \ - typedef SCOOPED_NAMESPACE::single_vtype<from_type, type> decl; \ - typedef typename decl::ret res; \ - typedef typename set_super_type<from_type>::ret super; \ - typedef typename helper_retrieve_from_single_vtype< res, super, type >::ret ret; \ - }; \ - \ - /* vtypes */ \ - \ - template <typename from_type, typename type> \ - struct retrieve_from_vtypes; \ - \ - template <typename res, typename super, typename type> \ - struct helper_retrieve_from_vtypes \ - { \ - typedef res ret; \ - }; \ - \ - template <typename super, typename type> \ - struct helper_retrieve_from_vtypes < mlc::not_found, super, type > \ - { \ - typedef typename retrieve_from_vtypes<super, type>::ret ret; \ - }; \ - \ - template <typename type> \ - struct helper_retrieve_from_vtypes < mlc::not_found, mlc::none, type > \ - { \ - typedef mlc::not_found ret; \ - }; \ - \ - template <typename type> \ - struct helper_retrieve_from_vtypes < mlc::not_found, mlc::not_found, type > \ - { \ - }; \ - \ - template <typename from_type, typename type> \ - struct retrieve_from_vtypes \ - { \ - typedef SCOOPED_NAMESPACE::vtypes<from_type> decl; \ - typedef stc_internal_get_typedef(decl, type) res; \ - typedef typename set_super_type<from_type>::ret super; \ - typedef typename helper_retrieve_from_vtypes< res, super, type >::ret ret; \ - }; \ - \ - /* pseudo super */ \ - \ - template <typename from_type> \ - struct retrieve_pseudosuper; \ - \ - template <typename res, typename super> \ - struct helper_retrieve_pseudosuper \ - { \ - typedef res ret; \ - }; \ - \ - template <typename super> \ - struct helper_retrieve_pseudosuper < mlc::not_found, super > \ - { \ - typedef typename retrieve_pseudosuper<super>::ret ret; \ - }; \ - \ - template <> \ - struct helper_retrieve_pseudosuper < mlc::not_found, mlc::none > \ - { \ - typedef mlc::not_found ret; \ - }; \ - \ - template <> \ - struct helper_retrieve_pseudosuper < mlc::not_found, mlc::not_found > \ - { \ - }; \ - \ - template <typename from_type> \ - struct retrieve_pseudosuper \ - { \ - typedef typename set_pseudosuper_type<from_type>::ret res; \ - typedef typename set_super_type<from_type>::ret super; \ - typedef typename helper_retrieve_pseudosuper< res, super >::ret ret; \ - }; \ - \ - /* scoop_vtype_of */ \ - \ - template <typename from_type, typename type> \ - struct step_from_vtypes; /* fwd decl of main entry */ \ - \ - /* step 3 <=> delegation */ \ - \ - template <typename from_type, typename type> \ - struct helper_step_from_delegation \ - { \ - /* REC */ \ - typedef typename step_from_vtypes<from_type, type>::ret ret; \ - }; \ - \ - template <typename type> \ - struct helper_step_from_delegation < mlc::not_found, type > \ - { \ - typedef mlc::not_found ret; \ - }; \ - \ - template <typename from_type, typename type> \ - struct step_from_delegation /* step 3 entry */ \ - { \ - typedef typename retrieve_pseudosuper<from_type>::ret pseudo_type; \ - typedef typename helper_step_from_delegation<pseudo_type, type>::ret ret; \ - }; \ - \ - /* step 2 <=> single_vtype */ \ - \ - template <typename res, typename from_type, typename type> \ - struct helper_step_from_single_vtype \ - { \ - typedef res ret; /* found! */ \ - }; \ - \ - template <typename from_type, typename type> \ - struct helper_step_from_single_vtype <mlc::not_found, /* => step 3 */ \ - from_type, type> \ - { \ - typedef typename step_from_delegation<from_type, type>::ret ret; \ - }; \ - \ - template <typename from_type, typename type> \ - struct helper_step_from_single_vtype <mlc::undefined, /* => step 3 */ \ - from_type, type> \ - { \ - typedef typename step_from_delegation<from_type, type>::ret ret; \ - }; \ - \ - template <typename from_type, typename type> \ - struct step_from_single_vtype /* step 2 entry */ \ - { \ - typedef typename retrieve_from_single_vtype<from_type, type>::ret res; \ - typedef typename helper_step_from_single_vtype< res, from_type, type>::ret ret; \ - }; \ - \ - /* step 1 <=> vtypes */ \ - \ - template <typename res, typename from_type, typename type> \ - struct helper_step_from_vtypes \ - { \ - typedef res ret; /* found! */ \ - }; \ - \ - template <typename from_type, typename type> \ - struct helper_step_from_vtypes <mlc::not_found, /* => step 2 */ \ - from_type, type> \ - { \ - typedef typename step_from_single_vtype<from_type, type>::ret ret; \ - }; \ - \ - template <typename from_type, typename type> \ - struct helper_step_from_vtypes <mlc::undefined, /* => step 2 */ \ - from_type, type> \ - { \ - typedef typename step_from_single_vtype<from_type, type>::ret ret; \ - }; \ - \ - template <typename from_type, typename type> \ - struct step_from_vtypes /* main entry (so step 1 entry) */ \ - { \ - typedef typename retrieve_from_vtypes<from_type, type>::ret res; \ - typedef typename helper_step_from_vtypes< res, from_type, type>::ret ret; \ - }; \ - \ - } /* end of namespace SCOOPED_NAMESPACE ::internal */ \ - \ - \ - template <typename from_type, typename type> \ - struct direct_type_of_ \ - { \ - typedef typename internal::step_from_vtypes<from_type, type>::ret ret; \ - }; \ - \ - \ -} /* end of namespace SCOOPED_NAMESPACE */ \ - \ -struct e_n_d__w_i_t_h___s_e_m_i_c_o_l_o_n - - - -#endif // ! STC_SCOOP_HH +// Copyright (C) 2005, 2006 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +/* \file stc/vtypes.hh + + \brief Equipment for SCOOP: notably, Virtual types (also known as + ``properties'') mechanism. + + Based on Theo's presentation from January 2006 (olena-06-jan.pdf). */ + +#ifndef STC_SCOOP_HH +# define STC_SCOOP_HH + +# include <mlc/flags.hh> +# include <mlc/typedef.hh> +# include <mlc/ret.hh> +# include <mlc/assert.hh> +# include <mlc/abort.hh> +# include <mlc/bool.hh> +# include <mlc/pair.hh> +# include <mlc/cmp.hh> +# include <mlc/if.hh> +# include <mlc/is_a.hh> + + +namespace stc +{ + + struct not_delegated; + + struct abstract; + + template <typename T> + struct final; + +} // end of namespace stc + + + +#define stc_super(T) typename set_super_type< T >::ret +#define stc_stm(From, Target) typename get_stm< From , Target >::ret + + +# define stc_scoop_equipment_for_namespace(SCOOPED_NAMESPACE) \ + \ + \ +namespace SCOOPED_NAMESPACE \ +{ \ + \ + mlc_decl_typedef(delegatee_type); \ + \ + \ + template <typename from_type> \ + struct set_super_type \ + { \ + typedef mlc::none ret; \ + /* FIXME: nothing here! \ + * \ + * mlc::none is not a default value \ + * so that the client should define stoppers \ + */ \ + }; \ + \ + template <typename from_type> \ + struct vtypes \ + { \ + }; \ + \ + template <typename from_type, typename type> \ + struct single_vtype \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + \ + \ + namespace ERROR \ + { \ + \ + template < typename first_definition, \ + typename re_definition, \ + typename target > \ + struct final_vtype_redefined_; \ + \ + \ + template < typename first_definition, \ + typename declaration, \ + typename target > \ + struct vtype_declared_but_already_set_; \ + \ + \ + template < typename from, \ + typename target > \ + struct vtype_not_found; \ + \ + \ + template < typename curr, \ + typename target, \ + typename stm > \ + struct wrong_final_stm_; \ + \ + \ + template < typename target, \ + typename declaration, \ + typename from > \ + struct vtype_declared_but_not_defined; \ + \ + \ + template <typename T> \ + struct _declaration_is_in_; \ + \ + template <typename T> \ + struct _definition_is_looked_up_from_; \ + \ + \ + template <typename T> \ + struct _for_vtype_; \ + \ + \ + struct no_delegatee_declared_; \ + \ + \ + } /* end of namespace SCOOPED_NAMESPACE::ERROR */ \ + \ + \ + \ + namespace internal \ + { \ + \ + \ + /* \ + * Forward declarations. \ + */ \ + \ + \ + template <typename from, typename target> \ + struct get_stm; \ + \ + template <typename res1, typename res2> \ + struct helper_get_stm; \ + \ + template <typename from, typename target> \ + struct first_stm; \ + \ + template <typename curr, typename target, typename stm> \ + struct helper_first_stm; \ + \ + \ + template <typename from, typename target, typename curr = from> \ + struct superior_find; \ + \ + template <typename from, typename target, typename curr, typename stm> \ + struct helper_superior_find; \ + \ + template <typename from, typename target> \ + struct delegator_find; \ + \ + template <typename from, typename target, typename delegatee> \ + struct helper_delegator_find; \ + \ + template <typename from, typename target> \ + struct find; \ + \ + template <typename from, typename target, typename where, typename res> \ + struct helper_find; \ + \ + \ + \ + template <typename from, typename target> \ + struct check; \ + \ + template <typename curr, typename target, typename stm> \ + struct helper_check; \ + \ + \ + \ + /* get_stm(from, target) \ + * \ + * Returns the statement for class 'from' corresponding to 'target'. \ + * This statement is either defined in 'vtypes' or in 'single_vtype'. \ + * \ + * This routine is local; it does not recourse on superior classes. \ + * \ + */ \ + \ + template <typename res1> \ + struct helper_get_stm <res1, mlc::not_found> \ + { \ + typedef res1 ret; \ + }; \ + \ + template <typename res2> \ + struct helper_get_stm <mlc::not_found, res2> \ + { \ + typedef res2 ret; \ + }; \ + \ + template <> \ + struct helper_get_stm <mlc::not_found, mlc::not_found> \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + template <typename res1, typename res2> \ + struct helper_get_stm \ + { \ + /* error */ \ + }; \ + \ + template <typename from, typename target> \ + struct get_stm \ + { \ + typedef SCOOPED_NAMESPACE::vtypes<from> decl1; \ + typedef typename target::template from_<decl1>::ret res1; \ + \ + typedef SCOOPED_NAMESPACE::single_vtype<from, target> decl2; \ + typedef typename decl2::ret ret2; \ + \ + typedef typename helper_get_stm<res1, ret2>::ret ret; \ + }; \ + \ + \ + \ + \ + /* \ + * check_no_final_inherited \ + * \ + * FIXME: ... \ + */ \ + \ + template < typename orig, typename curr, typename target, \ + typename stm = typename get_stm<curr, target>::ret > \ + struct check_no_final_inherited \ + \ + : mlc::assert_< mlc_is_not_a(stm, stc::final), \ + ERROR::final_vtype_redefined_< orig, \ + mlc::pair_<curr, stm>, \ + target > \ + >, \ + /* rec */ check_no_final_inherited<orig, stc_super(curr), target> \ + { \ + }; \ + \ + template <typename orig, typename target, typename stm> \ + struct check_no_final_inherited <orig, /* if curr == */ mlc::none, target, stm> \ + { \ + }; \ + \ + \ + /* \ + * check_no_stm_inherited \ + * \ + * FIXME: ... \ + */ \ + \ + template < typename orig, typename curr, typename target, \ + typename stm = typename get_stm<curr, target>::ret > \ + struct check_no_stm_inherited \ + \ + : mlc::assert_< mlc::is_not_found_<stm>, \ + ERROR::vtype_declared_but_already_set_< orig, \ + mlc::pair_<curr, stm>, \ + target > \ + >, \ + /* rec */ check_no_stm_inherited<orig, stc_super(curr), target> \ + { \ + }; \ + \ + template <typename orig, typename target, typename stm> \ + struct check_no_stm_inherited <orig, /* if curr == */ mlc::none, target, stm> \ + { \ + }; \ + \ + \ + /* \ + * check_delegatee_inherited \ + */ \ + \ + template <typename curr, typename target> \ + struct check_delegatee_inherited \ + : mlc::assert_< mlc::is_found_< typename first_stm<curr, \ + typedef_::delegatee_type>::ret::second_elt >, \ + ERROR::no_delegatee_declared_ > \ + { \ + }; \ + \ + \ + /* \ + * check_final_stm \ + */ \ + \ + template <typename curr, typename target, typename stm> \ + struct check_final_stm \ + {}; \ + \ + template <typename curr, typename target> \ + struct check_final_stm < curr, target, stc::abstract > \ + : mlc::abort_< ERROR::wrong_final_stm_<curr, target, stc::final<stc::abstract> > > \ + {}; \ + \ + template <typename curr, typename target, typename T> \ + struct check_final_stm < curr, target, stc::final<T> > \ + : mlc::abort_< ERROR::wrong_final_stm_<curr, target, stc::final<stc::final<T> > > > \ + {}; \ + \ + template <typename curr, typename target> \ + struct check_final_stm < curr, target, stc::not_delegated > \ + : mlc::abort_< ERROR::wrong_final_stm_<curr, target, stc::final<stc::not_delegated> > > \ + {}; \ + \ + template <typename curr, typename target> \ + struct check_final_stm < curr, target, mlc::not_found > \ + : mlc::abort_< ERROR::wrong_final_stm_<curr, target, stc::final<mlc::not_found> > > \ + {}; \ + \ + \ + \ + \ + /* \ + * check(from, target) \ + * \ + * pseudo-code: \ + * \ + * check(from, target) \ + * { \ + * if (from == mlc::none) // stop because no more class \ + * return done; \ + * else \ + * return helper_check(from, target, get_stm(from, target)); \ + * } \ + */ \ + \ + struct dummy {}; \ + \ + template <typename target> \ + struct check < /* if from == */ mlc::none, target > \ + { \ + typedef dummy ret; \ + }; \ + \ + template <typename from, typename target> \ + struct check /* otherwise */ \ + { \ + typedef typename helper_check< from, target, \ + stc_stm(from, target) >::ret ret; \ + }; \ + \ + \ + \ + \ + /* \ + * pseudo-code: \ + * \ + * helper_check(curr, target, stm) \ + * { \ + * super = super(curr); \ + * \ + * if (stm == stc::abstract) { \ + * check_no_stm_inherited(curr, super, target); \ + * return check(super, target); \ + * } \ + * if (stm == stc::final<T>) { \ + * check_final_stm(T); \ + * check_no_final_inherited((curr, T), super, target); \ + * return check(super, target); \ + * } \ + * if (stm == stc::not_delegated) { \ + * check_delegatee_inherited(curr); \ + * check_no_final_inherited((curr, stc::not_delegated), super, target); \ + * return check(super, target); \ + * } \ + * if (stm == mlc::not_found) { \ + * return check(super, target); \ + * } \ + * // otherwise, non-final stm: \ + * if (stm == T) { \ + * check_no_final_inherited((curr, T), super, target); \ + * return check(super, target); \ + * } \ + * } \ + * \ + */ \ + \ + template <typename curr, typename target> \ + struct helper_check < curr, target, \ + /* if stm == */ stc::abstract > \ + : check_no_stm_inherited< mlc::pair_<curr, stc::abstract >, \ + stc_super(curr), \ + target > \ + { \ + typedef typename check<stc_super(curr), target>::ret ret; \ + }; \ + \ + template <typename curr, typename target, typename T> \ + struct helper_check < curr, target, \ + /* if stm == */ stc::final<T> > \ + : check_no_final_inherited< mlc::pair_<curr, stc::final<T> >, \ + stc_super(curr), \ + target > \ + { \ + /* FIXME: \ + check_final_stm(T); \ + */ \ + typedef typename check<stc_super(curr), target>::ret ret; \ + }; \ + \ + template <typename curr, typename target> \ + struct helper_check < curr, target, \ + /* if stm == */ stc::not_delegated > \ + : check_no_final_inherited< mlc::pair_<curr, stc::not_delegated>, \ + stc_super(curr), \ + target > \ + { \ + /* FIXME: \ + check_delegatee_inherited(curr); \ + */ \ + typedef typename check<stc_super(curr), target>::ret ret; \ + }; \ + \ + template <typename curr, typename target> \ + struct helper_check < curr, target, \ + /* if stm == */ mlc::not_found > \ + { \ + typedef typename check<stc_super(curr), target>::ret ret; \ + }; \ + \ + template <typename curr, typename target, typename stm> \ + struct helper_check /* otherwise, non-final stm */ \ + : check_no_final_inherited< mlc::pair_<curr, stm>, \ + stc_super(curr), \ + target > \ + { \ + typedef typename check<stc_super(curr), target>::ret ret; \ + }; \ + \ + \ + \ + \ + /* \ + * first_stm(from, target) \ + * \ + * returns a pair (Where, Value) with Value being: \ + * - stc::abstract \ + * - stc::not_delegated \ + * - mlc::not_found \ + * - a type T \ + * and Where being the class where the stm is found. \ + * \ + * \ + * helper_first_stm(curr, target, stm) \ + * { \ + * if (stm == mlc::not_found) \ + * return first_stm(super(curr), target); \ + * else if (stm == stc::final<T>) \ + * return pair(curr, T); \ + * else \ + * return pair(curr, stm); \ + * } \ + * \ + * first_stm(from, target) \ + * { \ + * if (from == mlc::none) \ + * return pair(mlc::none, mlc::not_found); \ + * else \ + * return helper_first_stm(from, target, \ + * get_stm(from, target)); \ + * } \ + * \ + */ \ + \ + template <typename curr, typename target> \ + struct helper_first_stm < curr, target, \ + /* if stm == */ mlc::not_found > \ + { \ + typedef typename first_stm<stc_super(curr), target>::ret ret; \ + }; \ + \ + template <typename curr, typename target, typename T> \ + struct helper_first_stm < curr, target, \ + /* if stm == */ stc::final<T> > \ + { \ + typedef mlc::pair_<curr, T> ret; \ + }; \ + \ + template <typename curr, typename target, typename stm> \ + struct helper_first_stm /* otherwise */ \ + { \ + typedef mlc::pair_<curr, stm> ret; \ + }; \ + \ + template <typename target> \ + struct first_stm < /* if from == */ mlc::none, target > \ + { \ + typedef mlc::pair_<mlc::none, mlc::not_found> ret; \ + }; \ + \ + template <typename from, typename target> \ + struct first_stm /* otherwise */ \ + { \ + typedef typename helper_first_stm<from, target, \ + stc_stm(from, target)>::ret ret; \ + }; \ + \ + \ + \ + /* \ + * superior_find(from, target) \ + * \ + * returns: \ + * either mlc::not_found \ + * or a type T \ + * behavior: \ + * - the stm stc::not_delegated is ignored \ + * - error when stc::abstract is reached \ + * \ + * helper_superior_find(from, target, curr, stm) \ + * { \ + * if (stm == stc::abstract) \ + * error("<target> declared in <curr> but not defined at <from>"); \ + * else if (stm == mlc::not_found or \ + * stm == stc::not_delegated) \ + * return superior_find(from, target, super(curr)); \ + * else if (stm == stc::final<T>) \ + * return T; \ + * else \ + * return stm; \ + * } \ + * \ + * superior_find(from, target, curr = from) \ + * { \ + * if (curr == mlc::none) \ + * return mlc::not_found; \ + * else \ + * return helper_superior_find(from, target, curr, \ + * get_stm(curr, target)); \ + * } \ + */ \ + \ + template <typename from, typename target, typename curr> \ + struct helper_superior_find < from, target, curr, \ + /* if stm == */ stc::abstract > \ + { \ + /* FIXME: error("<target> declared in <curr> but not defined at <from>"); */ \ + }; \ + \ + template <typename from, typename target, typename curr> \ + struct helper_superior_find < from, target, curr, \ + /* if stm == */ mlc::not_found > \ + { \ + typedef typename superior_find< from, target, \ + stc_super(curr) >::ret ret; \ + }; \ + \ + template <typename from, typename target, typename curr> \ + struct helper_superior_find < from, target, curr, \ + /* if stm == */ stc::not_delegated > \ + { \ + typedef typename superior_find< from, target, \ + stc_super(curr) >::ret ret; \ + }; \ + \ + template <typename from, typename target, typename curr, typename T> \ + struct helper_superior_find < from, target, curr, \ + /* if stm == */ stc::final<T> > \ + { \ + typedef T ret; \ + }; \ + \ + template <typename from, typename target, typename curr, typename stm> \ + struct helper_superior_find /* otherwise */ \ + { \ + typedef stm ret; \ + }; \ + \ + template <typename from, typename target> \ + struct superior_find < from, target, /* if curr == */ mlc::none > \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + template <typename from, typename target, typename curr> \ + struct superior_find /* otherwise */ \ + { \ + typedef typename helper_superior_find<from, target, curr, \ + stc_stm(curr, target)>::ret ret; \ + }; \ + \ + \ + \ + /* \ + * delegator_find(from, target) \ + * \ + * \ + * delegator_find(from, target) \ + * { \ + * precondition(target != delegatee_type); \ + * delegatee = superior_find(from, delegatee_type); \ + * if (delegatee == mlc::not_found) \ + * return mlc::not_found; \ + * else \ + * return find(delegatee, target); \ + * } \ + */ \ + \ + template <typename from, typename target> \ + struct helper_delegator_find < from, target, \ + /* if delegatee == */ mlc::not_found > \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + template <typename from, typename target, typename delegatee> \ + struct helper_delegator_find /* otherwise */ \ + { \ + typedef typename find<delegatee, target>::ret ret; \ + }; \ + \ + template <typename from, typename target> \ + struct delegator_find \ + { \ + typedef typename superior_find<from, typedef_::delegatee_type>::ret delegatee; \ + typedef typename helper_delegator_find<from, target, delegatee>::ret ret; \ + }; \ + \ + \ + \ + /* \ + * helper_find(from, target, where, res) \ + * \ + * \ + * \ + */ \ + \ + template <typename from, typename target, typename where> \ + struct helper_find < from, target, where, \ + /* if res == */ mlc::not_found > \ + { \ + typedef typename delegator_find<from, target>::ret ret; \ + }; \ + \ + template <typename from, typename target, typename where> \ + struct helper_find < from, target, where, \ + /* if res == */ stc::abstract > \ + { \ + typedef typename delegator_find<from, target>::ret res_d; \ + struct check_ \ + : mlc::assert_< mlc::is_found_<res_d>, \ + ERROR::vtype_declared_but_not_defined \ + < ERROR::_for_vtype_<target>, \ + ERROR::_declaration_is_in_<where>, \ + ERROR::_definition_is_looked_up_from_<from> > > \ + /* FIXME: error("<target> declared in <where> but not defined at <from>"); */ \ + { \ + typedef res_d ret; \ + }; \ + typedef typename check_::ret ret; \ + }; \ + \ + template <typename from, typename target, typename where> \ + struct helper_find < from, target, where, \ + /* if res == */ stc::not_delegated > \ + { \ + typedef typename superior_find<from, target>::ret ret; \ + }; \ + \ + template <typename from, typename target, typename where, typename res> \ + struct helper_find /* otherwise */ \ + { \ + typedef res ret; \ + }; \ + \ + \ + \ + /* \ + * find(from, target) \ + * \ + * FIXME: ... \ + * \ + * find(from, target) \ + * { \ + * if (target == delegatee_type) \ + * return superior_find(from, delegatee_type); \ + * else \ + * return helper_find(from, target); \ + * } \ + */ \ + \ + template <typename from> \ + struct find <from, /* if target == */ typedef_::delegatee_type > \ + { \ + typedef typename superior_find<from, typedef_::delegatee_type>::ret ret; \ + }; \ + \ + template <typename from, typename target> \ + struct find /* otherwise */ \ + { \ + typedef typename first_stm<from, target>::ret stm; \ + typedef mlc_elt(stm, 1) where; \ + typedef mlc_elt(stm, 2) res; \ + typedef typename helper_find<from, target, \ + where, res>::ret ret; \ + }; \ + \ + \ + } /* end of SCOOPED_NAMESPACE::internal */ \ + \ + \ + /* \ + * find_vtype(from, target) \ + * \ + * FIXME:... \ + * \ + */ \ + \ + template <typename from, typename target> \ + struct deferred_vtype \ + { \ + typedef typename internal::find<from, target>::ret ret; \ + }; \ + \ + template <typename from, typename target> \ + struct find_vtype \ + { \ + typedef typename internal::find<from, target>::ret ret; \ + typedef typename internal::check<from, target>::ret chk; \ + }; \ + \ + 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; + + + +# define stc_find_vtype_(Namespace, From, Target) \ + Namespace::find_vtype<From, Namespace::typedef_::Target##_type>::ret + +# define stc_find_vtype(Namespace, From, Target) \ + typename stc_find_vtype_(Namespace, From, Target) + + + +# define stc_deferred_vtype(Namespace, From, Target) \ + typename Namespace::deferred_vtype<From, Namespace::typedef_::Target##_type>::ret + + + +# 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, Target) \ + 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) \ + typename \ + Namespace::deferred_vtype< typename \ + Namespace::deferred_vtype<From, \ + Namespace::typedef_::Target1##_type>::ret, \ + Namespace::typedef_::Target2##_type>::ret \ + + + +# 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 + + + + + +// # define stc_vtype_is_found_(Namespace, From, Target) +// mlc::is_found_< Namespace::find_vtype<From, Namespace::typedef_::Target##_type>::ret > + + +#endif // ! STC_SCOOP_HH
18Â years, 1Â month
1
0
0
0
711: Fix inheritance in mlc/uint.hh.
by Thierry GERAUD
2006-11-30 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr> * mlc/uint.hh: Fix inheritance. Index: mlc/uint.hh =================================================================== --- mlc/uint.hh (revision 710) +++ mlc/uint.hh (working copy) @@ -28,7 +28,7 @@ #ifndef MLC_UINT_HH # define MLC_UINT_HH -# include <mlc/bool.hh> +# include <mlc/bexpr.hh> namespace mlc @@ -37,27 +37,27 @@ // FIXME: doc and complete code... template <unsigned lvalue, unsigned rvalue> - struct uint_equal_ : public bool_<( lvalue == rvalue )> + struct uint_equal_ : public bexpr_<( lvalue == rvalue )> {}; template <unsigned lvalue, unsigned rvalue> - struct uint_not_equal_ : public bool_<( lvalue != rvalue )> + struct uint_not_equal_ : public bexpr_<( lvalue != rvalue )> {}; template <unsigned lvalue, unsigned rvalue> - struct uint_greater_ : public bool_<( lvalue > rvalue )> + struct uint_greater_ : public bexpr_<( lvalue > rvalue )> {}; template <unsigned lvalue, unsigned rvalue> - struct uint_greater_or_equal_ : public bool_<( lvalue >= rvalue )> + struct uint_greater_or_equal_ : public bexpr_<( lvalue >= rvalue )> {}; template <unsigned lvalue, unsigned rvalue> - struct uint_less_ : public bool_<( lvalue < rvalue )> + struct uint_less_ : public bexpr_<( lvalue < rvalue )> {}; template <unsigned lvalue, unsigned rvalue> - struct uint_less_or_equal_ : public bool_<( lvalue <= rvalue )> + struct uint_less_or_equal_ : public bexpr_<( lvalue <= rvalue )> {};
18Â years, 1Â month
1
0
0
0
710: Catch up with the new SCOOP 2 implementation.
by Roland Levillain
https://svn.lrde.epita.fr/svn/oln/trunk/static
Index: ChangeLog from Roland Levillain <roland(a)lrde.epita.fr> Catch up with the new SCOOP 2 implementation. * tests/super.cc, tests/vtypes.cc * tests/vtypes-and-exact.cc: Adjust tests to catch up with the new stc/scoop.hh. * stc/Makefile.am (EXTRA_DIST): Add was.scoop.hh. * tests/Makefile.am (check_PROGRAMS): Remove multiple-supers and vtypes-multiple-supers. (multiple_supers_SOURCES, vtypes_multiple_supers_SOURCES): Remove. (EXTRA_DIST): New. Add multiple-supers.cc and vtypes-multiple-supers.cc. stc/Makefile.am | 3 + tests/Makefile.am | 7 +-- tests/super.cc | 17 ++++++-- tests/vtypes-and-exact.cc | 89 +++++++++++++++++----------------------------- tests/vtypes.cc | 44 ++++++++++------------ 5 files changed, 71 insertions(+), 89 deletions(-) Index: tests/vtypes-and-exact.cc --- tests/vtypes-and-exact.cc (revision 709) +++ tests/vtypes-and-exact.cc (working copy) @@ -34,21 +34,16 @@ #include <mlc/int.hh> #include <stc/any.hh> +#include <stc/exact.hh> #include <stc/scoop.hh> // Helper macros. -#define my_type_of(FromType, Typedef) \ - typename my_type_of_(FromType, Typedef) +#define my_type_of_(FromType, Alias) \ + my::direct_type_of_<FromType, my::typedef_:: Alias##_type>::ret -#define my_type_of_(FromType, Typedef) \ - stc_type_of_(my, my::category::my_cat, FromType, Typedef) - -#define my_direct_type_of(FromExactType, Typedef) \ - typename my_direct_type_of_(FromExactType, Typedef) - -#define my_direct_type_of_(FromExactType, Typedef) \ - stc_direct_type_of_(my, my::category::my_cat, FromExactType, Typedef) +#define my_type_of(FromType, Alias) \ + typename my_type_of_(FromType, Alias) // Namespace equipment. @@ -69,17 +64,6 @@ mlc_decl_typedef(zorg_type); - /*-----------. - | Category. | - `-----------*/ - - // We only use one category here. - namespace category - { - struct my_cat; - } - - /*----------------------------------------. | A<Exact> --|> stc::any__simple<Exact>. | `----------------------------------------*/ @@ -90,7 +74,7 @@ /// Types associated to my::A. template <typename Exact> - struct vtypes_in_category< category::my_cat, A<Exact> > + struct vtypes< A<Exact> > { // A native type. typedef int foo_type; @@ -109,6 +93,8 @@ // Aliases. + // META-FIXME: Update comment (stc/scoop.hh as changed since). + /* FIXME: Work around a bug that affects both g++ 4.1 and gcc-snapshot (4.2) from Debian. The versions of the compiler used at the moment this text was written were: @@ -123,14 +109,9 @@ assertions ``Ensure stc::is_any_ works properly.'' below (in main). Using my_direct_type_of (on the exact type) solves this! */ -#if 0 - typedef my_type_of(self_t, foo) foo_t; - typedef my_type_of(self_t, bar) bar_t; - typedef my_type_of(self_t, baz) baz_t; -#endif - typedef my_direct_type_of(exact_t, foo) foo_t; - typedef my_direct_type_of(exact_t, bar) bar_t; - typedef my_direct_type_of(exact_t, baz) baz_t; + typedef my_type_of(exact_t, foo) foo_t; + typedef my_type_of(exact_t, bar) bar_t; + typedef my_type_of(exact_t, baz) baz_t; }; @@ -151,7 +132,7 @@ /// Types associated to my::B. template <typename Exact> - struct vtypes_in_category< category::my_cat, B<Exact> > + struct vtypes< B<Exact> > { // (foo is left untouched.) @@ -165,35 +146,30 @@ /// An extended type associated to my::B. template <typename Exact> - struct ext_vtype_in_category<category::my_cat, B<Exact>, typedef_::yin_type> + struct single_vtype< B<Exact>, typedef_::yin_type > { typedef unsigned long ret; }; template <typename Exact> - struct B : public stc_get_supers(B<Exact>) + struct B : public A<Exact> { typedef B<Exact> self_t; typedef Exact exact_t; // Aliases. + // META-FIXME: Update comment (stc/scoop.hh as changed since). + /* FIXME: Same as above; using my_type_of (i.e., using stc_to_exact) breaks the assertions ``Ensure stc::is_any_ works properly.'' below (in main). Using my_direct_type_of (on the exact type) solves this! */ -#if 0 - typedef my_type_of(self_t, foo) foo_t; - typedef my_type_of(self_t, bar) bar_t; - typedef my_type_of(self_t, baz) baz_t; - typedef my_type_of(self_t, quux) quux_t; - typedef my_type_of(self_t, yin) yin_t; -#endif - typedef my_direct_type_of(exact_t, foo) foo_t; - typedef my_direct_type_of(exact_t, bar) bar_t; - typedef my_direct_type_of(exact_t, baz) baz_t; - typedef my_direct_type_of(exact_t, quux) quux_t; - typedef my_direct_type_of(exact_t, yin) yin_t; + typedef my_type_of(exact_t, foo) foo_t; + typedef my_type_of(exact_t, bar) bar_t; + typedef my_type_of(exact_t, baz) baz_t; + typedef my_type_of(exact_t, quux) quux_t; + typedef my_type_of(exact_t, yin) yin_t; }; @@ -205,35 +181,36 @@ struct C; // Super type. - stc_set_super(C, B<C>); + template <> + struct set_super_type<C> + { + typedef B<C> ret; + }; /// Types associated to my::C. template <> - struct vtypes_in_category<category::my_cat, C> + struct vtypes<C> { // A type defined only here (and not in the super class). typedef double zorg_type; }; - struct C : public stc_get_supers(C) + struct C : public B<C> { typedef C self_t; typedef self_t exact_t; // Aliases. + // META-FIXME: Update comment (stc/scoop.hh as changed since). + /* FIXME: Same as above; using my_type_of_ (i.e., using stc_to_exact) breaks the assertions ``Ensure stc::is_any_ works properly.'' below (in main). Using my_direct_type_of_ (on the exact type) solves this! */ -#if 0 - typedef my_type_of_(self_t, foo) foo_t; - typedef my_type_of_(self_t, quux) quux_t; - typedef my_type_of_(self_t, zorg) zorg_t; -#endif - typedef my_direct_type_of_(exact_t, foo) foo_t; - typedef my_direct_type_of_(exact_t, quux) quux_t; - typedef my_direct_type_of_(exact_t, zorg) zorg_t; + typedef my_type_of_(exact_t, foo) foo_t; + typedef my_type_of_(exact_t, quux) quux_t; + typedef my_type_of_(exact_t, zorg) zorg_t; }; } // end of namespace my Index: tests/super.cc --- tests/super.cc (revision 709) +++ tests/super.cc (working copy) @@ -56,10 +56,14 @@ // Forward declaration. struct B; - // Warning, this sugar might be removed in the future. - stc_set_super(B, A); + // Set super type. + template<> + struct set_super_type<B> + { + typedef A ret; + }; - struct B : public stc_get_supers(B) + struct B : public A { }; @@ -76,9 +80,12 @@ simple test, but it doesn't matter: we are only checking the super relationship here. */ - // Warning, this sugar might be removed in the future. /// Link to B (``pseudo'' inheritance). - stc_set_pseudosuper(C, B); + template<> + struct set_pseudosuper_type<C> + { + typedef B ret; + }; struct C // no inheritance { Index: tests/Makefile.am --- tests/Makefile.am (revision 709) +++ tests/Makefile.am (working copy) @@ -17,11 +17,9 @@ entry \ exact \ find_exact \ - multiple-supers \ super \ vtypes \ vtypes-and-exact \ - vtypes-multiple-supers \ \ tour @@ -29,12 +27,13 @@ entry_SOURCES = entry.cc exact_SOURCES = exact.cc find_exact_SOURCES = find_exact.cc -multiple_supers_SOURCES = multiple-supers.cc super_SOURCES = super.cc vtypes_SOURCES = vtypes.cc vtypes_and_exact_SOURCES = vtypes-and-exact.cc -vtypes_multiple_supers_SOURCES = vtypes-multiple-supers.cc tour_SOURCES = tour.cc +# Old tests. +EXTRA_DIST = multiple-supers.cc vtypes-multiple-supers.cc + TESTS = $(check_PROGRAMS) Index: tests/vtypes.cc --- tests/vtypes.cc (revision 709) +++ tests/vtypes.cc (working copy) @@ -36,11 +36,11 @@ // Helper macros. -#define my_type_of(FromType, Typedef) \ - typename my_type_of_(FromType, Typedef) +#define my_type_of_(FromType, Alias) \ + my::direct_type_of_<FromType, my::typedef_:: Alias##_type>::ret -#define my_type_of_(FromType, Typedef) \ - stc_type_of_(my, my::category::my_cat, FromType, Typedef) +#define my_type_of(FromType, Alias) \ + typename my_type_of_(FromType, Alias) // Namespace equipment. @@ -61,17 +61,6 @@ mlc_decl_typedef(zorg_type); - /*-----------. - | Category. | - `-----------*/ - - // We only use one category here. - namespace category - { - struct my_cat; - } - - /*----. | A. | `----*/ @@ -81,7 +70,7 @@ /// Types associated to my::A. template <> - struct vtypes_in_category<category::my_cat, my::A> + struct vtypes<my::A> { // A native type. typedef int foo_type; @@ -109,12 +98,16 @@ // Forward declaration. struct B; - // Warning, this sugar might be removed in the future. - stc_set_super(B, A); + // Set super type. + template<> + struct set_super_type<B> + { + typedef A ret; + }; /// Types associated to my::B. template <> - struct vtypes_in_category<category::my_cat, B> + struct vtypes<B> { // (foo is left untouched.) @@ -128,12 +121,12 @@ /// An extended type associated to my::B. template <> - struct ext_vtype_in_category<category::my_cat, B, typedef_::yin_type> + struct single_vtype<B, typedef_::yin_type> { typedef unsigned long ret; }; - struct B : public stc_get_supers(B) + struct B : public A { // Aliases. typedef my_type_of_(B, foo) foo_type; @@ -155,13 +148,16 @@ // from B's vtypes (see the specialization // types<category::my_cat, Z>). - // Warning, this sugar might be removed in the future. /// Link to B (``pseudo'' inheritance). - stc_set_pseudosuper(Z, B); + template<> + struct set_super_type<Z> + { + typedef B ret; + }; /// Types associated to my::Z. template <> - struct vtypes_in_category<category::my_cat, Z> + struct vtypes<Z> { // A type defined only here (and not in the super class). typedef double zorg_type; Index: stc/Makefile.am --- stc/Makefile.am (revision 709) +++ stc/Makefile.am (working copy) @@ -10,3 +10,6 @@ valist_aggregator.hh \ \ internal/extract_vtype_from_list.hh + +# Old code. +EXTRA_DIST = was.scoop.hh
18Â years, 1Â month
1
0
0
0
709: Add a specialization of level::fill for value-wise random accessible images.
by Roland Levillain
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog from Roland Levillain <roland(a)lrde.epita.fr> Add a specialization of level::fill for value-wise random-accessible images. * tests/morphers/with_lut.cc (main): More static checking of the interface of an image with LUT. Test oln::level::fill on an image with LUT. * oln/level/fill.hh (level::fill(abstract:: mutable_image_being_value_wise_random_accessible<I>&)) (level::impl:: fill(abstract::mutable_image_being_value_wise_random_accessible<I>&)): New. * oln/core/typedefs.hh (oln_fwd_viter, oln_fwd_viter_) (oln_bkd_viter, oln_bkd_viter_, oln_viter, oln_viter_): New macros. * oln/core/gen/bkd_viter_lut.hh (bkd_viter_lut::bkd_viter_lut(const morpher::with_lut<Image, Lut>&)) * oln/core/gen/fwd_viter_lut.hh (fwd_viter_lut::fwd_viter_lut(const morpher::with_lut<Image, Lut>&)) New ctors. oln/core/gen/bkd_viter_lut.hh | 19 ++++++++++++++++++- oln/core/gen/fwd_viter_lut.hh | 21 +++++++++++++++++++-- oln/core/typedefs.hh | 14 +++++++++++++- oln/level/fill.hh | 26 ++++++++++++++++++++++++++ tests/morphers/with_lut.cc | 24 +++++++++++++++++------- 5 files changed, 93 insertions(+), 11 deletions(-) Index: tests/morphers/with_lut.cc --- tests/morphers/with_lut.cc (revision 708) +++ tests/morphers/with_lut.cc (working copy) @@ -114,7 +114,16 @@ add(1, white). add(2, c); + // Type of our image with look-up table. typedef oln::morpher::with_lut<image_t, lut_t> image_with_lut_t; + // Interface check. + mlc::assert_< + mlc_is_not_a_(image_with_lut_t, oln::abstract::mutable_image) + >::check(); + mlc::assert_< + mlc_is_a_(image_with_lut_t, + oln::abstract::mutable_image_being_value_wise_random_accessible) + >::check(); // FIXME: ``ima + lut'' doesn't work. Maybe a `using' statement is // required. image_with_lut_t ima_with_lut(ima, lut); @@ -149,14 +158,14 @@ // Check fwd_viter_lut. - oln_type_of_(image_with_lut_t, fwd_viter) fv(ima_with_lut.lut()); + oln_fwd_viter_(image_with_lut_t) fv(ima_with_lut); std::list<rgb8> fwd_values; std::cout << "values of lut (fwd) =" << std::endl; // Push the values to the *back* of the list. for_all (fv) fwd_values.push_back(fv); // Check bkd_viter_lut. - oln_type_of_(image_with_lut_t, bkd_viter) bv(ima_with_lut.lut()); + oln_bkd_viter_(image_with_lut_t) bv(ima_with_lut); std::list<rgb8> bkd_values; std::cout << "values of lut (bkd) =" << std::endl; // Push the values to the *front* of the list (i.e., in reverse order). @@ -166,9 +175,10 @@ assert (fwd_values == bkd_values); - // FIXME: To be enabled later, when oln::level::fill is specialized - // for abstract::mutable_image_being_value_wise_random_accessible. -#if 0 - oln::level::apply(ima_with_lut, fun); // 3 ops only !!! -#endif + // Test level::fill. + oln::debug::print(ima_with_lut); + std::cout << std::endl << std::endl; + // Three ops only! + oln::level::fill(ima_with_lut, blue); + oln::debug::print(ima_with_lut); } Index: oln/level/fill.hh --- oln/level/fill.hh (revision 708) +++ oln/level/fill.hh (working copy) @@ -32,6 +32,7 @@ # include <iostream> # include <oln/core/abstract/image.hh> +# include <oln/core/abstract/image/value_wise_accessibility/hierarchy.hh> # include <oln/core/abstract/iterator.hh> # include <oln/core/abstract/functions.hh> @@ -73,6 +74,11 @@ template <typename I, typename F> void fill(abstract::mutable_image<I>& input, const abstract::fun_p2v<F>& fun); + /// Fwd decl. + template <typename I> + void fill(abstract::mutable_image_being_value_wise_random_accessible<I>& input, + const oln_value(I)& value); + # ifndef OLN_INCLUDE_ONLY @@ -117,6 +123,18 @@ input(p) = fun.exact()(p); } + /// Version specialized for mutable images being value-wise + /// random accessible. + template <typename I> + void fill(abstract::mutable_image_being_value_wise_random_accessible<I>& input, + const oln_value(I)& value) + { + // FIXME: We should not need to call exact() here. + oln_viter(I) v(input.exact()); + for_all(v) + input.value(v) = value; + } + } // end of namespace oln::level::impl @@ -148,6 +166,14 @@ return impl::fill(input.exact(), fun); } + /// Facade. + template <typename I> + void fill(abstract::mutable_image_being_value_wise_random_accessible<I>& input, + const oln_value(I)& value) + { + return impl::fill(input.exact(), value); + } + # endif } // end of namespace oln::level Index: oln/core/typedefs.hh --- oln/core/typedefs.hh (revision 708) +++ oln/core/typedefs.hh (working copy) @@ -167,8 +167,9 @@ +/// Shortcuts formed such as "oln_something(T) means +/// oln_type_of(T, something)". /// \{ -/// Shortcuts formed such as "oln_something(T) means oln_type_of(T, something)". # define oln_dim(T) oln_type_of(T, dim) # define oln_dim_(T) oln_type_of_(T, dim) @@ -227,6 +228,14 @@ # define oln_bkd_niter(T) oln_type_of(T, bkd_niter) # define oln_bkd_niter_(T) oln_type_of_(T, bkd_niter) +# define oln_fwd_viter(T) oln_type_of(T, fwd_viter) +# define oln_fwd_viter_(T) oln_type_of_(T, fwd_viter) + +# define oln_bkd_viter(T) oln_type_of(T, bkd_viter) +# define oln_bkd_viter_(T) oln_type_of_(T, bkd_viter) + +/// Even shorter shortcuts. +/// \{ # define oln_piter(T) oln_type_of(T, fwd_piter) # define oln_piter_(T) oln_type_of_(T, fwd_piter) @@ -236,8 +245,11 @@ # define oln_niter(T) oln_type_of(T, fwd_niter) # define oln_niter_(T) oln_type_of_(T, fwd_niter) +# define oln_viter(T) oln_type_of(T, fwd_viter) +# define oln_viter_(T) oln_type_of_(T, fwd_viter) /// \} +/// \} // Fwd decls. Index: oln/core/gen/bkd_viter_lut.hh --- oln/core/gen/bkd_viter_lut.hh (revision 708) +++ oln/core/gen/bkd_viter_lut.hh (working copy) @@ -36,6 +36,9 @@ // Forward declaration. template <typename Lut> class bkd_viter_lut; + namespace morpher { + template <typename Image, typename Lut> struct with_lut; + } // end of namespace oln::morpher /// Super type declaration. @@ -74,8 +77,11 @@ typedef oln_type_of(self_t, value) value_type; public: - // Construct an uninitialized value iterator. + /// Construct a backward value iterator from a look-up table (LUT). bkd_viter_lut(const Lut& lut); + /// Construct a backward value iterator from an image having a LUT. + template <typename Image> + bkd_viter_lut(const morpher::with_lut<Image, Lut>& ima); /// Iterator manipulators. /// \{ @@ -116,6 +122,17 @@ this->invalidate(); } + template <typename Lut> + template <typename Image> + bkd_viter_lut<Lut>::bkd_viter_lut(const morpher::with_lut<Image, Lut>& ima) : + super_t(), + lut_(ima.lut()), + i_() + { + // Initialize underlying iterator (i.e., \a i_.) + this->invalidate(); + } + template <typename Exact> void bkd_viter_lut<Exact>::impl_start() Index: oln/core/gen/fwd_viter_lut.hh --- oln/core/gen/fwd_viter_lut.hh (revision 708) +++ oln/core/gen/fwd_viter_lut.hh (working copy) @@ -34,8 +34,11 @@ namespace oln { - // Forward declaration. + // Forward declarations. template <typename Lut> class fwd_viter_lut; + namespace morpher { + template <typename Image, typename Lut> struct with_lut; + } // end of namespace oln::morpher /// Super type declaration. @@ -74,8 +77,11 @@ typedef oln_type_of(self_t, value) value_type; public: - // Construct an uninitialized value iterator. + /// Construct a forward value iterator from a look-up table (LUT). fwd_viter_lut(const Lut& lut); + /// Construct a forward value iterator from an image having a LUT. + template <typename Image> + fwd_viter_lut(const morpher::with_lut<Image, Lut>& ima); /// Iterator manipulators. /// \{ @@ -116,6 +122,17 @@ this->invalidate(); } + template <typename Lut> + template <typename Image> + fwd_viter_lut<Lut>::fwd_viter_lut(const morpher::with_lut<Image, Lut>& ima) : + super_t(), + lut_(ima.lut()), + i_() + { + // Initialize underlying iterator (i.e., \a i_.) + this->invalidate(); + } + template <typename Exact> void fwd_viter_lut<Exact>::impl_start()
18Â years, 1Â month
1
0
0
0
708: Fix virtual types of oln::internal::point_nd and oln::internal::dpoint_nd.
by Roland Levillain
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog from Roland Levillain <roland(a)lrde.epita.fr> Fix virtual types of oln::internal::point_nd and oln::internal::dpoint_nd. * oln/core/internal/point_nd.hh (oln::vtypes< internal::point_nd<E> >::vec_t) (oln::vtypes< internal::point_nd<E> >::psite_type): Remove typedefs. (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. dpoint_nd.hh | 4 +--- point_nd.hh | 7 +------ 2 files changed, 2 insertions(+), 9 deletions(-) Index: oln/core/internal/point_nd.hh --- oln/core/internal/point_nd.hh (revision 707) +++ oln/core/internal/point_nd.hh (working copy) @@ -74,13 +74,8 @@ private: typedef oln_dim(E) dim_t; typedef oln_coord(E) coord_t; - typedef xtd::vec<mlc_value(dim_t), coord_t> vec_t; public: - - typedef double psite_type; - - typedef typename vec_t::self_type vec_type; - // typedef xtd::vec<mlc_value(dim_t), coord_t> vec_type; + typedef xtd::vec<mlc_value(dim_t), coord_t> vec_type; }; Index: oln/core/internal/dpoint_nd.hh --- oln/core/internal/dpoint_nd.hh (revision 707) +++ oln/core/internal/dpoint_nd.hh (working copy) @@ -57,10 +57,8 @@ private: typedef oln_dim(E) dim_t; typedef oln_coord(E) coord_t; - typedef xtd::vec<mlc_value(dim_t), coord_t> vec_t; public: - typedef typename vec_t::self_type vec_type; - // typedef xtd::vec<mlc_value(dim_t), coord_t> vec_type; + typedef xtd::vec<mlc_value(dim_t), coord_t> vec_type; };
18Â years, 1Â month
1
0
0
0
707: Suppress most single_vtype and update.
by Thierry GERAUD
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. (oln_check_direct_type_of, oln_check_direct_type_of_): Remove. (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. * oln/core/neighborhood_entry.hh: Likewise. * oln/core/topology_entry.hh: Likewise. * oln/core/image_entry.hh: Likewise. * oln/core/abstract/iterator_on_points.hh: Likewise. * oln/core/abstract/point.hh: Likewise. * oln/core/gen/topo_add_nbh.hh: Likewise. * oln/core/internal/topology_morpher.hh: Likewise. * oln/morpher/value_cast.hh: Likewise. * oln/morpher/two_way.hh: Likewise. * oln/morpher/thru_fun.hh: Likewise. * oln/morpher/slice.hh: Likewise. * oln/morpher/with_lut.hh: Likewise. * oln/morpher/count_rw.hh: Likewise. * oln/morpher/two_way_rw.hh: Likewise. * oln/morpher/stack.hh: Likewise. * 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. * oln/core/abstract/point_set.hh (~point_set): Fix code. (decl): Disable static check. * oln/core/gen/fwd_piter_bbox.hh: Update. 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. * oln/core/automatic/image/mutable_image2d.hh: Likewise. * oln/core/automatic/image/mutable_image3d.hh: Likewise. * oln/core/automatic/image/image1d.hh: Likewise. * oln/core/automatic/image/image2d.hh: Likewise. * oln/core/automatic/image/image3d.hh: Likewise. * oln/core/1d/dpoint1d.hh: Add fwd decls and/or aliases. (include): Remove aliases header. * oln/core/2d/dpoint2d.hh: Likewise. * oln/core/3d/dpoint3d.hh: Likewise. * oln/core/1d/point1d.hh: Add fwd decls and/or aliases. (include): Remove aliases header. * oln/core/2d/point2d.hh: Likewise. * oln/core/3d/point3d.hh: Likewise. * oln/core/1d/neighb1d.hh: Add alias. * oln/core/2d/neighb2d.hh: Likewise. * oln/core/3d/neighb3d.hh: Likewise. * tests/core/point2d.cc (include): Solve FIXME. (main): Change test. * tests/core/dpoint2d.cc: Likewise. Update. * tests/morphers/with_lut.cc: Cosmetics. * tests/core/image_entry.cc: Update. * oln/io/pnm.hh: Use shortcuts. (include): Update. * oln/core/abstract/point_set/point_set_having_bbox.hh: Update. * oln/core/gen/bkd_qiter_win.hh: Update. * oln/core/gen/grid.hh: Update. * oln/core/gen/bkd_viter_lut.hh: Update. * oln/core/gen/bbox_fwd_piter.hh: Update. * oln/core/gen/fwd_niter_neighb.hh: Update. * oln/core/gen/fwd_qiter_win.hh: Update. * oln/core/gen/bbox_bkd_piter.hh: Update. * oln/core/gen/bkd_niter_neighb.hh: Update. * oln/core/gen/fwd_viter_lut.hh: Update. * oln/core/internal/point_nd.hh: Update. (vtypes): New. * oln/core/internal/dpoint_nd.hh: Update. (vtypes): New. * oln/morpher/add_isubset.hh: Update. Remove dead code. * oln/morpher/identity.hh: Update. * oln/morpher/add_neighborhood.hh: Update. Index: tests/morphers/with_lut.cc =================================================================== --- tests/morphers/with_lut.cc (revision 705) +++ tests/morphers/with_lut.cc (working copy) @@ -144,6 +144,7 @@ oln::point2d p(1, 2); assert(ima_with_lut(p) == red); + assert(ima_with_lut.at(1, 2) == red); Index: tests/core/point2d.cc =================================================================== --- tests/core/point2d.cc (revision 705) +++ tests/core/point2d.cc (working copy) @@ -26,18 +26,15 @@ // Public License. #include <mlc/assert.hh> -#include <mlc/cmp.hh> -// FIXME: Don't include oln/basics2d.hh, which is too big. -// (Fix.) -#include <oln/basics2d.hh> +#include <mlc/is_a.hh> +#include <oln/core/2d/point2d.hh> int main() { - typedef oln::point2d_<int> point2d; - typedef oln:: stc_get_supers(point2d) point2d_super_type; + typedef oln::point2d_<int> point_t; mlc::assert_< - mlc_eq( point2d_super_type, oln::internal::point_nd< point2d > ) + mlc_is_a_( point_t, oln::internal::point_nd ) >::check(); } Index: tests/core/image_entry.cc =================================================================== --- tests/core/image_entry.cc (revision 705) +++ tests/core/image_entry.cc (working copy) @@ -44,9 +44,14 @@ namespace oln { - // Warning, this sugar might be removed in the future. - stc_set_super(my::image, oln::image_entry<my::image>); + template <> + struct set_super_type < my::image > + { + typedef image_entry< my::image > ret; + }; + + /// Virtual types associated to my::image. /// \{ template<> @@ -88,13 +93,13 @@ namespace my { // A very simple 2D image. - class image : public oln::get_super_types<my::image>::ret + class image : public oln::image_entry< my::image > { public: - typedef image self_type; + typedef image self_t; // Internal vtypes. - typedef oln_type_of_(self_type, grid) grid_t; - typedef oln_type_of_(self_type, value) value_t; + typedef oln_grid_(self_t) grid_t; + typedef oln_value_(self_t) value_t; // FIXME: Add missing typedefs. }; } // end of namespace my Index: tests/core/dpoint2d.cc =================================================================== --- tests/core/dpoint2d.cc (revision 705) +++ tests/core/dpoint2d.cc (working copy) @@ -28,20 +28,15 @@ /// Test oln::image_entry. #include <mlc/assert.hh> -#include <mlc/cmp.hh> -// // FIXME: Fix oln/basics2d.hh! -// #include <oln/core/2d/point2d.hh> -// namespace oln { template class point2d_<int>; } -// #include <oln/core/2d/dpoint2d.hh> +#include <mlc/is_a.hh> #include <oln/basics2d.hh> int main() { - typedef oln::dpoint2d_<int> dpoint2d; - typedef oln:: stc_get_supers(dpoint2d) dpoint2d_super_type; + typedef oln::dpoint2d_<int> dpoint_t; mlc::assert_< - mlc_eq( dpoint2d_super_type, oln::internal::dpoint_nd< dpoint2d > ) + mlc_is_a_( dpoint_t, oln::internal::dpoint_nd ) >::check(); } Index: oln/io/pnm.hh =================================================================== --- oln/io/pnm.hh (revision 705) +++ oln/io/pnm.hh (working copy) @@ -33,13 +33,7 @@ # include <fstream> # include <string> -# include <oln/core/abstract/iterator.hh> -# include <oln/core/gen/fwd_piter_bbox.hh> -# include <oln/core/gen/bkd_piter_bbox.hh> -# include <oln/core/iterator_vtypes.hh> -# include <oln/core/2d/aliases.hh> -# include <oln/core/2d/dpoint2d.hh> -# include <oln/core/2d/image2d.hh> +# include <oln/basics2d.hh> namespace oln { @@ -120,10 +114,10 @@ template <typename I> void load_pbm_raw(std::ifstream& file, I& ima) { - oln_type_of(I, coord) cols = 0; + oln_coord(I) cols = 0; unsigned bits = 0; unsigned char c = 0; - oln_type_of(I, fwd_piter) p(ima.topo()); + oln_fwd_piter(I) p(ima.topo()); for_all(p) { if (bits == 0) @@ -142,7 +136,7 @@ template <typename I> void load_pbm_ascii(std::ifstream& file, I& ima) { - oln_type_of(I, fwd_piter) p(ima.topo()); + oln_fwd_piter(I) p(ima.topo()); for_all(p) ima(p) = (file.get() == '0'); } @@ -152,10 +146,10 @@ template <typename I> void load_pnm_ascii(std::ifstream& file, I& ima) { - oln_type_of(I, fwd_piter) p(ima.topo()); + oln_fwd_piter(I) p(ima.topo()); for_all(p) { - oln_type_of(I, value) value; + oln_value(I) value; file >> value; ima(p) = value; // FIXME: Test alt code below. @@ -172,7 +166,7 @@ size_t len = ima.bbox().ncols(); for (int row = ima.pmin().row(); row <= ima.pmax().row(); ++row) file.read((char*)(ima.adr_at(row, col)), - len * sizeof(oln_type_of(I, value))); + len * sizeof(oln_value(I))); } Index: oln/core/typedefs.hh =================================================================== --- oln/core/typedefs.hh (revision 705) +++ oln/core/typedefs.hh (working copy) @@ -170,6 +170,15 @@ /// \{ /// Shortcuts formed such as "oln_something(T) means oln_type_of(T, something)". +# define oln_dim(T) oln_type_of(T, dim) +# define oln_dim_(T) oln_type_of_(T, dim) + +# define oln_vec(T) oln_type_of(T, vec) +# define oln_vec_(T) oln_type_of_(T, vec) + +# define oln_bbox(T) oln_type_of(T, bbox) +# define oln_bbox_(T) oln_type_of_(T, bbox) + # define oln_coord(T) oln_type_of(T, coord) # define oln_coord_(T) oln_type_of_(T, coord) @@ -231,7 +240,13 @@ -# include <oln/core/type_fun/plain.hh> +// Fwd decls. +namespace oln { + namespace type_fun { + template <typename T> struct plain; + template <typename Image, typename Value> struct ch_value; + } +} /// \{ Index: oln/core/macros.hh =================================================================== --- oln/core/macros.hh (revision 705) +++ oln/core/macros.hh (working copy) @@ -28,119 +28,34 @@ #ifndef OLN_CORE_MACROS_HH # define OLN_CORE_MACROS_HH -// --------------------- // -// Virtual type access. // -// --------------------- // -/// \def oln_type_of(OlnType, Alias) -/// -/// Macro to retrieve an associated type \a Alias from the exact type of -/// an oln type \a OlnType whose category is not specified (version to be -/// used inside a template). -# define oln_type_of(OlnType, Alias) \ - stc_direct_type_of(oln, void, OlnType, Alias) -// FIXME: Remove direct_ above. +# include <oln/core/typedefs.hh> -/// FIXME: Temporary macro to be able to perform "oln_type_of(oln_type_of(A, B), C)". -# define oln_deduce_type_of(OlnType, Alias1, Alias2) \ -typename oln::direct_type_of_<void, \ - typename oln::direct_type_of_<void, OlnType, oln::typedef_::Alias1##_type >::ret, \ - oln::typedef_::Alias2##_type >::ret -// FIXME: Remove direct_ *twice* above. +# define oln_type_of_(OlnType, Alias) \ + oln::direct_type_of_<OlnType, oln::typedef_:: Alias##_type>::ret -# define oln_deduce_direct_type_of(OlnType, Alias1, Alias2) \ -typename oln::direct_type_of_<void, \ - typename oln::direct_type_of_<void, OlnType, oln::typedef_::Alias1##_type >::ret, \ - oln::typedef_::Alias2##_type >::ret +# define oln_type_of(OlnType, Alias) \ + typename oln_type_of_(OlnType, Alias) -/// \def oln_type_of(OlnType, Alias) -/// -/// Macro to retrieve an associated type \a Alias from the exact type of -/// an oln type \a OlnType whose category is not specified (version to be -/// used outside a template). -# define oln_type_of_(OlnType, Alias) \ - stc_direct_type_of_(oln, void, OlnType, Alias) -// FIXME: Remove direct_ above. +# define oln_deduce_type_of(OlnType, Alias1, Alias2) \ +typename oln::direct_type_of_<typename oln::direct_type_of_<OlnType, oln::typedef_::Alias1##_type >::ret, \ + oln::typedef_::Alias2##_type >::ret -/// \def oln_direct_type_of(OlnType, Alias) -/// -/// Macro to retrieve an associated type \a Alias from an oln type \a -/// OlnType directly, and whose category is not specified (version to -/// be used inside a template). -# define oln_direct_type_of(OlnType, Alias) \ - stc_direct_type_of(oln, void, OlnType, Alias) +# define oln_deduce(OlnType, Alias1, Alias2) \ + oln_deduce_type_of(OlnType, Alias1, Alias2) -/// \def oln_direct_type_of_(OlnType, Alias) -/// -/// Macro to retrieve an associated type \a Alias from an oln type \a -/// OlnType directly, and whose category is not specified (version to -/// be used inside a template). -# define oln_direct_type_of_(OlnType, Alias) \ - stc_direct_type_of_(oln, void, OlnType, Alias) -// ------------------------------- // -// Virtual type check and access. // -// ------------------------------- // +#define oln_virtual_typedef(Typedef) \ + typedef oln_type_of(E, Typedef) Typedef -/* These macros are the same as the previous ones, but they use - stc_check_type_of{_,} (resp. stc_check_direct_type_of{_,}) instead of - stc_type_of{_,} (resp. stc_direct_type_of{_,}). */ -/// \def oln_check_type_of(OlnType, Alias) -/// -/// Macro to retrieve an associated type \a Alias from the exact type of -/// an oln type \a OlnType whose category is not specified (version to be -/// used inside a template). -/// -/// If the virtual type is not found, raise a static error. -# define oln_check_type_of(OlnType, Alias) \ - stc_check_direct_type_of(oln, void, OlnType, Alias) -// FIXME: Remove direct_ above. +// FIXME: Rec? The macro below is to ensure that static checks are removed during "Rec" tests. +// #define oln_virtual_typedef(Typedef) typedef void Typedef -/// \def oln_check_type_of(OlnType, Alias) -/// -/// Macro to retrieve an associated type \a Alias from the exact type of -/// an oln type \a OlnType whose category is not specified (version to be -/// used outside a template). -/// -/// If the virtual type is not found, raise a static error. -# define oln_check_type_of_(OlnType, Alias) \ - stc_check_direct_type_of_(oln, void, OlnType, Alias) -// FIXME: Remove direct_ above. - -/// \def oln_check_direct_type_of(OlnType, Alias) -/// -/// Macro to retrieve an associated type \a Alias from an oln type \a -/// OlnType directly, and whose category is not specified (version to -/// be used inside a template). -/// -/// If the virtual type is not found, raise a static error. -# define oln_check_direct_type_of(OlnType, Alias) \ - stc_check_direct_type_of(oln, void, OlnType, Alias) - -/// \def oln_check_direct_type_of_(OlnType, Alias) -/// -/// Macro to retrieve an associated type \a Alias from an oln type \a -/// OlnType directly, and whose category is not specified (version to -/// be used inside a template). -/// -/// If the virtual type is not found, raise a static error. -# define oln_check_direct_type_of_(OlnType, Alias) \ - stc_check_direct_type_of_(oln, void, OlnType, Alias) - - - -/// Declare the vtype \a Typedef in an abstract class (see sample code -/// for details). Warning: this macro assumes that the exact type -/// parameter is named 'E'. -#define oln_virtual_typedef(Typedef) \ - typedef stc_check_direct_type_of(oln, void, E, Typedef) Typedef - - #endif // ! OLN_CORE_MACROS_HH Index: oln/core/point_set_entry.hh =================================================================== --- oln/core/point_set_entry.hh (revision 705) +++ oln/core/point_set_entry.hh (working copy) @@ -35,29 +35,12 @@ namespace oln { + /// Fwd decl. + template <typename E> struct point_set_entry; - /// Entry class for point sets: point_set_entry<E> is an alias for - /// entry< abstract::point_set, E>. - template <typename E> - struct point_set_entry : public entry< abstract::point_set, E> - { - protected: - point_set_entry(); - }; - -# ifndef OLN_INCLUDE_ONLY - - template <typename E> - point_set_entry<E>::point_set_entry() - { - } - -# endif - - /// Virtual types associated to point_set_entry<E>. template <typename E> @@ -65,7 +48,6 @@ { typedef mlc::undefined point_type; - typedef mlc::undefined piter_type; typedef mlc::undefined fwd_piter_type; typedef mlc::undefined bkd_piter_type; @@ -73,40 +55,38 @@ typedef mlc::undefined is_random_accessible_type; typedef mlc::undefined has_known_size_type; typedef mlc::undefined is_connected_type; + + // final. + typedef oln_deduce(E, point, coord) coord_type; + typedef oln_deduce(E, point, grid) grid_type; + typedef oln_deduce(E, point, dim) dim_type; + typedef oln_fwd_piter(E) piter_type; }; - template <typename E> - struct single_vtype< point_set_entry<E>, typedef_::coord_type > - { - typedef oln_type_of(E, point) P; - typedef oln_type_of(P, coord) ret; - }; + /// Entry class for point sets: point_set_entry<E> is an alias for + /// entry< abstract::point_set, E>. template <typename E> - struct single_vtype< point_set_entry<E>, typedef_::grid_type > + struct point_set_entry : public entry< abstract::point_set, E> { - typedef oln_type_of(E, point) P; - typedef oln_type_of(P, grid) ret; + protected: + point_set_entry(); }; - template <typename E> - struct single_vtype< point_set_entry<E>, typedef_::dim_type > - { - typedef oln_type_of(E, point) P; - typedef oln_type_of(P, dim) ret; - }; +# ifndef OLN_INCLUDE_ONLY template <typename E> - struct single_vtype< point_set_entry<E>, typedef_::piter_type > + point_set_entry<E>::point_set_entry() { - typedef oln_type_of(E, fwd_piter) ret; - }; + } +# endif + } // end of namespace oln Index: oln/core/neighborhood_entry.hh =================================================================== --- oln/core/neighborhood_entry.hh (revision 705) +++ oln/core/neighborhood_entry.hh (working copy) @@ -36,7 +36,18 @@ namespace oln { + /// Fwd decl. + template <typename E> struct neighborhood_entry; + + /// Virtual types associated to neighborhood_entry<E>. + template <typename E> + struct vtypes< neighborhood_entry<E> > + { + typedef mlc::undefined grid_type; + }; + + /// Entry class for point sets: neighborhood_entry<E> is an alias for /// entry< abstract::neighborhood, E>. @@ -58,15 +69,6 @@ # endif - /// Virtual types associated to neighborhood_entry<E>. - - template <typename E> - struct vtypes< neighborhood_entry<E> > - { - typedef mlc::undefined grid_type; - }; - - } // end of namespace oln Index: oln/core/automatic/image/mutable_image2d.hh =================================================================== --- oln/core/automatic/image/mutable_image2d.hh (revision 705) +++ oln/core/automatic/image/mutable_image2d.hh (working copy) @@ -30,7 +30,6 @@ # include <oln/core/automatic/impl.hh> # include <oln/morpher/tags.hh> -# include <oln/core/2d/point2d.hh> namespace oln @@ -69,7 +68,7 @@ set_impl<abstract::mutable_image2d, tag, E> ::impl_at(const oln_coord(E)& row, const oln_coord(E)& col) { - point2d tmp(row, col); + oln_point(E) tmp(row, col); return this->exact().operator()(tmp); } Index: oln/core/automatic/image/mutable_image3d.hh =================================================================== --- oln/core/automatic/image/mutable_image3d.hh (revision 705) +++ oln/core/automatic/image/mutable_image3d.hh (working copy) @@ -30,7 +30,6 @@ # include <oln/core/automatic/impl.hh> # include <oln/morpher/tags.hh> -# include <oln/core/3d/point3d.hh> namespace oln @@ -72,7 +71,7 @@ const oln_coord(E)& row, const oln_coord(E)& col) { - point3d tmp(slice, row, col); + oln_point(E) tmp(slice, row, col); return this->exact().operator()(tmp); } Index: oln/core/automatic/image/image1d.hh =================================================================== --- oln/core/automatic/image/image1d.hh (revision 705) +++ oln/core/automatic/image/image1d.hh (working copy) @@ -30,11 +30,11 @@ # include <oln/core/automatic/impl.hh> # include <oln/morpher/tags.hh> -# include <oln/core/1d/point1d.hh> namespace oln { + // Forward declaration. namespace abstract { @@ -73,7 +73,7 @@ set_impl<abstract::image1d, tag, E> ::impl_at(const oln_coord(E)& index) const { - point1d tmp(index); + oln_point(E) tmp(index); return this->exact().operator()(tmp); } @@ -82,7 +82,7 @@ set_impl<abstract::image1d, tag, E> ::impl_has_at(const oln_coord(E)& index) const { - point1d tmp(index); + oln_point(E) tmp(index); return this->exact().has(tmp); } Index: oln/core/automatic/image/image2d.hh =================================================================== --- oln/core/automatic/image/image2d.hh (revision 705) +++ oln/core/automatic/image/image2d.hh (working copy) @@ -30,11 +30,11 @@ # include <oln/core/automatic/impl.hh> # include <oln/morpher/tags.hh> -# include <oln/core/2d/point2d.hh> namespace oln { + // Forward declaration. namespace abstract { @@ -74,7 +74,7 @@ set_impl<abstract::image2d, tag, E> ::impl_at(const oln_coord(E)& row, const oln_coord(E)& col) const { - point2d tmp(row, col); + oln_point(E) tmp(row, col); return this->exact().operator()(tmp); } @@ -83,7 +83,7 @@ set_impl<abstract::image2d, tag, E> ::impl_has_at(const oln_coord(E)& row, const oln_coord(E)& col) const { - point2d tmp(row, col); + oln_point(E) tmp(row, col); return this->exact().has(tmp); } Index: oln/core/automatic/image/image3d.hh =================================================================== --- oln/core/automatic/image/image3d.hh (revision 705) +++ oln/core/automatic/image/image3d.hh (working copy) @@ -30,11 +30,11 @@ # include <oln/core/automatic/impl.hh> # include <oln/morpher/tags.hh> -# include <oln/core/3d/point3d.hh> namespace oln { + // Forward declaration. namespace abstract { @@ -80,7 +80,7 @@ const oln_coord(E)& row, const oln_coord(E)& col) const { - point3d tmp(slice, row, col); + oln_point(E) tmp(slice, row, col); return this->exact().operator()(tmp); } @@ -91,7 +91,7 @@ const oln_coord(E)& row, const oln_coord(E)& col) const { - point3d tmp(slice, row, col); + oln_point(E) tmp(slice, row, col); return this->exact().has(tmp); } Index: oln/core/automatic/image/mutable_image1d.hh =================================================================== --- oln/core/automatic/image/mutable_image1d.hh (revision 705) +++ oln/core/automatic/image/mutable_image1d.hh (working copy) @@ -30,7 +30,6 @@ # include <oln/core/automatic/impl.hh> # include <oln/morpher/tags.hh> -# include <oln/core/1d/point1d.hh> namespace oln @@ -69,7 +68,7 @@ set_impl<abstract::mutable_image1d, tag, E> ::impl_at(const oln_coord(E)& index) { - point1d tmp(index); + oln_point(E) tmp(index); return this->exact().operator()(tmp); } Index: oln/core/topology_entry.hh =================================================================== --- oln/core/topology_entry.hh (revision 705) +++ oln/core/topology_entry.hh (working copy) @@ -35,7 +35,26 @@ namespace oln { + /// Fwd decl. + template <typename E> struct topology_entry; + + /// Virtual types associated to topology_entry<E>. + + template <typename E> + struct vtypes< topology_entry<E> > + { + typedef mlc::undefined point_type; + typedef mlc::undefined bbox_type; + typedef mlc::none neighborhood_type; + typedef mlc::undefined is_random_accessible_type; + typedef mlc::none subset_type; + + typedef mlc::none morpher_type; + }; + + + /// Entry class for point sets: topology_entry<E> is an alias for /// entry< abstract::topology, E>. @@ -57,25 +76,6 @@ # endif - /// Virtual types associated to topology_entry<E>. - - template <typename E> - struct vtypes< topology_entry<E> > - { - typedef mlc::undefined point_type; - typedef mlc::undefined bbox_type; - typedef mlc::none neighborhood_type; - typedef mlc::undefined is_random_accessible_type; - typedef mlc::none subset_type; - }; - - template <typename E> - struct single_vtype< topology_entry<E>, typedef_::morpher_type > - { - typedef mlc::none ret; - }; - - } // end of namespace oln Index: oln/core/image_entry.hh =================================================================== --- oln/core/image_entry.hh (revision 705) +++ oln/core/image_entry.hh (working copy) @@ -38,29 +38,11 @@ namespace oln { + /// Fwd decl. + template <typename E> struct image_entry; - /// Entry class for point sets: image_entry<E> is an alias for - /// entry< abstract::image, E>. - template <typename E> - struct image_entry : public entry<abstract::image, E> - { - protected: - image_entry(); - }; - -# ifndef OLN_INCLUDE_ONLY - - template <typename E> - image_entry<E>::image_entry() - { - } - -# endif - - - /// Virtual types associated to image_entry<E>. template <typename E> @@ -68,24 +50,24 @@ { typedef mlc::undefined topo_type; typedef mlc::undefined grid_type; - - // coord_type: see below. - - // psite_type: see below. typedef mlc::undefined point_type; - typedef mlc::undefined is_computed_type; - typedef mlc::undefined value_type; - // rvalue_type: see below. - // piter_type: see below. - // fwd_piter_type: see below. - // bkd_piter_type: see below. + typedef mlc::undefined fwd_piter_type; + typedef mlc::undefined bkd_piter_type; - // fwd_qiter_type: see below. - // bkd_qiter_type: see below. + typedef mlc::undefined fwd_qiter_type; + typedef mlc::undefined bkd_qiter_type; + // final definitions: + typedef oln_deduce(E, point, coord) coord_type; + typedef oln_fwd_piter(E) piter_type; + + // default definitions: + typedef oln_point(E) psite_type; + typedef oln_value(E) rvalue_type; + /// \brief Morpher type. /// /// Optionally contains a tag indicating a kind of morpher. @@ -93,70 +75,30 @@ }; - // Coord. - template <typename E> - struct single_vtype< image_entry<E>, typedef_::coord_type > - { - typedef oln_deduce_type_of(E, point, coord) ret; - }; + /// Entry class for point sets: image_entry<E> is an alias for + /// entry< abstract::image, E>. - // Psite. template <typename E> - struct single_vtype< image_entry<E>, typedef_::psite_type > + struct image_entry : public entry<abstract::image, E> { - typedef oln_type_of(E, point) ret; + protected: + image_entry(); }; - // Rvalue. - template <typename E> - struct single_vtype< image_entry<E>, typedef_::rvalue_type > - { - typedef oln_type_of(E, value) ret; - }; +# ifndef OLN_INCLUDE_ONLY - - /* FIXME: Should we keep the `piter' vtype, knowing that the macro - `oln_piter' gives the `fwd_piter' vtype (and not the `piter' - vtype)? */ - // Piter. template <typename E> - struct single_vtype< image_entry<E>, typedef_::piter_type > + image_entry<E>::image_entry() { - typedef oln_type_of(E, fwd_piter) ret; - }; + } - // Fwd piter. - template <typename E> - struct single_vtype< image_entry<E>, typedef_::fwd_piter_type > - { - typedef mlc::undefined ret; - }; +# endif - // Bkd piter. - template <typename E> - struct single_vtype< image_entry<E>, typedef_::bkd_piter_type > - { - typedef mlc::undefined ret; - }; - // Fwd qiter. - template <typename E> - struct single_vtype< image_entry<E>, typedef_::fwd_qiter_type > - { - typedef mlc::undefined ret; - }; - // Bkd qiter. - template <typename E> - struct single_vtype< image_entry<E>, typedef_::bkd_qiter_type > - { - typedef mlc::undefined ret; - }; - - } // end of namespace oln Index: oln/core/abstract/iterator_on_points.hh =================================================================== --- oln/core/abstract/iterator_on_points.hh (revision 705) +++ oln/core/abstract/iterator_on_points.hh (working copy) @@ -54,16 +54,10 @@ struct vtypes< abstract::iterator_on_points<E> > { typedef mlc::undefined point_type; + typedef oln_deduce(E, point, coord) coord_type; }; - template <typename E> - struct single_vtype< abstract::iterator_on_points<E>, typedef_::coord_type > - { - typedef oln_type_of(E, point) point_t; - typedef oln_type_of(point_t, coord) ret; - }; - namespace abstract { @@ -71,7 +65,7 @@ template <typename E> class iterator_on_points : public abstract::iterator<E> { - typedef oln_type_of(E, point) point_t; + typedef oln_point(E) point_t; public: Index: oln/core/abstract/image.hh =================================================================== --- oln/core/abstract/image.hh (revision 705) +++ oln/core/abstract/image.hh (working copy) @@ -78,8 +78,9 @@ oln_virtual_typedef(psite); oln_virtual_typedef(point); - oln_virtual_typedef(fwd_piter); - oln_virtual_typedef(bkd_piter); + // FIXME: Rec? +// oln_virtual_typedef(fwd_piter); +// oln_virtual_typedef(bkd_piter); oln_virtual_typedef(is_computed); oln_virtual_typedef(value); @@ -142,13 +143,14 @@ template <typename E> image<E>::decl::decl() { - mlc::assert_< mlc_is_a(topo, abstract::topology) >::check(); - mlc::assert_< mlc_is_a(grid, abstract::grid) >::check(); - mlc::assert_< mlc_is_a(point, abstract::point) >::check(); - mlc::assert_< mlc_is_a(fwd_piter, abstract::iterator_on_points) >::check(); - mlc::assert_< mlc_is_a(bkd_piter, abstract::iterator_on_points) >::check(); + // FIXME: Rec? +// mlc::assert_< mlc_is_a(topo, abstract::topology) >::check(); +// mlc::assert_< mlc_is_a(grid, abstract::grid) >::check(); +// mlc::assert_< mlc_is_a(point, abstract::point) >::check(); +// mlc::assert_< mlc_is_a(fwd_piter, abstract::iterator_on_points) >::check(); +// mlc::assert_< mlc_is_a(bkd_piter, abstract::iterator_on_points) >::check(); - // FIXME: Rec. + // FIXME: Rec? // mlc::assert_< mlc_is_a(plain, abstract::image) >::check(); } Index: oln/core/abstract/image/bbox/hierarchy.hh =================================================================== --- oln/core/abstract/image/bbox/hierarchy.hh (revision 705) +++ oln/core/abstract/image/bbox/hierarchy.hh (working copy) @@ -87,7 +87,8 @@ template <typename E> image_having_bbox<E>::decl::decl() { - mlc::assert_< mlc_is_a(bbox, abstract::bbox) >::check(); + // FIXME: Rec? + // mlc::assert_< mlc_is_a(bbox, abstract::bbox) >::check(); } template <typename E> @@ -134,7 +135,7 @@ /// With bbox. template <typename E> struct case_< image_hierarchy_wrt_bbox, E, 1 > : - where_< mlc::neq_< oln_deduce_type_of(E, topo, bbox), mlc::not_found > > + where_< mlc::neq_< oln_deduce(E, topo, bbox), mlc::not_found > > { typedef abstract::image_having_bbox<E> ret; }; @@ -142,14 +143,10 @@ template <typename E> struct image_entry; - template <typename E> struct single_vtype< image_entry<E>, typedef_::bbox_type > { - private: - typedef oln_type_of(E, topo) topo_t; - public: - typedef oln_type_of(topo_t, bbox) ret; + typedef oln_deduce(E, topo, bbox) ret; }; } // end of namespace oln Index: oln/core/abstract/point.hh =================================================================== --- oln/core/abstract/point.hh (revision 705) +++ oln/core/abstract/point.hh (working copy) @@ -61,17 +61,11 @@ { typedef mlc::undefined grid_type; typedef mlc::undefined dpoint_type; - typedef mlc::undefined coord_type; + typedef oln_deduce(E, dpoint, coord) coord_type; typedef mlc::undefined dim_type; - typedef mlc::undefined vec_type; - }; - template <typename E> - struct single_vtype< abstract::point<E>, typedef_::vec_type > - { - typedef oln_type_of(E, coord) coord_t; - typedef oln_type_of(E, dim) dim_t; - typedef xtd::vec<mlc_value(dim_t), coord_t> ret; + typedef oln_dim(E) dim_t; + typedef xtd::vec<mlc_value(dim_t), coord_type> vec_type; }; @@ -83,8 +77,8 @@ class point : public stc::any__simple<E>, public oln::type { - typedef oln_type_of(E, dpoint) dpoint_t; - typedef oln_type_of(E, vec) vec_t; + typedef oln_dpoint(E) dpoint_t; + typedef oln_vec(E) vec_t; public: Index: oln/core/abstract/point_set.hh =================================================================== --- oln/core/abstract/point_set.hh (revision 705) +++ oln/core/abstract/point_set.hh (working copy) @@ -68,9 +68,7 @@ decl(); }; - ~point_set() - { - } + ~point_set(); protected: @@ -91,10 +89,9 @@ point_set<E>::decl::decl() { // coherence check: - mlc::assert_equal_< oln_type_of(fwd_piter, grid), - oln_type_of(point, grid) >::check(); - mlc::assert_equal_< oln_type_of(bkd_piter, grid), - oln_type_of(point, grid) >::check(); + // FIXME: Rec? +// mlc::assert_equal_< oln_grid(fwd_piter), oln_grid(point) >::check(); +// mlc::assert_equal_< oln_grid(bkd_piter), oln_grid(point) >::check(); } template <typename E> @@ -102,11 +99,11 @@ { } -// template <typename E> -// point_set<E>::~point_set() -// { -// decl(); -// } + template <typename E> + point_set<E>::~point_set() + { + decl(); + } # endif Index: oln/core/abstract/point_set/point_set_having_bbox.hh =================================================================== --- oln/core/abstract/point_set/point_set_having_bbox.hh (revision 705) +++ oln/core/abstract/point_set/point_set_having_bbox.hh (working copy) @@ -41,11 +41,11 @@ template <typename E> class point_set_having_bbox : public virtual point_set<E> { - typedef oln_check_type_of(E, point) point_t; - typedef oln_check_type_of(E, bbox) bbox_t; + typedef oln_point(E) point_t; + typedef oln_bbox(E) bbox_t; - typedef oln_check_type_of(point_t, coord) coord_t; - typedef oln_check_type_of(point_t, dim) dim_t; + typedef oln_coord(point_t) coord_t; + typedef oln_dim(point_t) dim_t; enum { n = mlc_value(dim_t) }; public: Index: oln/core/1d/neighb1d.hh =================================================================== --- oln/core/1d/neighb1d.hh (revision 705) +++ oln/core/1d/neighb1d.hh (working copy) @@ -36,6 +36,9 @@ namespace oln { + typedef neighb_<dpoint1d> neighb1d; + + namespace internal { Index: oln/core/1d/dpoint1d.hh =================================================================== --- oln/core/1d/dpoint1d.hh (revision 705) +++ oln/core/1d/dpoint1d.hh (working copy) @@ -32,14 +32,21 @@ # include <mlc/int.hh> # include <oln/core/1d/point1d.hh> # include <oln/core/internal/dpoint_nd.hh> -// For oln::dpoint1d and oln::dpoint1df. -# include <oln/core/1d/aliases.hh> namespace oln { + typedef dpoint1d_<int> dpoint1d; + + /// Fwd decls. + template <unsigned D> struct grid_; + typedef grid_<1> grid1d; + template <typename C> struct point1d_; + typedef point1d_<int> point1d; + + /// Super type. template<typename C> struct set_super_type< dpoint1d_<C> > @@ -64,10 +71,10 @@ /// General 1D dpoint class. template <typename C> class dpoint1d_ - : public stc_get_supers(dpoint1d_<C>) + : public internal::dpoint_nd< dpoint1d_<C> > { typedef dpoint1d_<C> self_t; - typedef stc_get_super(dpoint1d_<C>) super_t; + typedef internal::dpoint_nd<self_t> super_t; using super_t::v_; Index: oln/core/1d/point1d.hh =================================================================== --- oln/core/1d/point1d.hh (revision 705) +++ oln/core/1d/point1d.hh (working copy) @@ -31,13 +31,23 @@ # include <mlc/int.hh> # include <oln/core/internal/point_nd.hh> -// For oln::point1d and oln::point1df. -# include <oln/core/1d/aliases.hh> namespace oln { + /// Fwd decls. + template <unsigned D> struct grid_; + template <typename C> struct dpoint1d_; + template <typename C> struct point1d_; + + + typedef grid_<1> grid1d; + typedef dpoint1d_<int> dpoint1d; + typedef point1d_<int> point1d; + + + /* FIXME: Is this the right place for these functions (on types)? In particular, the function on dpoint1d should be near the definition of dpoint1d, not point1d's. */ @@ -49,6 +59,7 @@ /// \} + /// Super type. template<typename C> struct set_super_type< point1d_<C> > @@ -72,10 +83,10 @@ /// General 1D point class. template <typename C> - class point1d_ : public stc_get_supers(point1d_<C>) + class point1d_ : public internal::point_nd< point1d_<C> > { typedef point1d_<C> self_t; - typedef stc_get_super(point1d_<C>) super_t; + typedef internal::point_nd<self_t> super_t; using super_t::v_; Index: oln/core/2d/neighb2d.hh =================================================================== --- oln/core/2d/neighb2d.hh (revision 705) +++ oln/core/2d/neighb2d.hh (working copy) @@ -36,6 +36,8 @@ namespace oln { + typedef neighb_<dpoint2d> neighb2d; + namespace internal { Index: oln/core/2d/dpoint2d.hh =================================================================== --- oln/core/2d/dpoint2d.hh (revision 705) +++ oln/core/2d/dpoint2d.hh (working copy) @@ -32,14 +32,14 @@ # include <mlc/int.hh> # include <oln/core/2d/point2d.hh> # include <oln/core/internal/dpoint_nd.hh> -// For oln::dpoint2d and oln::dpoint2df. -# include <oln/core/2d/aliases.hh> namespace oln { + typedef dpoint2d_<int> dpoint2d; + /// Super type. template<typename C> struct set_super_type< dpoint2d_<C> > @@ -48,6 +48,13 @@ }; + /// Fwd decls. + template <unsigned D> struct grid_; + typedef grid_<2> grid2d; + template <typename C> struct point2d_; + typedef point2d_<int> point2d; + + /// Virtual types associated to oln::dpoint2d_<C>. template <typename C> struct vtypes< dpoint2d_<C> > @@ -65,10 +72,10 @@ /// General 2D dpoint class. template <typename C> class dpoint2d_ - : public stc_get_supers(dpoint2d_<C>) + : public internal::dpoint_nd< dpoint2d_<C> > { typedef dpoint2d_<C> self_t; - typedef stc_get_super(dpoint2d_<C>) super_t; + typedef internal::dpoint_nd<self_t> super_t; using super_t::v_; Index: oln/core/2d/point2d.hh =================================================================== --- oln/core/2d/point2d.hh (revision 705) +++ oln/core/2d/point2d.hh (working copy) @@ -31,13 +31,23 @@ # include <mlc/int.hh> # include <oln/core/internal/point_nd.hh> -// For oln::point2d and oln::point2df. -# include <oln/core/2d/aliases.hh> namespace oln { + + /// Fwd decls. + template <unsigned D> struct grid_; + template <typename C> struct dpoint2d_; + template <typename C> struct point2d_; + + + typedef grid_<2> grid2d; + typedef dpoint2d_<int> dpoint2d; + typedef point2d_<int> point2d; + + /* FIXME: Is this the right place for these functions (on types)? In particular, the function on dpoint2d should be near the definition of dpoint2d, not point2d's. */ @@ -49,6 +59,7 @@ /// \} + /// Super type. template<typename C> struct set_super_type< point2d_<C> > @@ -73,10 +84,10 @@ /// General 2D point class. template <typename C> - class point2d_ : public stc_get_supers(point2d_<C>) + class point2d_ : public internal::point_nd< point2d_<C> > { - typedef point2d_<C> self_t; - typedef stc_get_super(point2d_<C>) super_t; + typedef point2d_<C> self_t; + typedef internal::point_nd<self_t> super_t; using super_t::v_; Index: oln/core/3d/neighb3d.hh =================================================================== --- oln/core/3d/neighb3d.hh (revision 705) +++ oln/core/3d/neighb3d.hh (working copy) @@ -36,6 +36,9 @@ namespace oln { + typedef neighb_<dpoint3d> neighb3d; + + namespace internal { Index: oln/core/3d/dpoint3d.hh =================================================================== --- oln/core/3d/dpoint3d.hh (revision 705) +++ oln/core/3d/dpoint3d.hh (working copy) @@ -32,13 +32,13 @@ # include <mlc/int.hh> # include <oln/core/3d/point3d.hh> # include <oln/core/internal/dpoint_nd.hh> -// For oln::dpoint3d and oln::dpoint3df. -# include <oln/core/3d/aliases.hh> namespace oln { + typedef dpoint3d_<int> dpoint3d; + /// Super type. template<typename C> @@ -48,6 +48,13 @@ }; + /// Fwd decls. + template <unsigned D> struct grid_; + typedef grid_<3> grid3d; + template <typename C> struct point3d_; + typedef point3d_<int> point3d; + + /// Virtual types associated to oln::dpoint3d_<C>. template <typename C> struct vtypes< dpoint3d_<C> > @@ -66,10 +73,10 @@ /// General 3D dpoint class. template <typename C> class dpoint3d_ - : public stc_get_supers(dpoint3d_<C>) + : public internal::dpoint_nd< dpoint3d_<C> > { typedef dpoint3d_<C> self_t; - typedef stc_get_super(dpoint3d_<C>) super_t; + typedef internal::dpoint_nd<self_t> super_t; using super_t::v_; Index: oln/core/3d/point3d.hh =================================================================== --- oln/core/3d/point3d.hh (revision 705) +++ oln/core/3d/point3d.hh (working copy) @@ -31,13 +31,22 @@ # include <mlc/int.hh> # include <oln/core/internal/point_nd.hh> -// For oln::point3d and oln::point3df. -# include <oln/core/3d/aliases.hh> namespace oln { + /// Fwd decls. + template <unsigned D> struct grid_; + template <typename C> struct dpoint3d_; + template <typename C> struct point3d_; + + + typedef grid_<3> grid3d; + typedef dpoint3d_<int> dpoint3d; + typedef point3d_<int> point3d; + + /* FIXME: Is this the right place for these functions (on types)? In particular, the function on dpoint3d should be near the definition of dpoint3d, not point3d's. */ @@ -49,6 +58,7 @@ /// \} + /// Super type. template<typename C> struct set_super_type< point3d_<C> > @@ -74,10 +84,10 @@ /// General 3D point class. template <typename C> - class point3d_ : public stc_get_supers(point3d_<C>) + class point3d_ : public internal::point_nd< point3d_<C> > { - typedef point3d_<C> self_t; - typedef stc_get_super(point3d_<C>) super_t; + typedef point3d_<C> self_t; + typedef internal::point_nd<self_t> super_t; using super_t::v_; Index: oln/core/gen/bkd_qiter_win.hh =================================================================== --- oln/core/gen/bkd_qiter_win.hh (revision 705) +++ oln/core/gen/bkd_qiter_win.hh (working copy) @@ -55,7 +55,7 @@ struct vtypes< bkd_qiter_win_<point_t> > { typedef point_t point_type; - typedef oln_type_of(point_t, grid) grid_type; + typedef oln_grid(point_t) grid_type; }; @@ -67,7 +67,7 @@ typedef bkd_qiter_win_<point_t> self_t; typedef abstract::iterator_on_points<self_t> super_t; - typedef oln_type_of(point_t, dpoint) dpoint_t; + typedef oln_dpoint(point_t) dpoint_t; public: Index: oln/core/gen/grid.hh =================================================================== --- oln/core/gen/grid.hh (revision 705) +++ oln/core/gen/grid.hh (working copy) @@ -56,7 +56,7 @@ /// A 1D grid. template <unsigned D> - struct grid_ : public stc_get_supers(grid_<D>) + struct grid_ : public abstract::grid< grid_<D> > { protected: grid_() {} Index: oln/core/gen/bkd_viter_lut.hh =================================================================== --- oln/core/gen/bkd_viter_lut.hh (revision 705) +++ oln/core/gen/bkd_viter_lut.hh (working copy) @@ -61,12 +61,12 @@ /// Backward value iterator on look-up table. template <typename Lut> class bkd_viter_lut : - public stc_get_supers(bkd_viter_lut<Lut>) + public abstract::iterator_on_values< bkd_viter_lut<Lut> > // Check that Lut is a look-up table. // FIXME: an abstract::lookup_table would be useful. { - typedef bkd_viter_lut<Lut> self_t; - typedef stc_get_super(self_t) super_t; + typedef bkd_viter_lut<Lut> self_t; + typedef abstract::iterator_on_values<self_t> super_t; typedef oln_type_of(self_t, lut_iter) lut_iter_t; public: Index: oln/core/gen/bbox_fwd_piter.hh =================================================================== --- oln/core/gen/bbox_fwd_piter.hh (revision 705) +++ oln/core/gen/bbox_fwd_piter.hh (working copy) @@ -54,7 +54,7 @@ struct vtypes< bbox_fwd_piter_<point> > { typedef point point_type; - typedef oln_type_of(point, grid) grid_type; + typedef oln_grid(point) grid_type; }; Index: oln/core/gen/fwd_piter_bbox.hh =================================================================== --- oln/core/gen/fwd_piter_bbox.hh (revision 705) +++ oln/core/gen/fwd_piter_bbox.hh (working copy) @@ -56,15 +56,16 @@ struct vtypes< fwd_piter_bbox_<point_t> > { typedef point_t point_type; - typedef oln_type_of(point_t, grid) grid_type; + typedef oln_grid(point_t) grid_type; }; /// Abstract forward point iterator class. template <typename point_t> - class fwd_piter_bbox_ : public internal::bbox_fwd_piter< fwd_piter_bbox_<point_t> >, - private mlc::assert_< mlc_is_a(point_t, abstract::point) > + class fwd_piter_bbox_ : public internal::bbox_fwd_piter< fwd_piter_bbox_<point_t> > + // FIXME: Rec? +// , private mlc::assert_< mlc_is_a(point_t, abstract::point) > { typedef fwd_piter_bbox_<point_t> self_t; typedef internal::bbox_fwd_piter<self_t> super_t; Index: oln/core/gen/fwd_niter_neighb.hh =================================================================== --- oln/core/gen/fwd_niter_neighb.hh (revision 705) +++ oln/core/gen/fwd_niter_neighb.hh (working copy) @@ -55,7 +55,7 @@ struct vtypes< fwd_niter_neighb_<point_t> > { typedef point_t point_type; - typedef oln_type_of(point_t, grid) grid_type; + typedef oln_grid(point_t) grid_type; }; @@ -67,7 +67,7 @@ typedef fwd_niter_neighb_<point_t> self_t; typedef abstract::iterator_on_points<self_t> super_t; - typedef oln_type_of(point_t, dpoint) dpoint_t; + typedef oln_dpoint(point_t) dpoint_t; public: Index: oln/core/gen/fwd_qiter_win.hh =================================================================== --- oln/core/gen/fwd_qiter_win.hh (revision 705) +++ oln/core/gen/fwd_qiter_win.hh (working copy) @@ -55,7 +55,7 @@ struct vtypes< fwd_qiter_win_<point_t> > { typedef point_t point_type; - typedef oln_type_of(point_t, grid) grid_type; + typedef oln_grid(point_t) grid_type; }; @@ -67,7 +67,7 @@ typedef fwd_qiter_win_<point_t> self_t; typedef abstract::iterator_on_points<self_t> super_t; - typedef oln_type_of(point_t, dpoint) dpoint_t; + typedef oln_dpoint(point_t) dpoint_t; public: Index: oln/core/gen/bbox_bkd_piter.hh =================================================================== --- oln/core/gen/bbox_bkd_piter.hh (revision 705) +++ oln/core/gen/bbox_bkd_piter.hh (working copy) @@ -54,7 +54,7 @@ struct vtypes< bbox_bkd_piter_<point> > { typedef point point_type; - typedef oln_type_of(point, grid) grid_type; + typedef oln_grid(point) grid_type; }; Index: oln/core/gen/bkd_piter_bbox.hh =================================================================== --- oln/core/gen/bkd_piter_bbox.hh (revision 705) +++ oln/core/gen/bkd_piter_bbox.hh (working copy) @@ -56,15 +56,16 @@ struct vtypes< bkd_piter_bbox_<point_t> > { typedef point_t point_type; - typedef oln_type_of(point_t, grid) grid_type; + typedef oln_grid(point_t) grid_type; }; /// Abstract forward point iterator class. template <typename point_t> - class bkd_piter_bbox_ : public internal::bbox_bkd_piter< bkd_piter_bbox_<point_t> >, - private mlc::assert_< mlc_is_a(point_t, abstract::point) > + class bkd_piter_bbox_ : public internal::bbox_bkd_piter< bkd_piter_bbox_<point_t> > + // FIXME: Rec? +// , private mlc::assert_< mlc_is_a(point_t, abstract::point) > { typedef bkd_piter_bbox_<point_t> self_t; typedef internal::bbox_bkd_piter<self_t> super_t; Index: oln/core/gen/bkd_niter_neighb.hh =================================================================== --- oln/core/gen/bkd_niter_neighb.hh (revision 705) +++ oln/core/gen/bkd_niter_neighb.hh (working copy) @@ -55,7 +55,7 @@ struct vtypes< bkd_niter_neighb_<point_t> > { typedef point_t point_type; - typedef oln_type_of(point_t, grid) grid_type; + typedef oln_grid(point_t) grid_type; }; @@ -67,7 +67,7 @@ typedef bkd_niter_neighb_<point_t> self_t; typedef abstract::iterator_on_points<self_t> super_t; - typedef oln_type_of(point_t, dpoint) dpoint_t; + typedef oln_dpoint(point_t) dpoint_t; public: Index: oln/core/gen/fwd_viter_lut.hh =================================================================== --- oln/core/gen/fwd_viter_lut.hh (revision 705) +++ oln/core/gen/fwd_viter_lut.hh (working copy) @@ -61,12 +61,12 @@ /// Forward value iterator on look-up table. template <typename Lut> class fwd_viter_lut : - public stc_get_supers(fwd_viter_lut<Lut>) + public abstract::iterator_on_values< fwd_viter_lut<Lut> > // Check that Lut is a look-up table. // FIXME: an abstract::lookup_table would be useful. { - typedef fwd_viter_lut<Lut> self_t; - typedef stc_get_super(self_t) super_t; + typedef fwd_viter_lut<Lut> self_t; + typedef abstract::iterator_on_values<self_t> super_t; typedef oln_type_of(self_t, lut_iter) lut_iter_t; public: Index: oln/core/gen/topo_add_nbh.hh =================================================================== --- oln/core/gen/topo_add_nbh.hh (revision 705) +++ oln/core/gen/topo_add_nbh.hh (working copy) @@ -54,15 +54,10 @@ struct vtypes< topo_add_nbh<topo, nbh> > { typedef nbh neighborhood_type; + typedef topo delegated_type; }; - template <typename topo, typename nbh> - struct single_vtype< topo_add_nbh<topo, nbh>, typedef_::delegated_type > - { - typedef topo ret; - }; - /// Bounding box topology based on a point class. 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/topology_morpher.hh =================================================================== --- oln/core/internal/topology_morpher.hh (revision 705) +++ oln/core/internal/topology_morpher.hh (working copy) @@ -49,18 +49,13 @@ }; template <typename Topo, typename E> - struct single_vtype< internal::topology_morpher<Topo, E>, typedef_::morpher_type > + struct vtypes< internal::topology_morpher<Topo, E> > { - typedef morpher::tag::identity ret; + typedef morpher::tag::identity morpher_type; + typedef Topo delegated_type; }; - template <typename Topo, typename E> - struct single_vtype< internal::topology_morpher<Topo, E>, typedef_::delegated_type > - { - typedef Topo ret; - }; - namespace internal { Index: oln/core/internal/point_nd.hh =================================================================== --- oln/core/internal/point_nd.hh (revision 705) +++ oln/core/internal/point_nd.hh (working copy) @@ -68,6 +68,22 @@ }; + template <typename E> + struct vtypes< internal::point_nd<E> > + { + private: + typedef oln_dim(E) dim_t; + typedef oln_coord(E) coord_t; + typedef xtd::vec<mlc_value(dim_t), coord_t> vec_t; + public: + + typedef double psite_type; + + typedef typename vec_t::self_type vec_type; + // typedef xtd::vec<mlc_value(dim_t), coord_t> vec_type; + }; + + namespace internal { @@ -75,14 +91,14 @@ class point_nd : public abstract::point<E> { typedef point_nd<E> self_t; - typedef oln_type_of(E, dim) dim; - typedef oln_type_of(E, coord) coord_t; - typedef oln_type_of(E, dpoint) dpoint_t; - typedef oln_type_of(E, vec) vec_t; + typedef oln_dim(E) dim_t; + typedef oln_coord(E) coord_t; + typedef oln_dpoint(E) dpoint_t; + typedef xtd::vec< mlc_value(dim_t), coord_t> vec_t; public: - enum { n = mlc_value(dim) }; + enum { n = mlc_value(dim_t) }; coord_t operator[](unsigned i) const; coord_t& operator[](unsigned i); Index: oln/core/internal/dpoint_nd.hh =================================================================== --- oln/core/internal/dpoint_nd.hh (revision 705) +++ oln/core/internal/dpoint_nd.hh (working copy) @@ -51,6 +51,19 @@ }; + template <typename E> + struct vtypes< internal::dpoint_nd<E> > + { + private: + typedef oln_dim(E) dim_t; + typedef oln_coord(E) coord_t; + typedef xtd::vec<mlc_value(dim_t), coord_t> vec_t; + public: + typedef typename vec_t::self_type vec_type; + // typedef xtd::vec<mlc_value(dim_t), coord_t> vec_type; + }; + + namespace internal { @@ -59,13 +72,13 @@ { typedef E exact_t; typedef dpoint_nd<E> self_t; - typedef oln_type_of(E, dim) dim; - typedef oln_type_of(E, coord) coord_t; + typedef oln_dim(E) dim_t; + typedef oln_coord(E) coord_t; + typedef xtd::vec< mlc_value(dim_t), coord_t> vec_t; public: - enum { n = mlc_value(dim) }; - typedef xtd::vec<n,coord_t> vec_t; + enum { n = mlc_value(dim_t) }; bool impl_equal(const dpoint_nd<E>& rhs) const; Index: oln/basics2d.hh =================================================================== --- oln/basics2d.hh (revision 705) +++ oln/basics2d.hh (working copy) @@ -46,6 +46,8 @@ # include <oln/core/2d/topo2d.hh> +# include <oln/core/iterator_vtypes.hh> + # include <oln/core/gen/fwd_piter_bbox.hh> # include <oln/core/gen/bkd_piter_bbox.hh> @@ -58,8 +60,6 @@ # include <oln/core/2d/image2d.hh> -# include <oln/core/iterator_vtypes.hh> - # include <oln/core/spe/row.hh> # include <oln/core/spe/col.hh> Index: oln/morpher/add_isubset.hh =================================================================== --- oln/morpher/add_isubset.hh (revision 705) +++ oln/morpher/add_isubset.hh (working copy) @@ -61,37 +61,13 @@ struct vtypes< morpher::add_isubset<Image, Isubset> > { // Topology type. - typedef topo_add_isubset< oln_type_of(Image, topo), Isubset > topo_type; + typedef topo_add_isubset< oln_topo(Image), Isubset > topo_type; // Isubset type. typedef Isubset subset_type; }; -// template <typename Image, typename Isubset> -// struct single_vtype< morpher::add_isubset<Image, Isubset>, typedef_::fwd_niter_type > -// { -// private: -// typedef oln_type_of(Image, fwd_niter) basic_fwd_niter_type; -// typedef topo_add_isubset< oln_type_of(Image, topo), Isubset > new_topo_type; -// typedef typename basic_fwd_niter_type::template change_topology_<new_topo_type>::ret intra_fwd_niter_type; -// public: -// typedef piter_isubset_<intra_fwd_niter_type, Isubset> ret; -// }; - - -// template <typename Image, typename Isubset> -// struct single_vtype< morpher::add_isubset<Image, Isubset>, typedef_::bkd_niter_type > -// { -// private: -// typedef oln_type_of(Image, bkd_niter) basic_bkd_niter_type; -// typedef topo_add_isubset< oln_type_of(Image, topo), Isubset > new_topo_type; -// typedef typename basic_bkd_niter_type::template change_topology_<new_topo_type>::ret intra_bkd_niter_type; -// public: -// typedef piter_isubset_<intra_bkd_niter_type, Isubset> ret; -// }; - - namespace morpher { /// Isubset addition morpher. @@ -103,8 +79,8 @@ private: typedef add_isubset<Image, Isubset> self_t; - typedef stc_get_nth_super(self_t, 1) super_t; - typedef oln_direct_type_of(self_t, topo) topo_t; + typedef internal::image_extension<Image, self_t> super_t; + typedef oln_topo(self_t) topo_t; // FIXME: use of oln_direct_type_of here!!! otherwise we get some compilation trouble... public: Index: oln/morpher/value_cast.hh =================================================================== --- oln/morpher/value_cast.hh (revision 705) +++ oln/morpher/value_cast.hh (working copy) @@ -59,12 +59,8 @@ { typedef mlc::true_ is_computed_type; typedef Value value_type; - }; - template <typename Image, typename Value> - struct single_vtype< morpher::value_cast<Image, Value>, typedef_::rvalue_type > - { - typedef Value ret; + typedef Value rvalue_type; }; Index: oln/morpher/two_way.hh =================================================================== --- oln/morpher/two_way.hh (revision 705) +++ oln/morpher/two_way.hh (working copy) @@ -61,12 +61,8 @@ typedef typename Fun::result_type value_type; typedef value::two_way<Image, Fun> lvalue_type; - }; - template <typename Image, typename Fun> - struct single_vtype< morpher::two_way<Image, Fun>, typedef_::rvalue_type > - { - typedef typename Fun::result_type ret; + typedef typename Fun::result_type rvalue_type; }; Index: oln/morpher/identity.hh =================================================================== --- oln/morpher/identity.hh (revision 705) +++ oln/morpher/identity.hh (working copy) @@ -55,11 +55,11 @@ { /// Identity morpher. template <typename Image> - class identity : public stc_get_supers(identity<Image>) + class identity : public internal::image_extension<Image, identity<Image> > { private: typedef identity<Image> self_t; - typedef stc_get_nth_super(self_t, 1) super_t; + typedef internal::image_extension<Image, self_t> super_t; public: // FIXME: Handle the constness. Index: oln/morpher/thru_fun.hh =================================================================== --- oln/morpher/thru_fun.hh (revision 705) +++ oln/morpher/thru_fun.hh (working copy) @@ -60,19 +60,13 @@ { private: typedef oln_type_of(Image, rvalue) old_value_type; + typedef morpher::thru_fun<Image, Fun> self_t; public: typedef mlc::true_ is_computed_type; typedef xtd_res_1(Fun, old_value_type) value_type; - }; - - template <typename Image, typename Fun> - struct single_vtype< morpher::thru_fun<Image, Fun>, typedef_::rvalue_type > - { - typedef morpher::thru_fun<Image, Fun> self_t; - typedef oln_value(self_t) ret; + typedef oln_value(self_t) rvalue_type; }; - namespace morpher Index: oln/morpher/slice.hh =================================================================== --- oln/morpher/slice.hh (revision 705) +++ oln/morpher/slice.hh (working copy) @@ -67,9 +67,16 @@ struct vtypes< morpher::slice<Image> > { private: + typedef morpher::slice<Image> self_t; + typedef oln_deduce_type_of(Image, grid, dimvalue) orig_dimvalue_type; typedef mlc::uint_< mlc_value(orig_dimvalue_type) - 1 > dimvalue_type; + typedef oln_type_of(Image, fwd_piter) orig_fwd_piter; + typedef oln_type_of(Image, bkd_piter) orig_bkd_piter; + typedef oln_type_of(Image, fwd_qiter) orig_fwd_qiter; + typedef oln_type_of(Image, bkd_qiter) orig_bkd_qiter; + public: typedef typename type_fun::slice_topo< oln_type_of(Image, topo) >::ret topo_type; @@ -84,7 +91,7 @@ // piter_type: see below. - typedef oln_type_of(Image, value) value_type; + typedef oln_value(Image) value_type; // rvalue_type: see below. // lvalue_type: see below. @@ -96,106 +103,27 @@ typedef oln::morpher::tag::slice morpher_type; - }; + // Final. + typedef oln_deduce(Image, point, coord) coord_type; + typedef oln_point(self_t) psite_type; + typedef oln_fwd_piter(Image) piter_type; + typedef oln_rvalue(Image) rvalue_type; + typedef oln_lvalue(Image) lvalue_type; - // Coord. - template <typename Image> - struct single_vtype< morpher::slice<Image>, typedef_::coord_type > - { - typedef oln_deduce_type_of(Image, point, coord) ret; + typedef typename type_fun::slice_iterator<orig_fwd_piter>::ret fwd_piter_type; + typedef typename type_fun::slice_iterator<orig_bkd_piter>::ret bkd_piter_type; + typedef typename type_fun::slice_iterator<orig_fwd_qiter>::ret fwd_qiter_type; + typedef typename type_fun::slice_iterator<orig_bkd_qiter>::ret bkd_qiter_type; + // FIXME: What about niters on morpher::slice? }; - // Psite. - template <typename Image> - struct single_vtype< morpher::slice<Image>, typedef_::psite_type > - { - private: - typedef morpher::slice<Image> self_t; - public: - typedef oln_type_of(self_t, point) ret; - }; - /* FIXME: Should we keep the `piter' vtype, knowing that the macro - `oln_piter' gives the `fwd_piter' vtype (and not the `piter' - vtype)? */ - // Piter. - template <typename Image> - struct single_vtype< morpher::slice<Image>, typedef_::piter_type > - { - typedef oln_type_of(Image, fwd_piter) ret; - }; - // Rvalue. - template <typename Image> - struct single_vtype< morpher::slice<Image>, typedef_::rvalue_type > - { - typedef oln_type_of(Image, rvalue) ret; - }; - - // Lvalue. - template <typename Image> - struct single_vtype< morpher::slice<Image>, typedef_::lvalue_type > - { - typedef oln_type_of(Image, lvalue) ret; - }; - /// \} - - - // piters. - - /// fwd_piter vtype of morpher::slice. - template <typename Image> - struct single_vtype< morpher::slice<Image>, typedef_::fwd_piter_type > - { - private: - typedef oln_type_of(Image, fwd_piter) orig_fwd_piter; - public: - typedef typename type_fun::slice_iterator<orig_fwd_piter>::ret ret; - }; - - /// bkd_piter vtype of morpher::slice. - template <typename Image> - struct single_vtype< morpher::slice<Image>, typedef_::bkd_piter_type > - { - private: - typedef oln_type_of(Image, bkd_piter) orig_bkd_piter; - public: - typedef typename type_fun::slice_iterator<orig_bkd_piter>::ret ret; - }; - - - // qiters. - - /// fwd_qiter vtype of morpher::slice. - template <typename Image> - struct single_vtype< morpher::slice<Image>, typedef_::fwd_qiter_type > - { - private: - typedef oln_type_of(Image, fwd_qiter) orig_fwd_qiter; - public: - typedef typename type_fun::slice_iterator<orig_fwd_qiter>::ret ret; - }; - - /// bkd_qiter vtype of morpher::slice. - template <typename Image> - struct single_vtype< morpher::slice<Image>, typedef_::bkd_qiter_type > - { - private: - typedef oln_type_of(Image, bkd_qiter) orig_bkd_qiter; - public: - typedef typename type_fun::slice_iterator<orig_bkd_qiter>::ret ret; - }; - - - // FIXME: What about niters on morpher::slice? - - - namespace morpher { template <typename Image> - class slice : public stc_get_supers(slice<Image>) + class slice : public image_entry< slice<Image> > { typedef slice<Image> self_t; Index: oln/morpher/with_lut.hh =================================================================== --- oln/morpher/with_lut.hh (revision 705) +++ oln/morpher/with_lut.hh (working copy) @@ -61,14 +61,18 @@ { private: typedef oln_type_of(Image, rvalue) orig_value_type; + typedef morpher::with_lut<Image, Lut> self_t; public: typedef mlc::true_ is_computed_type; + // Value type. - typedef typename Lut::new_value_type value_type; + typedef typename Lut::new_value_type value_type; + typedef value_type rvalue_type; + typedef mlc::not_ok lvalue_type; + // Look-up table type. typedef Lut lut_type; - // rvalue_type: see below. /* lvalue_type: undefined (see oln/morpher/internal/image_value_morpher.hh). */ @@ -80,52 +84,22 @@ a mutable value proxy. */ typedef value::mutable_lut_value_proxy<Lut> mutable_value_proxy_type; - // fwd_viter_type: see below. - // bkd_viter_type: see below. + typedef fwd_viter_lut<Lut> fwd_viter_type; + typedef bkd_viter_lut<Lut> bkd_viter_type; }; - // Rvalue. - template <typename Image, typename Lut> - struct single_vtype< morpher::with_lut<Image, Lut>, typedef_::rvalue_type > - { - private: - typedef morpher::with_lut<Image, Lut> self_t; - public: - typedef oln_value(self_t) ret; - }; - /// Forward value iterator virtual type for morpher::with_lut. - template <typename Image, typename Lut> - struct single_vtype< morpher::with_lut<Image, Lut>, - typedef_::fwd_viter_type > - { - typedef fwd_viter_lut<Lut> ret; - }; - /// Backward value iterator virtual type for morpher::with_lut. - template <typename Image, typename Lut> - struct single_vtype< morpher::with_lut<Image, Lut>, - typedef_::bkd_viter_type > - { - typedef bkd_viter_lut<Lut> ret; - }; - /// \} - - - // FIXME: What about bkd_viter_type on morpher::with_lut? - - - namespace morpher { /// Look-up table addition morpher. template <typename Image, typename Lut> - class with_lut : public stc_get_supers(mlc_comma_1(with_lut<Image, Lut>)) + class with_lut : public internal::image_value_morpher<Image, with_lut<Image, Lut> > // FIXME: Ensure oln_value(Image) == Lut::new_value_type? Or just let // the ctor check this property? { - typedef with_lut<Image, Lut> self_t; - typedef stc_get_super(self_t) super_t; + typedef with_lut<Image, Lut> self_t; + typedef internal::image_value_morpher<Image, self_t> super_t; public: typedef Lut lut_type; Index: oln/morpher/count_rw.hh =================================================================== --- oln/morpher/count_rw.hh (revision 705) +++ oln/morpher/count_rw.hh (working copy) @@ -61,12 +61,8 @@ typedef oln_value(Image) value_type; typedef value::rw_counter<Image> lvalue_type; - }; - template <typename Image> - struct single_vtype< morpher::count_rw_<Image>, typedef_::rvalue_type > - { - typedef value::ro_counter<Image> ret; + typedef value::ro_counter<Image> rvalue_type; }; Index: oln/morpher/two_way_rw.hh =================================================================== --- oln/morpher/two_way_rw.hh (revision 705) +++ oln/morpher/two_way_rw.hh (working copy) @@ -61,12 +61,8 @@ typedef typename Fun::result_type value_type; typedef value::two_way<Image, Fun> lvalue_type; - }; - template <typename Image, typename Fun> - struct single_vtype< morpher::two_way_rw<Image, Fun>, typedef_::rvalue_type > - { - typedef typename Fun::result_type ret; + typedef typename Fun::result_type rvalue_type; }; Index: oln/morpher/stack.hh =================================================================== --- oln/morpher/stack.hh (revision 705) +++ oln/morpher/stack.hh (working copy) @@ -57,12 +57,8 @@ { typedef mlc::true_ is_computed_type; typedef xtd::vec<n, oln_value(I)> value_type; - }; - template <unsigned n, typename I> - struct single_vtype< morpher::stack<n, I>, typedef_::rvalue_type > - { - typedef xtd::vec<n, oln_value(I)> ret; + typedef xtd::vec<n, oln_value(I)> rvalue_type; }; Index: oln/morpher/thru_mfun.hh =================================================================== --- oln/morpher/thru_mfun.hh (revision 705) +++ oln/morpher/thru_mfun.hh (working copy) @@ -60,19 +60,14 @@ { private: typedef oln_type_of(Image, rvalue) old_value_type; + typedef morpher::thru_mfun<Image, Fun> self_t; public: typedef mlc::false_ is_computed_type; typedef typename xtd::res_<Fun, old_value_type>::ret value_type; typedef value_type& lvalue_type; - }; - template <typename Image, typename Fun> - struct single_vtype< morpher::thru_mfun<Image, Fun>, typedef_::rvalue_type > - { - typedef morpher::thru_mfun<Image, Fun> self_t; - typedef oln_value(self_t) ret; + typedef oln_value(self_t) rvalue_type; }; - namespace morpher Index: oln/morpher/stack_rw.hh =================================================================== --- oln/morpher/stack_rw.hh (revision 705) +++ oln/morpher/stack_rw.hh (working copy) @@ -81,24 +81,12 @@ public: typedef mlc::true_ is_computed_type; typedef xtd::vec<n, oln_value(I)> value_type; + + typedef value::two_way<self_t, fun_t> lvalue_type; + typedef xtd::vec<n, oln_value(I)> rvalue_type; }; - template <unsigned n, typename I> - struct single_vtype< morpher::stack_rw<n, I>, typedef_::lvalue_type > - { - typedef morpher::stack_rw<n, I> self_t; - typedef rwvec<n, oln_value(I)> fun_t; - typedef value::two_way<self_t, fun_t> ret; - }; - template <unsigned n, typename I> - struct single_vtype< morpher::stack_rw<n, I>, typedef_::rvalue_type > - { - typedef xtd::vec<n, oln_value(I)> ret; - }; - - - namespace morpher { Index: oln/morpher/internal/image_value_morpher.hh =================================================================== --- oln/morpher/internal/image_value_morpher.hh (revision 705) +++ oln/morpher/internal/image_value_morpher.hh (working copy) @@ -65,19 +65,13 @@ // Morpher type. typedef oln::morpher::tag::identity morpher_type; // FIXME: Wrong! - typedef mlc::undefined is_computed_type; - typedef mlc::undefined lvalue_type; - typedef mlc::undefined value_type; + typedef mlc::not_found is_computed_type; + typedef mlc::not_found value_type; + typedef mlc::not_found lvalue_type; + typedef mlc::not_found rvalue_type; }; - template <typename Image, typename Exact> - struct single_vtype< morpher::internal::image_value_morpher<Image, Exact>, - typedef_::rvalue_type > - { - typedef mlc::undefined ret; - }; - namespace morpher { namespace internal Index: oln/morpher/add_neighborhood.hh =================================================================== --- oln/morpher/add_neighborhood.hh (revision 705) +++ oln/morpher/add_neighborhood.hh (working copy) @@ -70,13 +70,13 @@ /// Neighborhood addition morpher. template <typename Image, typename Neighb> class add_neighborhood : - public stc_get_supers(mlc_comma_1(add_neighborhood<Image, Neighb>)) + public internal::image_extension<Image, add_neighborhood<Image, Neighb> > { private: typedef add_neighborhood<Image, Neighb> self_t; - typedef stc_get_super(self_t) super_t; - typedef oln_type_of(self_t, topo) topo_t; + typedef internal::image_extension<Image, self_t> super_t; + typedef oln_topo(self_t) topo_t; public:
18Â years, 1Â month
1
0
0
0
706: Simplify scoop facilities.
by Thierry GERAUD
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. Index: stc/scoop.hh =================================================================== --- stc/scoop.hh (revision 705) +++ stc/scoop.hh (working copy) @@ -43,51 +43,19 @@ # include <mlc/abort.hh> # include <mlc/bool.hh> -# include <mlc/int.hh> # include <mlc/cmp.hh> # include <mlc/if.hh> # include <mlc/is_a.hh> -# include <mlc/comma.hh> -# include <mlc/valist.hh> -# include <stc/valist_aggregator.hh> -# include <stc/exact.hh> -# include <stc/internal/extract_vtype_from_list.hh> - - -/*-----------------. -| Error messages. | -`-----------------*/ - namespace stc { + /// Error messages raised by static assertions/abortions. namespace ERROR { - /// Errors from internal::get_super_types_helper. - /// \{ - struct PARAMETER_OF_get_super_types_helper_IS_NOT_A_VALID_VALIST; - /// \} - - /// Errors from internal rec_get_vtype. - /// \{ - struct FIRST_PARAMETER_OF_rec_get_vtype_IS_NOT_A_TAG; - - struct FIRST_PARAMETER_OF_rec_get_vtype_from_list_IS_NOT_A_TAG; - struct THIRD_PARAMETER_OF_rec_get_vtype_from_list_IS_NOT_A_LIST; - /// \} - - /// Errors from internal::select_typedef. - /// \{ - struct VIRTUAL_TYPE_MULTIPLY_DEFINED_AS_INTERNAL_AND_SINGLE; - struct VIRTUAL_TYPE_MULTIPLY_DEFINED_AS_INTERNAL_AND_EXTERNAL; - struct VIRTUAL_TYPE_MULTIPLY_DEFINED_AS_SINGLE_AND_EXTERNAL; - struct VIRTUAL_TYPE_MULTIPLY_DEFINED_AS_INTERNAL_AND_SINGLE_AND_EXTERNAL; - /// \} - /// Errors from check_type_of_ and check_exact_type_of_. /// \{ struct VIRTUAL_TYPE_NOT_FOUND; @@ -99,933 +67,259 @@ -/*------------. -| Equipment. | -`------------*/ - -/// Internal macros, not to be used by the client. -/// \{ - -// Note: TypedefName *must* be of the form `typedef_::foo'. # define stc_internal_get_typedef(Type, TypedefName) \ typename TypedefName::template from_< Type >::ret -# define stc_internal_maybe_get_nth_super_type(Type, Nth) \ - typename internal::maybe_get_super_type< Type, Nth >::ret -# define stc_internal_rec_get_vtype(Type) \ - typename rec_get_vtype< method, category, Type, typedef_type >::ret +# define stc_internal_get_super(Type) \ + typename typedef_::super_type::template from_< Type >::ret -/// \} -// FIXME: Complete support for hierarchies with several super classes. -// FIXME: Could we extract some classes from this gigantic macro? -# define stc_scoop_equipment_for_namespace(SCOOPED_NAMESPACE) \ - \ -namespace SCOOPED_NAMESPACE \ -{ \ - \ - /* ----------------------- */ \ - /* Typedefs declarations. */ \ - /* ----------------------- */ \ - \ - /* Declare the ``uplink'' typedef (access to a pseudosuper class). */ \ - mlc_decl_typedef(pseudosuper_type); \ - \ - \ - /* ------------- */ \ - /* Inheritance. */ \ - /* ------------- */ \ - \ - /* Set super classes. */ \ - \ - template<typename type, unsigned N = 1> \ - struct set_super_type : public mlc::undefined \ - { \ - typedef mlc::none ret; \ - }; \ - \ - \ - /* Get supers list. */ \ - \ - namespace internal \ - { \ - template <typename type, unsigned N> \ - struct maybe_get_super_type \ - { \ - typedef typename \ - mlc::if_< mlc_is_a( mlc_comma_1( set_super_type<type, N> ), \ - mlc::undefined ), \ - mlc::internal::valist_none, \ - mlc_ret(mlc_comma_1(set_super_type< type, N >)) >::ret \ - ret; \ - }; \ - } /* end of namespace SCOOPED_NAMESPACE ::internal */ \ - \ - template <typename type> \ - struct get_supers_list \ - { \ - /* FIXME: Factor with a loop macro? */ \ - typedef stc_internal_maybe_get_nth_super_type(type, 1) s1; \ - typedef stc_internal_maybe_get_nth_super_type(type, 2) s2; \ - typedef stc_internal_maybe_get_nth_super_type(type, 3) s3; \ - typedef stc_internal_maybe_get_nth_super_type(type, 4) s4; \ - typedef stc_internal_maybe_get_nth_super_type(type, 5) s5; \ - typedef stc_internal_maybe_get_nth_super_type(type, 6) s6; \ - typedef stc_internal_maybe_get_nth_super_type(type, 7) s7; \ - typedef stc_internal_maybe_get_nth_super_type(type, 8) s8; \ - typedef stc_internal_maybe_get_nth_super_type(type, 9) s9; \ - \ - typedef mlc::valist_<s1, s2, s3, s4, s5, s6, s7, s8, s9> ret; \ - }; \ - \ - \ - /* Get super classes. */ \ - \ - namespace internal \ - { \ - \ - /** Accessor helper. */ \ - template<typename type> \ - struct get_super_types_helper; \ - \ - /** Accessor helper: specialization for the case of a single */ \ - /** super class. */ \ - template<typename super> \ - struct get_super_types_helper< mlc::valist_ <super> > \ - { \ - /** Return the super class directly. */ \ - typedef super ret; \ - }; \ - \ - /** Accessor helper: specializations for the case of two super */ \ - /** classes or more. */ \ - /* FIXME: Currently works only for 2 and 3 super types. */ \ - template <typename super1, typename super2, typename super3> \ - struct get_super_types_helper< mlc::valist_ <super1, super2, super3> > \ - { \ - /** Return an aggregate of the super classes. */ \ - typedef stc::valist_aggregator< mlc::valist_ <super1, super2, super3> > \ - ret; \ - }; \ - \ - /** Accessor helper: default case (abort). */ \ - template<typename type> \ - struct get_super_types_helper : \ - public mlc::abort_< \ - type, \ - stc::ERROR::PARAMETER_OF_get_super_types_helper_IS_NOT_A_VALID_VALIST \ - > \ - { \ - }; \ - \ - } /* end of namespace SCOOPED_NAMESPACE ::internal */ \ - \ - \ - template<typename type> \ - struct get_super_types \ - { \ - typedef typename get_supers_list<type>::ret supers_list; \ - typedef typename internal::get_super_types_helper<supers_list>::ret ret; \ - }; \ - \ - \ - /* ------------------------ */ \ - /* ``Pseudo'' inheritance. */ \ - /* ------------------------ */ \ - \ - template <typename type> \ - struct set_pseudosuper_type \ - { \ - typedef mlc::none ret; \ - }; \ - \ - \ - /* --------------- */ \ - /* Virtual types. */ \ - /* --------------- */ \ - \ - /** \brief Definition of virtual types. */ \ - /** */ \ - /** There a three kinds of structures for virtual types: */ \ - /** - internal vtypes (\a vtypes); */ \ - /** - single vtypes (\a single_vtype); */ \ - /** - extended vtypes (\a ext_vtype); */ \ - /** */ \ - /** A \a vtype structure can store one or several internal vtypes, */ \ - /** whereas a \a single_vtype or an \a ext_vtype structure can hold */ \ - /** one and only one vtype. */ \ - /** */ \ - /** See tests/tour.cc and tests/vtypes.cc for examples of use. */ \ - /** */ \ - /** A virtual type definition within a \a vtype structure cannot use */ \ - /** the form `stc_type_of(Exact, ...)', which would cause endless */ \ - /** recursions in the class hierarchy. Instead, such definitions */ \ - /** should be placed in \a single_vtype or \a ext_vtype structure. */ \ - /** */ \ - /** Definitions of single vtypes can be ``announced'' in the */ \ - /** corresponding internal vtypes structure, using the \a */ \ - /** mlc::undefined tag (i.e., a vtype defined as \a mlc::undefined in */ \ - /** \a vtypes can be re-defined in a \a single_vtype). */ \ - /** */ \ - /** Apart from this exception, a vtype shall be defined at most by */ \ - /** one of the three structures explained above. */ \ - /** */ \ - /** To put in a nushell, internal vtypes are the default way to define */ \ - /** the vtypes of a class (except those of the form */ \ - /** `stc_type_of(Exact, ...)'); single vtypes are used to transcend */ \ - /** this limitation; and extended vtypes are used to add new vtypes to */ \ - /** a class besides its initial vtypes. */ \ - \ - \ - /* Internal vtypes. */ \ - /* \{ */ \ - \ - /** \brief Internal virtual types associated to \a from_type. */ \ - /** */ \ - /** Specialize this class for the desired \a from_type. */ \ - template <typename category, typename from_type> \ - struct vtypes_in_category \ - { \ - }; \ - \ - /** \brief Internal virtual types associated to \a from_type */ \ - /** having no category. */ \ - /** */ \ - /** Specialize this class for the desired \a from_type. */ \ - template <typename from_type> \ - struct vtypes \ - { \ - }; \ - \ - /** Specialization of vtypes for types without category. */ \ - template <typename from_type> \ - struct vtypes_in_category<void, from_type> : public vtypes<from_type> \ - { \ - }; \ - \ - /** End of the recursive construction of any vtypes hierarchy. */ \ - template <typename category> \ - struct vtypes_in_category<category, mlc::none> \ - { \ - }; \ - \ - /* \} */ \ - \ - \ - /* Single vtype. */ \ - /* \{ */ \ - \ - /** \brief A single virtual type associated to \a from_type. */ \ - /** */ \ - /** Specialize this class for the desired \a from_type. */ \ - template <typename category, typename from_type, typename typedef_type> \ - struct single_vtype_in_category \ - { \ - }; \ - \ - /** \brief A single virtual type associated to \a from_type. */ \ - /** Version for types without category. */ \ - /** */ \ - /** Specialize this class for the desired \a from_type. */ \ - template <typename from_type, typename typedef_type> \ - struct single_vtype \ - { \ - }; \ - \ - /** Specialization of single_vtype for types without category. */ \ - template <typename from_type, typename typedef_type> \ - struct single_vtype_in_category<void, from_type, typedef_type> \ - : public single_vtype<from_type, typedef_type> \ - { \ - }; \ - \ - /** End of the recursive construction of any single_vtype<> */ \ - /** hierarchy. */ \ - template <typename category, typename typedef_type> \ - struct single_vtype_in_category<category, mlc::none, typedef_type> \ - { \ - }; \ - \ - /* \} */ \ - \ - \ - /* Extended vtype. */ \ - /* \{ */ \ - \ - /** \brief An extended virtual type associated to \a from_type. */ \ - /** */ \ - /** Specialize this class for the desired \a from_type. */ \ - template <typename category, typename from_type, typename typedef_type> \ - struct ext_vtype_in_category \ - { \ - }; \ - \ - /** \brief An extended virtual type associated to \a from_type. */ \ - /** Version for types without category. */ \ - /** */ \ - /** Specialize this class for the desired \a from_type. */ \ - template <typename from_type, typename typedef_type> \ - struct ext_vtype \ - { \ - }; \ - \ - /** Specialization of ext_vtype for types without category. */ \ - template <typename from_type, typename typedef_type> \ - struct ext_vtype_in_category<void, from_type, typedef_type> \ - : public ext_vtype<from_type, typedef_type> \ - { \ - }; \ - \ - /** End of the recursive construction of any ext_vtype<> */ \ - /** hierarchy. */ \ - template <typename category, typename typedef_type> \ - struct ext_vtype_in_category<category, mlc::none, typedef_type> \ - { \ - }; \ - \ - /* \} */ \ - \ - \ - /* -------------------- */ \ - /* Internal machinery. */ \ - /* -------------------- */ \ - \ - /** The classes enclosed in this namespace must not be specialized */ \ - /** by the user (they are part of the automatic associated types */ \ - /** retrieval mechanism). */ \ - namespace internal \ - { \ - /* ------------------------------------------ */ \ - /* Recursive retrieval of an internal vtype. */ \ - /* ------------------------------------------ */ \ - \ - /** Tags for retrieval methods. */ \ - namespace tag \ - { \ - \ - /** Abstraction for method tags. */ \ - struct method {}; \ - \ - /** Tag for retrieval within internal vtypes. */ \ - struct internal : public method {}; \ - /** Tag for retrieval within single vtypes. */ \ - struct single : public method {}; \ - /** Tag for retrieval within extended vtypes. */ \ - struct extended : public method {}; \ - \ - } /* end of namespace SCOOPED_NAMESPACE ::internal::tag */ \ - \ - /** Try to get \a typedef_type from \a from_type. In case this */ \ - /** typedef is mlc::not_found, don't perform a recursive */ \ - /** retrieval, simply return mlc::not_found. */ \ - template <typename method, typename category, \ - typename from_type, typename typedef_type> \ - struct get_vtype_helper \ - { \ - /* Nothing (no method selected). */ \ - }; \ - \ - /** Specialization of get_vtypes for retrievals within */ \ - /** internal vtypes. */ \ - template <typename category, \ - typename from_type, typename typedef_type> \ - struct get_vtype_helper<tag::internal, category, \ - from_type, typedef_type> \ - { \ - /** Set of vtypes associated with FROM_TYPE. */ \ - typedef vtypes_in_category<category, from_type> types; \ - /** Typedef in the current vtypes (may be mlc::not_found). */ \ - typedef stc_internal_get_typedef(types, typedef_type) ret; \ - }; \ - \ - /** Specialization of get_vtypes for retrievals within */ \ - /** single vtypes. */ \ - template <typename category, \ - typename from_type, typename typedef_type> \ - struct get_vtype_helper<tag::single, category, \ - from_type, typedef_type> \ - { \ - /** Set of vtypes associated with FROM_TYPE. */ \ - typedef single_vtype_in_category<category, from_type, typedef_type> \ - single_type; \ - /** Typedef in the current single_vtype (may be mlc::not_found). */ \ - typedef mlc_ret(single_type) ret; \ - }; \ - \ - /** Specialization of get_vtypes for retrievals within */ \ - /** extended vtypes. */ \ - template <typename category, \ - typename from_type, typename typedef_type> \ - struct get_vtype_helper<tag::extended, category, \ - from_type, typedef_type> \ - { \ - /** Set of vtypes associated with FROM_TYPE. */ \ - typedef ext_vtype_in_category<category, from_type, typedef_type> \ - ext_type; \ - /** Typedef in the current ext_vtype (may be mlc::not_found). */ \ - typedef mlc_ret(ext_type) ret; \ - }; \ - \ - \ - /* FIXME: Do a basic scheme of the algorithm in pseudo-code. */ \ - \ - /* Forward declaration. */ \ - template <typename method, typename category, \ - typename from_list, typename typedef_type> \ - struct rec_get_vtype_from_list; \ - \ - /** Recursive retrieval of the virtual type \a typedef_type inside */ \ - /** the class \a from_type. */ \ - template <typename method, typename category, \ - typename from_type, typename typedef_type> \ - struct rec_get_vtype : \ - private mlc::assert_< mlc_is_a(method, tag::method), \ - stc::ERROR::FIRST_PARAMETER_OF_rec_get_vtype_IS_NOT_A_TAG > \ - { \ - /** Get potential vtype \a typedef_type from the current class */ \ - /** (\a from_type). */ \ - typedef typename \ - get_vtype_helper< method, category, from_type, typedef_type>::ret \ - type; \ - \ - /** Implicit parents (i.e. supers), if any. */ \ - typedef typename get_supers_list<from_type>::ret supers_list; \ - /** Vtype deduced from the vtypes of the base class(es) of */ \ - /** \a from_type, if any. */ \ - typedef typename \ - rec_get_vtype_from_list< method, category, \ - supers_list, typedef_type >::ret \ - vtype_from_supers; \ - \ - /** Pseudosuper class, if any. */ \ - typedef stc_get_pseudosuper(from_type) pseudosuper; \ - /** Vtype deduced from the vtype of the pseudo super class of */ \ - /** \a from_type, if any. */ \ - typedef typename \ - rec_get_vtype< method, category, pseudosuper, typedef_type >::ret \ - vtype_from_pseudo_super; \ - \ - /* Core of the search algorithm. */ \ - typedef typename \ - mlc::if_< \ - mlc::neq_< type, mlc::not_found >, \ - /* then */ \ - /* return it */ \ - /* (the typedef has been found in the vtypes */ \ - /* associated to FROM_TYPE) */ \ - type, \ - /* else */ \ - /* check if the vtypes of the `supers' of FROM_TYPE */ \ - /* has the typedef */ \ - typename \ - mlc::if_< mlc::neq_< vtype_from_supers, mlc::not_found >, \ - /* then */ \ - /* return it */ \ - vtype_from_supers, \ - /* else */ \ - /* check if the FROM_TYPE has a pseudo super */ \ - /* and try to retrieve the typedef from it. */ \ - vtype_from_pseudo_super >::ret >::ret \ - ret; \ - }; \ - \ - /** Ends of the recursive retrieval (mlc::none is at the end of the */ \ - /** transitive closure of every `super' relation). */ \ - /** \{ */ \ - /** Case where \a from_type = mlc::none (end of a recursive */ \ - /** retrieval following `super' types). */ \ - template <typename method, typename category, typename typedef_type> \ - struct rec_get_vtype<method, category, mlc::none, typedef_type> : \ - private mlc::assert_< mlc_is_a(method, tag::method), \ - stc::ERROR::FIRST_PARAMETER_OF_rec_get_vtype_IS_NOT_A_TAG > \ - { \ - typedef mlc::not_found ret; \ - }; \ - /** Case where \a from_type = mlc::not_found (end of a recursive */ \ - /** retrieval following `super' types). */ \ - template <typename method, typename category, typename typedef_type> \ - struct rec_get_vtype<method, category, mlc::not_found, typedef_type> : \ - private mlc::assert_< mlc_is_a(method, tag::method), \ - stc::ERROR::FIRST_PARAMETER_OF_rec_get_vtype_IS_NOT_A_TAG > \ - { \ - typedef mlc::not_found ret; \ - }; \ - /** \} */ \ - \ - \ - /** Recursive retrieval of vtype \a typedef_type inside */ \ - /** \a from_list. */ \ - /** \{ */ \ - \ - /* Default case: \a from_type is not a mlc::valist_, abort. */ \ - template <typename method, typename category, \ - typename from_list, typename typedef_type> \ - struct rec_get_vtype_from_list : \ - private mlc::abort_< from_list, \ - stc::ERROR::THIRD_PARAMETER_OF_rec_get_vtype_from_list_IS_NOT_A_LIST > \ - { \ - }; \ - \ - /** Case where the list is empty. Suprisingly, the general */ \ - /** specialization for mlc::valist<e1, ..., e9> is not enough: */ \ - /** this specialization is needed too. */ \ - template <typename method, typename category, typename typedef_type> \ - struct rec_get_vtype_from_list< \ - method, category, mlc::valist_<>, typedef_type> \ - { \ - typedef mlc::not_found ret; \ - }; \ - \ - /* Case where \a from_list is a genuine list. */ \ - template <typename method, typename category, \ - typename e1, typename e2, typename e3, \ - typename e4, typename e5, typename e6, \ - typename e7, typename e8, typename e9, \ - typename typedef_type> \ - struct rec_get_vtype_from_list< \ - method, category, \ - mlc::valist_<e1, e2, e3, e4, e5, e6, e7, e8, e9>, typedef_type \ - > : \ - private mlc::assert_< mlc_is_a(method, tag::method), \ - stc::ERROR::FIRST_PARAMETER_OF_rec_get_vtype_from_list_IS_NOT_A_TAG > \ - { \ - /* For each item of the list \a from_list, perform a */ \ - /* rec_get_vtype search. */ \ - /* FIXME: Factor with a loop macro? */ \ - typedef stc_internal_rec_get_vtype(e1) res1; \ - typedef stc_internal_rec_get_vtype(e2) res2; \ - typedef stc_internal_rec_get_vtype(e3) res3; \ - typedef stc_internal_rec_get_vtype(e4) res4; \ - typedef stc_internal_rec_get_vtype(e5) res5; \ - typedef stc_internal_rec_get_vtype(e6) res6; \ - typedef stc_internal_rec_get_vtype(e7) res7; \ - typedef stc_internal_rec_get_vtype(e8) res8; \ - typedef stc_internal_rec_get_vtype(e9) res9; \ - \ - /* Then, create a list from the results. */ \ - typedef \ - mlc::valist_<res1, res2, res3, res4, res5, res6, res7, res8, res9> \ - res_list; \ - \ - /* Finally, match this list against a set of valid patterns. */ \ - /* If the match fails, return mlc::not_found. */ \ - typedef typename \ - stc::internal::extract_vtype_from_list<res_list>::ret ret; \ - }; \ - \ - \ - /* -------------------------------------------- */ \ - /* Internal/single/extended typedef selection. */ \ - /* -------------------------------------------- */ \ - \ - /** \brief Typedef selector. */ \ - /** */ \ - /** A virtual type is considered valid if and only if it has been */ \ - /** found as an internal vtype or (exclusive) as an extended vtype. */ \ - /** Other cases (no definition or a double definition) are invalid. */ \ - /** */ \ - /** \{ */ \ - /** Fwd decl. */ \ - template \ - < typename internal_vtype_candidate, bool found_as_internal_vtype, \ - typename single_vtype_candidate, bool found_as_single_vtype, \ - typename extended_vtype_candidate, bool found_as_extended_vtype > \ - struct select_typedef; \ - \ - /** The typedef is defined as an internal vtype only: good. */ \ - template <typename internal_vtype_candidate, \ - typename single_vtype_candidate, \ - typename extended_vtype_candidate> \ - struct select_typedef<internal_vtype_candidate, true, \ - single_vtype_candidate, false, \ - extended_vtype_candidate, false> \ - { \ - typedef internal_vtype_candidate ret; \ - }; \ - \ - /** The typedef is defined as a single vtype only: good. */ \ - template <typename internal_vtype_candidate, \ - typename single_vtype_candidate, \ - typename extended_vtype_candidate> \ - struct select_typedef<internal_vtype_candidate, false, \ - single_vtype_candidate, true, \ - extended_vtype_candidate, false> \ - { \ - typedef single_vtype_candidate ret; \ - }; \ - \ - /** The typedef is defined as an extended vtype only: good. */ \ - template <typename internal_vtype_candidate, \ - typename single_vtype_candidate, \ - typename extended_vtype_candidate> \ - struct select_typedef<internal_vtype_candidate, false, \ - single_vtype_candidate, false, \ - extended_vtype_candidate, true> \ - { \ - typedef extended_vtype_candidate ret; \ - }; \ - \ - /** Special case: The typedef is <b>declared</b> as mlc::undefined */ \ - /** in internal vtypes, and <b>defined</b> as a single vtype: good. */ \ - template <typename single_vtype_candidate, \ - typename extended_vtype_candidate> \ - struct select_typedef<mlc::undefined, true, \ - single_vtype_candidate, true, \ - extended_vtype_candidate, false> \ - { \ - typedef single_vtype_candidate ret; \ - }; \ - \ - \ - /* Erroneous cases. */ \ - /* ---------------- */ \ - \ - /* In the following cases, mlc::abort_ ``statements'' take a dummy */ \ - /* typedef as first parameter, to prevent an immediate evaluation. */ \ - /* of mlc_abort_<>. */ \ - /* The choice was made to choose the first unbound parameter, but it */ \ - /* <i>it has no meaning in itself!</i>. This is just a part of the */ \ - /* static abortion mechanism. */ \ - \ - /** The typedef is <b>defined</b> both as internal and single (and */ \ - /** the internal flavour is <b>not</b> mlc::undefined): bad. */ \ - template <typename internal_vtype_candidate, \ - typename single_vtype_candidate, \ - typename extended_vtype_candidate> \ - struct select_typedef<internal_vtype_candidate, true, \ - single_vtype_candidate, true, \ - extended_vtype_candidate, false> : \ - mlc::abort_ < \ - internal_vtype_candidate /* dummy */ , \ - stc::ERROR::VIRTUAL_TYPE_MULTIPLY_DEFINED_AS_INTERNAL_AND_SINGLE \ - > \ - { \ - /* Error, no valid typedef found. */ \ - typedef mlc::not_found ret; \ - }; \ - \ - /** The typedef is <b>defined</b> both as internal and external: bad. */ \ - template <typename internal_vtype_candidate, \ - typename single_vtype_candidate, \ - typename extended_vtype_candidate> \ - struct select_typedef<internal_vtype_candidate, true, \ - single_vtype_candidate, false, \ - extended_vtype_candidate, true> : \ - mlc::abort_ < \ - internal_vtype_candidate /* dummy */ , \ - stc::ERROR::VIRTUAL_TYPE_MULTIPLY_DEFINED_AS_INTERNAL_AND_EXTERNAL \ - > \ - { \ - /* Error, no valid typedef found. */ \ - typedef mlc::not_found ret; \ - }; \ - \ - /** The typedef is <b>defined</b> both as single and external: bad. */ \ - template <typename internal_vtype_candidate, \ - typename single_vtype_candidate, \ - typename extended_vtype_candidate> \ - struct select_typedef<internal_vtype_candidate, false, \ - single_vtype_candidate, true, \ - extended_vtype_candidate, true> : \ - mlc::abort_ < \ - internal_vtype_candidate /* dummy */ , \ - stc::ERROR::VIRTUAL_TYPE_MULTIPLY_DEFINED_AS_SINGLE_AND_EXTERNAL \ - > \ - { \ - /* Error, no valid typedef found. */ \ - typedef mlc::not_found ret; \ - }; \ - \ - /** The typedef is <b>defined</b> as internal, single, and */ \ - /** external: bad. */ \ - template <typename internal_vtype_candidate, \ - typename single_vtype_candidate, \ - typename extended_vtype_candidate> \ - struct select_typedef<internal_vtype_candidate, true, \ - single_vtype_candidate, true, \ - extended_vtype_candidate, true> : \ - mlc::abort_ < \ - internal_vtype_candidate /* dummy */ , \ - stc::ERROR:: \ - VIRTUAL_TYPE_MULTIPLY_DEFINED_AS_INTERNAL_AND_SINGLE_AND_EXTERNAL \ - > \ - { \ - /* Error, no valid typedef found. */ \ - typedef mlc::not_found ret; \ - }; \ - \ - /** All other cases: \a mlc::not_found is returned, but no static. */ \ - /** error is raised. */ \ - template \ - < typename internal_vtype_candidate, bool found_as_internal_vtype, \ - typename single_vtype_candidate, bool found_as_single_vtype, \ - typename extended_vtype_candidate, bool found_as_extended_vtype > \ - struct select_typedef \ - { \ - typedef mlc::not_found ret; \ - }; \ - /** \} */ \ - \ - } /* End of namespace SCOOPED_NAMESPACE ::internal */ \ - \ - \ - /* Entry points. */ \ - /* ------------- */ \ - \ - /** Entry point of the vtype retrieval algorithm. */ \ - template <typename category, typename from_type, typename typedef_type> \ - struct direct_type_of_ \ - { \ - /* Look for the typedef in internal vtypes. */ \ - typedef typename \ - internal::rec_get_vtype<internal::tag::internal, category, \ - from_type, typedef_type>::ret \ - internal_vtype_candidate; \ - /* Look for the typedef as a single vtype definition. */ \ - typedef typename \ - internal::rec_get_vtype<internal::tag::single, category, \ - from_type, typedef_type>::ret \ - single_vtype_candidate; \ - /* Look for the typedef as an extended vtype. */ \ - typedef typename \ - internal::rec_get_vtype<internal::tag::extended, category, \ - from_type, typedef_type>::ret \ - extended_vtype_candidate; \ - \ - /* Did we found the virtual type in any of the vtypes structures? */ \ - static const bool found_as_internal_vtype = \ - mlc_bool(mlc::is_found_<internal_vtype_candidate>); \ - static const bool found_as_single_vtype = \ - mlc_bool(mlc::is_found_<single_vtype_candidate>); \ - static const bool found_as_extended_vtype = \ - mlc_bool(mlc::is_found_<extended_vtype_candidate>); \ - \ - /* Find an eligible typedef. */ \ - typedef typename \ - internal::select_typedef< \ - internal_vtype_candidate, found_as_internal_vtype, \ - single_vtype_candidate, found_as_single_vtype, \ - extended_vtype_candidate, found_as_extended_vtype \ - >::ret ret; \ - }; \ - \ - /** Entry point of the vtype retrieval algorithm (working on the */ \ - /** exact version of \a from_type). */ \ - template <typename category, typename from_type, typename typedef_type> \ - struct type_of_ \ - { \ - /* Get the exact type of \a from_type. */ \ - typedef stc_to_exact(from_type) from_exact_type; \ - /* ``Run'' type_of_. */ \ - typedef typename \ - direct_type_of_<category, from_exact_type, typedef_type>::ret ret; \ - }; \ - \ - \ - /** Like direct_type_of_, but ensure that the result is different */ \ - /** from mlc::not_found. */ \ - template <typename category, typename from_type, typename typedef_type> \ - struct check_direct_type_of_ \ - { \ - /* Candidate type. */ \ - typedef typename \ - direct_type_of_<category, from_type, typedef_type>::ret candidate; \ - /* Check that CANDIDATE is found. */ \ - typedef typename \ - mlc::assert_and_return_< \ - mlc_neq(candidate, mlc::not_found), \ - candidate, \ - stc::ERROR::VIRTUAL_TYPE_NOT_FOUND \ - >::ret ret; \ - }; \ - \ - /** Like type_of_, but ensure that the result is different from */ \ - /** mlc::not_found. */ \ - template <typename category, typename from_type, typename typedef_type> \ - struct check_type_of_ \ - { \ - /* Candidate type. */ \ - typedef typename \ - type_of_<category, from_type, typedef_type>::ret candidate; \ - /* Check that CANDIDATE is found. */ \ - typedef typename \ - mlc::assert_and_return_< \ - mlc_neq(candidate, mlc::not_found), \ - candidate, \ - stc::ERROR::VIRTUAL_TYPE_NOT_FOUND \ - >::ret ret; \ - }; \ - \ -} /* end of namespace SCOOPED_NAMESPACE */ \ - \ + +# define stc_scoop_equipment_for_namespace(SCOOPED_NAMESPACE) \ + \ +namespace SCOOPED_NAMESPACE \ +{ \ + \ + template <typename from_type> \ + struct set_super_type \ + { \ + typedef mlc::none ret; \ + }; \ + \ + template <typename type> \ + struct set_pseudosuper_type \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + template <typename from_type> \ + struct vtypes \ + { \ + }; \ + \ + template <typename from_type, typename type> \ + struct single_vtype \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + \ + namespace internal \ + { \ + \ + /* retrieve_from_single_vtype */ \ + \ + template <typename from_type, typename type> \ + struct retrieve_from_single_vtype; \ + \ + template <typename res, typename super, typename type> \ + struct helper_retrieve_from_single_vtype \ + { \ + typedef res ret; \ + }; \ + \ + template <typename super, typename type> \ + struct helper_retrieve_from_single_vtype < mlc::not_found, super, type > \ + { \ + typedef typename retrieve_from_single_vtype<super, type>::ret ret; \ + }; \ + \ + template <typename type> \ + struct helper_retrieve_from_single_vtype < mlc::not_found, mlc::none, type > \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + template <typename type> \ + struct helper_retrieve_from_single_vtype < mlc::not_found, mlc::not_found, type > \ + { \ + }; \ + \ + template <typename from_type, typename type> \ + struct retrieve_from_single_vtype \ + { \ + typedef SCOOPED_NAMESPACE::single_vtype<from_type, type> decl; \ + typedef typename decl::ret res; \ + typedef typename set_super_type<from_type>::ret super; \ + typedef typename helper_retrieve_from_single_vtype< res, super, type >::ret ret; \ + }; \ + \ + /* vtypes */ \ + \ + template <typename from_type, typename type> \ + struct retrieve_from_vtypes; \ + \ + template <typename res, typename super, typename type> \ + struct helper_retrieve_from_vtypes \ + { \ + typedef res ret; \ + }; \ + \ + template <typename super, typename type> \ + struct helper_retrieve_from_vtypes < mlc::not_found, super, type > \ + { \ + typedef typename retrieve_from_vtypes<super, type>::ret ret; \ + }; \ + \ + template <typename type> \ + struct helper_retrieve_from_vtypes < mlc::not_found, mlc::none, type > \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + template <typename type> \ + struct helper_retrieve_from_vtypes < mlc::not_found, mlc::not_found, type > \ + { \ + }; \ + \ + template <typename from_type, typename type> \ + struct retrieve_from_vtypes \ + { \ + typedef SCOOPED_NAMESPACE::vtypes<from_type> decl; \ + typedef stc_internal_get_typedef(decl, type) res; \ + typedef typename set_super_type<from_type>::ret super; \ + typedef typename helper_retrieve_from_vtypes< res, super, type >::ret ret; \ + }; \ + \ + /* pseudo super */ \ + \ + template <typename from_type> \ + struct retrieve_pseudosuper; \ + \ + template <typename res, typename super> \ + struct helper_retrieve_pseudosuper \ + { \ + typedef res ret; \ + }; \ + \ + template <typename super> \ + struct helper_retrieve_pseudosuper < mlc::not_found, super > \ + { \ + typedef typename retrieve_pseudosuper<super>::ret ret; \ + }; \ + \ + template <> \ + struct helper_retrieve_pseudosuper < mlc::not_found, mlc::none > \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + template <> \ + struct helper_retrieve_pseudosuper < mlc::not_found, mlc::not_found > \ + { \ + }; \ + \ + template <typename from_type> \ + struct retrieve_pseudosuper \ + { \ + typedef typename set_pseudosuper_type<from_type>::ret res; \ + typedef typename set_super_type<from_type>::ret super; \ + typedef typename helper_retrieve_pseudosuper< res, super >::ret ret; \ + }; \ + \ + /* scoop_vtype_of */ \ + \ + template <typename from_type, typename type> \ + struct step_from_vtypes; /* fwd decl of main entry */ \ + \ + /* step 3 <=> delegation */ \ + \ + template <typename from_type, typename type> \ + struct helper_step_from_delegation \ + { \ + /* REC */ \ + typedef typename step_from_vtypes<from_type, type>::ret ret; \ + }; \ + \ + template <typename type> \ + struct helper_step_from_delegation < mlc::not_found, type > \ + { \ + typedef mlc::not_found ret; \ + }; \ + \ + template <typename from_type, typename type> \ + struct step_from_delegation /* step 3 entry */ \ + { \ + typedef typename retrieve_pseudosuper<from_type>::ret pseudo_type; \ + typedef typename helper_step_from_delegation<pseudo_type, type>::ret ret; \ + }; \ + \ + /* step 2 <=> single_vtype */ \ + \ + template <typename res, typename from_type, typename type> \ + struct helper_step_from_single_vtype \ + { \ + typedef res ret; /* found! */ \ + }; \ + \ + template <typename from_type, typename type> \ + struct helper_step_from_single_vtype <mlc::not_found, /* => step 3 */ \ + from_type, type> \ + { \ + typedef typename step_from_delegation<from_type, type>::ret ret; \ + }; \ + \ + template <typename from_type, typename type> \ + struct helper_step_from_single_vtype <mlc::undefined, /* => step 3 */ \ + from_type, type> \ + { \ + typedef typename step_from_delegation<from_type, type>::ret ret; \ + }; \ + \ + template <typename from_type, typename type> \ + struct step_from_single_vtype /* step 2 entry */ \ + { \ + typedef typename retrieve_from_single_vtype<from_type, type>::ret res; \ + typedef typename helper_step_from_single_vtype< res, from_type, type>::ret ret; \ + }; \ + \ + /* step 1 <=> vtypes */ \ + \ + template <typename res, typename from_type, typename type> \ + struct helper_step_from_vtypes \ + { \ + typedef res ret; /* found! */ \ + }; \ + \ + template <typename from_type, typename type> \ + struct helper_step_from_vtypes <mlc::not_found, /* => step 2 */ \ + from_type, type> \ + { \ + typedef typename step_from_single_vtype<from_type, type>::ret ret; \ + }; \ + \ + template <typename from_type, typename type> \ + struct helper_step_from_vtypes <mlc::undefined, /* => step 2 */ \ + from_type, type> \ + { \ + typedef typename step_from_single_vtype<from_type, type>::ret ret; \ + }; \ + \ + template <typename from_type, typename type> \ + struct step_from_vtypes /* main entry (so step 1 entry) */ \ + { \ + typedef typename retrieve_from_vtypes<from_type, type>::ret res; \ + typedef typename helper_step_from_vtypes< res, from_type, type>::ret ret; \ + }; \ + \ + } /* end of namespace SCOOPED_NAMESPACE ::internal */ \ + \ + \ + template <typename from_type, typename type> \ + struct direct_type_of_ \ + { \ + typedef typename internal::step_from_vtypes<from_type, type>::ret ret; \ + }; \ + \ + \ +} /* end of namespace SCOOPED_NAMESPACE */ \ + \ struct e_n_d__w_i_t_h___s_e_m_i_c_o_l_o_n -/*---------. -| Macros. | -`---------*/ - -// ------------- // -// Inheritance. // -// ------------- // - -// Set. - -/* FIXME: I don't know whether these macros will be really usable; what - if Type is a template class? We would have to provide additional - versions of these macros, with support for one parameter, two - parameters, etc. */ -/// \def Declare the immediate base class \a Super of \a Type. -#define stc_set_nth_super(Type, N, Super) \ - template<> \ - struct set_super_type< Type, N > \ - { \ - typedef Super ret; \ - }; \ - \ - struct e_n_d__w_i_t_h___s_e_m_i_c_o_l_o_n - -// Shortcut. -#define stc_set_super(Type, Super) \ - stc_set_nth_super(Type, 1, Super) - - -// Get. - -// FIXME: The error message given by the compiler is not explicit -// when trying to use stc_get_supers on a class which has no -// (declared) super class. Improve this. - -/** \a stc_get_supers(Type) returns a class which inerits from all the - classes declared as super types of \a Type. - - However, there is an exception when Type as single super: - stc_get_supers returns this super class directly, not a class - ineriting from it, to avoid a useless indirection. */ -#define stc_get_supers(Type) \ - get_super_types< Type >::ret - -/// \def Get the Nth immediate base class(es) of Type (version to be -/// used inside a template). -# define stc_get_nth_super(Type, Nth) \ - typename stc_get_nth_super_(Type, Nth) - -/// \def Get the Nth immediate base class(es) of Type (version to be -/// used outside a template). -# define stc_get_nth_super_(Type, Nth) \ - set_super_type< Type, Nth >::ret - -/// \def Get the fisrt immediate base class of Type (version to be -/// used inside a template). -# define stc_get_super(Type) \ - typename stc_get_super_(Type) - -/// \def Get the first immediate base class of Type (version to be -/// used outside a template). -# define stc_get_super_(Type) \ - stc_get_nth_super_(Type, 1) - - -// -------------------- // -// Pseudo inheritance. // -// -------------------- // - -/* FIXME: I don't know whether this macro will be really usable; what - if Type is a template class? We would have to provide additional - versions of this macro, with support for one parameter, two - parameters, etc. */ -/// \def Declare the pseudosuper class \a PseudoSuper of \a Type. -# define stc_set_pseudosuper(Type, PseudoSuper) \ - template<> \ - struct set_pseudosuper_type<Type> \ - { \ - typedef PseudoSuper ret; \ - }; \ - \ - struct e_n_d__w_i_t_h___s_e_m_i_c_o_l_o_n - - -/// \def Get the pseudosuper class of Type (version to be used inside a -/// template). -# define stc_get_pseudosuper(Type) \ - typename stc_get_pseudosuper_(Type) - -/// \def Get the pseudosuper class of Type (version to be used outside a -/// template). -# define stc_get_pseudosuper_(Type) \ - set_pseudosuper_type< Type >::ret - - -// --------------------- // -// Virtual type access. // -// --------------------- // - -/// Get the vtype \a Typedef, declared in \a Namespace, from the -/// exact type of \a FromType (version to be used inside a template). -#define stc_type_of(Namespace, Category, FromType, Typedef) \ - typename stc_type_of_(Namespace, Category, FromType, Typedef) - -/// Get the vtype \a Typedef, declared in \a Namespace, from the -/// exact type of \a FromType (version to be used outside a template). -#define stc_type_of_(Namespace, Category, FromType, Typedef) \ - Namespace::type_of_< Category, FromType, \ - Namespace::typedef_:: Typedef##_type >::ret - - -/// Get the vtype \a Typedef, declared in \a Namespace, from \a -/// FromType directly. (version to be used inside a template). -#define stc_direct_type_of(Namespace, Category, FromType, Typedef) \ - typename stc_direct_type_of_(Namespace, Category, FromType, Typedef) - -/// Get the vtype \a Typedef, declared in \a Namespace, from \a -/// FromType directly (version to be used outside a template). -#define stc_direct_type_of_(Namespace, Category, FromType, Typedef) \ - Namespace::direct_type_of_< Category, FromType, \ - Namespace::typedef_:: Typedef##_type >::ret - - -// ------------------------------- // -// Virtual type check and access. // -// ------------------------------- // - -/* These macros are the same as the previous ones, but they use - check_type_of_ (resp. check_direct_type_of_) instead of type_of_ - (resp. direct_type_of_). */ - -/// Get the vtype \a Typedef, declared in \a Namespace, from the -/// exact type of \a FromType (version to be used inside a template). -/// If the virtual type is not found, raise a static error. -#define stc_check_type_of(Namespace, Category, FromType, Typedef) \ - typename stc_check_type_of_(Namespace, Category, FromType, Typedef) - -/// Get the vtype \a Typedef, declared in \a Namespace, from the -/// exact type of \a FromType (version to be used outside a template). -/// If the virtual type is not found, raise a static error. -#define stc_check_type_of_(Namespace, Category, FromType, Typedef) \ - Namespace::check_type_of_< Category, FromType, \ - Namespace::typedef_:: Typedef##_type >::ret - - -/// Get the vtype \a Typedef, declared in \a Namespace, from \a -/// FromType directly. (version to be used inside a template). -/// If the virtual type is not found, raise a static error. -#define stc_check_direct_type_of(Namespace, Category, FromType, Typedef) \ - typename stc_check_direct_type_of_(Namespace, Category, FromType, Typedef) - -/// Get the vtype \a Typedef, declared in \a Namespace, from \a -/// FromType directly (version to be used outside a template). -/// If the virtual type is not found, raise a static error. -#define stc_check_direct_type_of_(Namespace, Category, FromType, Typedef) \ - Namespace::check_direct_type_of_< \ - Category, \ - FromType, \ - Namespace::typedef_:: Typedef##_type \ - >::ret - - #endif // ! STC_SCOOP_HH
18Â years, 1Â month
1
0
0
0
705: Add backward value iterators on look-up tables.
by Roland Levillain
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog from Roland Levillain <roland(a)lrde.epita.fr> Add backward value iterators on look-up tables. * oln/core/lookup_table.hh (oln::lookup_table::reverse_iterator) (oln::lookup_table::const_reverse_iterator): New typedefs. (oln::lookup_table::rbegin, oln::lookup_table::rend): New methods. * oln/core/typedefs.hh (bkd_viter_type): New virtual type declaration. * oln/core/gen/bkd_viter_lut.hh: New. * oln/core/gen/fwd_viter_lut.hh: Typos. * oln/morpher/with_lut.hh (single_vtype<morpher::with_lut<Image,Lut>, typedef_::bkd_viter_type>): New. * tests/morphers/with_lut.cc (main): Test backward value iterator on look-up table. * oln/Makefile.am (nobase_oln_HEADERS): Add core/gen/bkd_viter_lut.hh. oln/Makefile.am | 1 oln/core/gen/bkd_viter_lut.hh | 182 ++++++++++++++++++++++++++++++++++++++++++ oln/core/gen/fwd_viter_lut.hh | 4 oln/core/lookup_table.hh | 53 +++++++++++- oln/core/typedefs.hh | 2 oln/morpher/with_lut.hh | 13 ++- tests/morphers/with_lut.cc | 29 ++---- 7 files changed, 257 insertions(+), 27 deletions(-) Index: tests/morphers/with_lut.cc --- tests/morphers/with_lut.cc (revision 704) +++ tests/morphers/with_lut.cc (working copy) @@ -151,27 +151,18 @@ oln_type_of_(image_with_lut_t, fwd_viter) fv(ima_with_lut.lut()); std::list<rgb8> fwd_values; std::cout << "values of lut (fwd) =" << std::endl; - for_all (fv) - { // Push the values to the *back* of the list. + for_all (fv) fwd_values.push_back(fv); - std::cout << " " << fv << std::endl; - } - -// FIXME: To be enabled later. - -// // Check bkd_viter_lut. -// oln_type_of_(image_with_lut_t, bkd_viter) bv(ima_with_lut.lut()); -// std::list<rgb8> bkd_values; -// std::cout << "values of lut (bkd) =" << std::endl; -// for_all (bv) -// { -// // Push the values to the *front* of the list. -// bkd_values.push_front(bv); -// std::cout << " " << bv << std::endl; -// } -// // Compare the two lists. -// assert (fwd_values == bkd_values); + // Check bkd_viter_lut. + oln_type_of_(image_with_lut_t, bkd_viter) bv(ima_with_lut.lut()); + std::list<rgb8> bkd_values; + std::cout << "values of lut (bkd) =" << std::endl; + // Push the values to the *front* of the list (i.e., in reverse order). + for_all (bv) + bkd_values.push_front(bv); + // Compare the two lists. + assert (fwd_values == bkd_values); // FIXME: To be enabled later, when oln::level::fill is specialized Index: oln/core/typedefs.hh --- oln/core/typedefs.hh (revision 704) +++ oln/core/typedefs.hh (working copy) @@ -97,7 +97,7 @@ mlc_decl_typedef(bkd_niter_type); mlc_decl_typedef(fwd_viter_type); - // FIXME: bkd_viter_type. + mlc_decl_typedef(bkd_viter_type); /*------------. Index: oln/core/gen/bkd_viter_lut.hh --- oln/core/gen/bkd_viter_lut.hh (revision 0) +++ oln/core/gen/bkd_viter_lut.hh (revision 0) @@ -0,0 +1,182 @@ +// Copyright (C) 2006 EPITA Research and Development Laboratory +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. + +#ifndef OLN_CORE_GEN_BKD_VITER_LUT_HH +# define OLN_CORE_GEN_BKD_VITER_LUT_HH + +# include <oln/core/abstract/iterator_on_values.hh> +# include <oln/core/lookup_table.hh> + +namespace oln +{ + + // Forward declaration. + template <typename Lut> class bkd_viter_lut; + + + /// Super type declaration. + template <typename Lut> + struct set_super_type< bkd_viter_lut<Lut> > + { + typedef bkd_viter_lut<Lut> self_t; + typedef abstract::iterator_on_values<self_t> ret; + }; + + + /// Virtual types associated to oln::bkd_viter_lut<Lut>. + template <typename Lut> + struct vtypes< bkd_viter_lut<Lut> > + { + // The look-up table is immutable. + typedef const Lut lut_type; + typedef typename Lut::const_reverse_iterator lut_iter_type; + typedef typename Lut::new_value_type value_type; + }; + + + /// Backward value iterator on look-up table. + template <typename Lut> + class bkd_viter_lut : + public stc_get_supers(bkd_viter_lut<Lut>) + // Check that Lut is a look-up table. + // FIXME: an abstract::lookup_table would be useful. + { + typedef bkd_viter_lut<Lut> self_t; + typedef stc_get_super(self_t) super_t; + typedef oln_type_of(self_t, lut_iter) lut_iter_t; + + public: + typedef oln_type_of(self_t, lut) lut_type; + typedef oln_type_of(self_t, value) value_type; + + public: + // Construct an uninitialized value iterator. + bkd_viter_lut(const Lut& lut); + + /// Iterator manipulators. + /// \{ + void impl_start(); + void impl_next(); + void impl_invalidate(); + bool impl_is_valid() const; + /// \} + + // Get the value pointed by this iterator (const version). + value_type impl_to_value() const; + + void print(std::ostream& ostr) const; + + protected: + /// Look-up table. + lut_type& lut_; + /// Iterator on \a lut_. + lut_iter_t i_; + }; + + + template <typename Lut> + std::ostream& operator<<(std::ostream& ostr, + const bkd_viter_lut<Lut>& t); + + + +# ifndef OLN_INCLUDE_ONLY + + template <typename Lut> + bkd_viter_lut<Lut>::bkd_viter_lut(const Lut& lut) : + super_t(), + lut_(lut), + i_() + { + // Initialize underlying iterator (i.e., \a i_.) + this->invalidate(); + } + + template <typename Exact> + void + bkd_viter_lut<Exact>::impl_start() + { + i_ = lut_.rbegin(); + } + + template <typename Exact> + void + bkd_viter_lut<Exact>::impl_next() + { + /* Iterate until a different key is reached. In fact, + std::multimap might not be the best choice to implement + new_to_orig_map_. Maybe a std::map binding orig_val to a + std::set of new_val's would is better?. */ + value_type val = i_->first; + do + ++i_; + while (i_ != lut_.rend() and i_->first == val); + } + + template <typename Exact> + void + bkd_viter_lut<Exact>::impl_invalidate() + { + i_ = lut_.rend(); + } + + template <typename Exact> + bool + bkd_viter_lut<Exact>::impl_is_valid() const + { + return (i_ != lut_.rend()); + } + + template <typename Lut> + typename bkd_viter_lut<Lut>::value_type + bkd_viter_lut<Lut>::impl_to_value() const + { + precondition(this->is_valid()); + return this->i_->first; + } + + template <typename Lut> + void bkd_viter_lut<Lut>::print(std::ostream& ostr) const + { + precondition(this->is_valid()); + ostr << "{ value = " << this->i_->first << " }"; + } + + + template <typename Lut> + std::ostream& operator<<(std::ostream& ostr, const bkd_viter_lut<Lut>& t) + { + t.print(ostr); + return ostr; + } + +# endif + +} // end of namespace oln + + +#endif // ! OLN_CORE_GEN_BKD_VITER_LUT_HH Index: oln/core/gen/fwd_viter_lut.hh --- oln/core/gen/fwd_viter_lut.hh (revision 704) +++ oln/core/gen/fwd_viter_lut.hh (working copy) @@ -34,8 +34,6 @@ namespace oln { - // FIXME: Merge this file with oln/core/internal/fwd_viter_lut.hh? - // Forward declaration. template <typename Lut> class fwd_viter_lut; @@ -60,7 +58,7 @@ }; - /// Const forward value iterator on look-up table. + /// Forward value iterator on look-up table. template <typename Lut> class fwd_viter_lut : public stc_get_supers(fwd_viter_lut<Lut>) Index: oln/core/lookup_table.hh --- oln/core/lookup_table.hh (revision 704) +++ oln/core/lookup_table.hh (working copy) @@ -52,6 +52,9 @@ typedef typename new_to_orig_map_type::const_iterator const_iterator; typedef typename new_to_orig_map_type::iterator iterator; + typedef typename new_to_orig_map_type::const_reverse_iterator const_reverse_iterator; + typedef typename new_to_orig_map_type::reverse_iterator reverse_iterator; + public: lookup_table(); @@ -59,13 +62,17 @@ const new_value_type operator() (const orig_value_type& orig_value) const; - /// (Internal) iterators. + /// (Internal) iterators bounds. /// \{ const_iterator begin() const; iterator begin(); - const_iterator end() const; iterator end(); + + const_reverse_iterator rbegin() const; + reverse_iterator rbegin(); + const_reverse_iterator rend() const; + reverse_iterator rend(); /// \} const_iterator find(const new_value_type& val) const; @@ -120,6 +127,10 @@ } + /*--------------------------. + | Direct iterators bounds. | + `--------------------------*/ + template <typename Orig_Value, typename New_Value, typename Orig_Value_Compare, typename New_Value_Compare> typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::const_iterator @@ -153,6 +164,44 @@ } + /*---------------------------. + | Reverse iterators bounds. | + `---------------------------*/ + + template <typename Orig_Value, typename New_Value, + typename Orig_Value_Compare, typename New_Value_Compare> + typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::const_reverse_iterator + lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::rbegin() const + { + return new_to_orig_map_.rbegin(); + } + + template <typename Orig_Value, typename New_Value, + typename Orig_Value_Compare, typename New_Value_Compare> + typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::reverse_iterator + lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::rbegin() + { + return new_to_orig_map_.rbegin(); + } + + template <typename Orig_Value, typename New_Value, + typename Orig_Value_Compare, typename New_Value_Compare> + typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::const_reverse_iterator + lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::rend() const + { + return new_to_orig_map_.rend(); + } + + template <typename Orig_Value, typename New_Value, + typename Orig_Value_Compare, typename New_Value_Compare> + typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::reverse_iterator + lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::rend() + { + return new_to_orig_map_.rend(); + } + + + template <typename Orig_Value, typename New_Value, typename Orig_Value_Compare, typename New_Value_Compare> typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::const_iterator Index: oln/Makefile.am --- oln/Makefile.am (revision 704) +++ oln/Makefile.am (working copy) @@ -123,6 +123,7 @@ core/gen/bkd_niter_neighb.hh \ core/gen/bkd_piter_bbox.hh \ core/gen/bkd_qiter_win.hh \ + core/gen/bkd_viter_lut.hh \ core/gen/fwd_decls.hh \ core/gen/fwd_niter_neighb.hh \ core/gen/fwd_piter_bbox.hh \ Index: oln/morpher/with_lut.hh --- oln/morpher/with_lut.hh (revision 704) +++ oln/morpher/with_lut.hh (working copy) @@ -32,6 +32,7 @@ # include <oln/core/lookup_table.hh> # include <oln/value/lut_value_proxy.hh> # include <oln/core/gen/fwd_viter_lut.hh> +# include <oln/core/gen/bkd_viter_lut.hh> namespace oln @@ -80,7 +81,7 @@ typedef value::mutable_lut_value_proxy<Lut> mutable_value_proxy_type; // fwd_viter_type: see below. - // FIXME: implement bkd_viter_type! + // bkd_viter_type: see below. }; // Rvalue. @@ -93,13 +94,21 @@ typedef oln_value(self_t) ret; }; - /// Const forward viter vtype of morpher::with_lut. + /// Forward value iterator virtual type for morpher::with_lut. template <typename Image, typename Lut> struct single_vtype< morpher::with_lut<Image, Lut>, typedef_::fwd_viter_type > { typedef fwd_viter_lut<Lut> ret; }; + + /// Backward value iterator virtual type for morpher::with_lut. + template <typename Image, typename Lut> + struct single_vtype< morpher::with_lut<Image, Lut>, + typedef_::bkd_viter_type > + { + typedef bkd_viter_lut<Lut> ret; + }; /// \}
18Â years, 1Â month
1
0
0
0
← Newer
1
...
880
881
882
883
884
885
886
...
963
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
Results per page:
10
25
50
100
200