Commit 5e7e523d authored by Thierry Geraud's avatar Thierry Geraud
Browse files

2006-09-27 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>

	Update grid classes and add static checks for image vtypes.
	
	* oln/core/abstract/fwd_decls.hh: New.
	* tests/image_entry.cc: Update.
	* oln/core/abstract/image.hh (include): Add fwd_decls.
	(decl): Add static checks.
	* oln/core/abstract/image/mutability/hierarchy.hh
	(lvalue_t, psite_t): Update.  oln_check_type_of is now useless
	cause vtypes are now automatically checked in the decl structure.
	* oln/core/abstract/image/bbox/hierarchy.hh
	(bbox_t, point_t): Likewise.
	(decl): Add static checks.
	* oln/core/abstract/grid.hh (include): Update.
	(point_type, dpoint_type, size_type, coord_type): Remove.
	We have point->grid, not the contrary.
	(grid): Change inheritance to stc::any__simple.
	* oln/core/1d/grid1d.hh: Update.
	* oln/core/2d/grid2d.hh: Update.
	* oln/core/3d/grid3d.hh: Update.
	* oln/basics2d.hh (include): Add grid2d.
	* oln/Makefile.am (nobase_oln_HEADERS): Update.



git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@581 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 939e5581
2006-09-27 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>
Update grid classes and add static checks for image vtypes.
* oln/core/abstract/fwd_decls.hh: New.
* tests/image_entry.cc: Update.
* oln/core/abstract/image.hh (include): Add fwd_decls.
(decl): Add static checks.
* oln/core/abstract/image/mutability/hierarchy.hh
(lvalue_t, psite_t): Update. oln_check_type_of is now useless
cause vtypes are now automatically checked in the decl structure.
* oln/core/abstract/image/bbox/hierarchy.hh
(bbox_t, point_t): Likewise.
(decl): Add static checks.
* oln/core/abstract/grid.hh (include): Update.
(point_type, dpoint_type, size_type, coord_type): Remove.
We have point->grid, not the contrary.
(grid): Change inheritance to stc::any__simple.
* oln/core/1d/grid1d.hh: Update.
* oln/core/2d/grid2d.hh: Update.
* oln/core/3d/grid3d.hh: Update.
* oln/basics2d.hh (include): Add grid2d.
* oln/Makefile.am (nobase_oln_HEADERS): Update.
2006-09-27 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr>
Adjust guards to directory names.
......
......@@ -31,6 +31,7 @@ nobase_oln_HEADERS = \
core/abstract/bbox.hh \
core/abstract/dpoint.hh \
core/abstract/entry.hh \
core/abstract/fwd_decls.hh \
core/abstract/grid.hh \
core/abstract/image.hh \
core/abstract/image/accessibility/hierarchy.hh \
......
......@@ -32,6 +32,8 @@
# include <oln/core/2d/aliases.hh>
# include <oln/core/2d/grid2d.hh>
# include <oln/core/2d/point2d.hh>
namespace oln { template class point2d_<int>; }
......@@ -54,7 +56,6 @@ namespace oln { template class bkd_piter_bbox_<topo2d>; }
namespace oln { template class neighb_<dpoint2d>; }
# include <oln/core/2d/neighb2d.hh>
# include <oln/core/2d/image2d.hh>
......
......@@ -35,12 +35,8 @@
namespace oln
{
// Forward declarations.
class grid1d;
class point1d;
class dpoint1d;
class size1d;
class coord_t;
// Fwd decl.
struct grid1d;
// Super type.
stc_set_super(grid1d, abstract::grid<grid1d>);
......@@ -49,14 +45,10 @@ namespace oln
template <>
struct vtypes<grid1d>
{
typedef point1d point_type;
typedef dpoint1d dpoint_type;
typedef coord_t coord_type;
typedef size1d size_type;
typedef mlc::uint_<1> dimvalue_type;
};
/// A 1-dimension rectangular grid.
/// A 1-dimension grid.
struct grid1d : public stc_get_supers(grid1d)
{
protected:
......
......@@ -35,12 +35,8 @@
namespace oln
{
// Forward declarations.
// Fwd decl.
struct grid2d;
struct point2d;
struct dpoint2d;
struct size2d;
struct coord_t;
// Super type.
stc_set_super(grid2d, abstract::grid<grid2d>);
......@@ -49,10 +45,6 @@ namespace oln
template <>
struct vtypes<grid2d>
{
typedef point2d point_type;
typedef dpoint2d dpoint_type;
typedef size2d size_type;
typedef coord_t coord_type;
typedef mlc::uint_<2> dimvalue_type;
};
......
......@@ -34,13 +34,8 @@
namespace oln
{
// Forward declarations.
// Fwd decl.
struct grid3d;
struct point3d;
struct dpoint3d;
struct size3d;
struct coord_t;
// Super type.
stc_set_super(grid3d, abstract::grid<grid3d>);
......@@ -49,14 +44,10 @@ namespace oln
template <>
struct vtypes<grid3d>
{
typedef point3d point_type;
typedef dpoint3d dpoint_type;
typedef size3d size_type;
typedef coord_t coord_type;
typedef mlc::uint_<3> dimvalue_type;
};
/// A 3-dimension rectangular grid.
/// A 3-dimension cubic grid.
struct grid3d : public stc_get_supers(grid3d)
{
protected:
......
// 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.
#ifndef OLN_CORE_ABSTRACT_FWD_DECLS_HH
# define OLN_CORE_ABSTRACT_FWD_DECLS_HH
namespace oln
{
namespace abstract
{
template <typename E> class bbox;
template <typename E> class dpoint;
template <typename E> class grid;
template <typename E> class image;
template <typename E> class iterator;
template <typename E> class iterator_on_points;
template <typename E> class neighborhood;
template <typename E> class point;
template <typename E> class point_set;
template <typename E> class topology;
} // end of namespace oln::abstract
} // end of namespace oln
#endif // ! OLN_CORE_ABSTRACT_FWD_DECLS_HH
......@@ -28,10 +28,6 @@
#ifndef OLN_CORE_ABSTRACT_GRID_HH
# define OLN_CORE_ABSTRACT_GRID_HH
# include <mlc/assert.hh>
# include <mlc/cmp.hh>
# include <mlc/to_string.hh>
# include <oln/core/abstract/any.hh>
# include <oln/core/typedefs.hh>
......@@ -40,24 +36,20 @@ namespace oln {
// Forward declaration.
namespace abstract
{
template <typename G> class grid;
template <typename E> class grid;
}
/// Virtual types associated to oln::abstract::image.
template <typename G>
struct vtypes< abstract::grid<G> >
/// Virtual types associated to oln::abstract::grid.
template <typename E>
struct vtypes< abstract::grid<E> >
{
typedef mlc::undefined point_type;
typedef mlc::none dpoint_type;
typedef mlc::undefined size_type;
typedef mlc::undefined coord_type;
typedef mlc::undefined dimvalue_type;
};
namespace abstract {
template <typename E>
struct grid : public oln::abstract::any<E>
struct grid : public virtual stc::any__simple<E>
{
protected:
grid()
......
......@@ -30,6 +30,7 @@
# define OLN_CORE_ABSTRACT_IMAGE_HH
# include <oln/core/typedefs.hh>
# include <oln/core/abstract/fwd_decls.hh>
# include <oln/automatic/image.hh>
......@@ -60,8 +61,8 @@ namespace oln
public:
struct decl {
struct decl
{
stc_virtual_typedef(topo);
stc_virtual_typedef(grid);
......@@ -79,8 +80,15 @@ namespace oln
stc_virtual_typedef(morpher);
decl() {
// FIXME: ...
decl()
{
mlc::assert_< mlc_is_a(topo, abstract::topology) >::check();
mlc::assert_< mlc_is_a(grid, abstract::grid) >::check();
mlc::assert_< mlc_is_a(piter, abstract::iterator_on_points) >::check();
mlc::assert_< mlc_is_a(fwd_piter, abstract::iterator_on_points) >::check();
mlc::assert_< mlc_is_a(bkd_piter, abstract::iterator_on_points) >::check();
// FIXME: Rec.
// mlc::assert_< mlc_is_a(concrete, abstract::image) >::check();
}
};
......
......@@ -29,6 +29,8 @@
# define OLN_CORE_ABSTRACT_IMAGE_BBOX_HIERARCHY_HH
# include <oln/core/abstract/image.hh>
# include <oln/core/abstract/bbox.hh>
namespace oln
......@@ -49,13 +51,19 @@ namespace oln
{
private:
typedef oln_check_type_of(E, bbox) bbox_t;
typedef oln_check_type_of(E, point) point_t;
typedef oln_type_of(E, bbox) bbox_t;
typedef oln_type_of(E, point) point_t;
public:
struct decl {
struct decl
{
stc_virtual_typedef(bbox);
decl()
{
mlc::assert_< mlc_is_a(bbox, abstract::bbox) >::check();
}
};
// Concrete method.
......
......@@ -53,12 +53,13 @@ namespace oln
{
private:
typedef oln_check_type_of(E, lvalue) lvalue_t;
typedef oln_check_type_of(E, psite) psite_t;
typedef oln_type_of(E, lvalue) lvalue_t;
typedef oln_type_of(E, psite) psite_t;
public:
struct decl {
struct decl
{
stc_virtual_typedef(lvalue);
};
......
......@@ -31,7 +31,7 @@
// stress image_typeness.hh. This might be done in another test, of
// course.
#include <oln/core/1d/grid1d.hh>
#include <oln/basics2d.hh>
#include <oln/core/image_entry.hh>
namespace my
......@@ -56,18 +56,19 @@ namespace oln
// 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::grid1d grid_type;
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;
// FIXME: Dummy values.
typedef my::dummy topo_type;
typedef my::dummy point_type;
typedef my::dummy fwd_piter_type;
typedef my::dummy bkd_piter_type;
typedef my::dummy concrete_type;
typedef topo2d topo_type;
typedef point2d point_type;
typedef fwd_piter2d fwd_piter_type;
typedef bkd_piter2d bkd_piter_type;
typedef my::image concrete_type;
typedef my::dummy morpher_type;
};
}
......@@ -90,11 +91,11 @@ int
main()
{
// Check its internally defined vtypes.
mlc::assert_< mlc_eq(my::image::grid_t, oln::grid1d) >::check();
mlc::assert_< mlc_eq(my::image::grid_t, oln::grid2d) >::check();
mlc::assert_< mlc_eq(my::image::value_t, char) >::check();
// Check its image dimension abstraction.
mlc::assert_< mlc_is_a_(my::image, oln::abstract::image1d) >::check();
mlc::assert_< mlc_is_a_(my::image, oln::abstract::image2d) >::check();
// Check its image type abstraction.
mlc::assert_< mlc_is_a_(my::image,
oln::abstract::grey_level_image) >::check();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment