
2006-11-14 Thierry GERAUD <theo@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: