
2006-10-17 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr> Add computability image hierarchy. * oln/core/abstract/image/computability: New. * oln/core/abstract/image/computability/hierarchy.hh: New. * oln/core/typedefs.hh (is_computed_type): New. * oln/core/image_entry.hh (is_computed_type): New in vtypes. * oln/core/abstract/image.hh (decl): Update. * oln/core/abstract/image/hierarchies.hh (image_hierarchy_wrt_computability): New. (hierarchy): Update ids. * oln/core/abstract/image/all.hh (include): Add computability/hierarchy.hh. * oln/core/1d/image1d.hh: Update. * oln/core/2d/image2d.hh: Likewise. * oln/core/3d/image3d.hh: Likewise. * oln/core/gen/mapimage.hh: Likewise. * oln/morpher/value_cast.hh: Likewise. * oln/morpher/thru_fun.hh: Likewise. * oln/morpher/internal/image_value_morpher.hh: Likewise. Index: oln/core/typedefs.hh =================================================================== --- oln/core/typedefs.hh (revision 649) +++ oln/core/typedefs.hh (working copy) @@ -123,6 +123,7 @@ // -------------------------------------------------------------------- // mlc_decl_typedef(data_type); // -------------------------------------------------------------------- + mlc_decl_typedef(is_computed_type); mlc_decl_typedef(value_type); mlc_decl_typedef(rvalue_type); mlc_decl_typedef(lvalue_type); Index: oln/core/image_entry.hh =================================================================== --- oln/core/image_entry.hh (revision 649) +++ oln/core/image_entry.hh (working copy) @@ -71,6 +71,8 @@ // psite_type: see below. typedef mlc::undefined point_type; + + typedef mlc::undefined is_computed_type; typedef mlc::undefined value_type; // rvalue_type: see below. Index: oln/core/abstract/image.hh =================================================================== --- oln/core/abstract/image.hh (revision 649) +++ oln/core/abstract/image.hh (working copy) @@ -75,6 +75,8 @@ // // oln_virtual_typedef(fwd_piter); // // oln_virtual_typedef(bkd_piter); + oln_virtual_typedef(is_computed); + // oln_virtual_typedef(value); // oln_virtual_typedef(rvalue); Index: oln/core/abstract/image/hierarchies.hh =================================================================== --- oln/core/abstract/image/hierarchies.hh (revision 649) +++ oln/core/abstract/image/hierarchies.hh (working copy) @@ -40,13 +40,14 @@ typedef hierarchy<abstract::image, 4> image_hierarchy_wrt_bbox; typedef hierarchy<abstract::image, 5> image_hierarchy_wrt_accessibility; typedef hierarchy<abstract::image, 6> image_hierarchy_wrt_mutability; + typedef hierarchy<abstract::image, 7> image_hierarchy_wrt_computability; - typedef hierarchy<abstract::image, 7> image_hybrid_hierarchy_wrt_classical; + typedef hierarchy<abstract::image, 8> image_hybrid_hierarchy_wrt_classical; // FIXME: To be continued. #if 0 - typedef hierarchy<abstract::image, 8> image_hierarchy_wrt_value; - typedef hierarchy<abstract::image, 9> image_hierarchy_wrt_data_retrieval; + typedef hierarchy<abstract::image, 9> image_hierarchy_wrt_value; + typedef hierarchy<abstract::image, 10> image_hierarchy_wrt_data_retrieval; // ... #endif Index: oln/core/abstract/image/computability/hierarchy.hh =================================================================== --- oln/core/abstract/image/computability/hierarchy.hh (revision 0) +++ oln/core/abstract/image/computability/hierarchy.hh (revision 0) @@ -0,0 +1,111 @@ +// 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_ABSTRACT_IMAGE_COMPUTABILITY_HIERARCHY_HH +# define OLN_CORE_ABSTRACT_IMAGE_COMPUTABILITY_HIERARCHY_HH + +# include <oln/core/abstract/image.hh> +# include <oln/core/abstract/image/hierarchies.hh> +// # include <oln/core/automatic/image/computed_image.hh> +// # include <oln/core/automatic/image/plain_image.hh> + + + +namespace oln +{ + + /*--------------. + | Abstraction. | + `---------------*/ + + namespace abstract + { + + /// Image whose data are computed. + template <typename E> + struct computed_image : + public virtual image<E> //, public automatic::get_impl< computed_image, E> + { + protected: + + /// Constructor (protected, empty). + computed_image(); + }; + + + /// Image whose data are *not* computed so they are *plain*. + template <typename E> + struct plain_image : + public virtual image<E> //, public automatic::get_impl< plain_image, E> + { + protected: + + /// Constructor (protected, empty). + plain_image(); + }; + + +# ifndef OLN_INCLUDE_ONLY + + template <typename E> + computed_image<E>::computed_image() + { + } + + template <typename E> + plain_image<E>::plain_image() + { + } + +# endif + + } // end of namespace oln::abstract + + + /*--------------------. + | Computability switch. | + `--------------------*/ + + /// With computability. + template <typename E> + struct case_< image_hierarchy_wrt_computability, E, 1 > : + where_< mlc::eq_< oln_type_of(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_ > > + { + typedef abstract::plain_image<E> ret; + }; + +} // end of namespace oln + + +#endif // ! OLN_CORE_ABSTRACT_IMAGE_COMPUTABILITY_HIERARCHY_HH Index: oln/core/abstract/image/all.hh =================================================================== --- oln/core/abstract/image/all.hh (revision 649) +++ oln/core/abstract/image/all.hh (working copy) @@ -44,7 +44,10 @@ # include <oln/core/abstract/image/accessibility/hierarchy.hh> // Hierarchy 6: image w.r.t. data mutability. # include <oln/core/abstract/image/mutability/hierarchy.hh> -// Hybrid hierarchy 7: image w.r.t. classical features. +// Hierarchy 7: image w.r.t. computability. +# include <oln/core/abstract/image/computability/hierarchy.hh> + +// Hybrid hierarchy 8: image w.r.t. classical features. # include <oln/core/abstract/image/hybrid/classical.hh> #endif // ! OLN_CORE_ABSTRACT_IMAGE_ALL_HH Index: oln/core/1d/image1d.hh =================================================================== --- oln/core/1d/image1d.hh (revision 650) +++ oln/core/1d/image1d.hh (working copy) @@ -58,6 +58,7 @@ typedef point1d point_type; + typedef mlc::false_ is_computed_type; typedef T value_type; typedef T& lvalue_type; typedef mlc::true_ is_mutable_type; Index: oln/core/2d/image2d.hh =================================================================== --- oln/core/2d/image2d.hh (revision 650) +++ oln/core/2d/image2d.hh (working copy) @@ -58,6 +58,7 @@ typedef point2d point_type; + typedef mlc::false_ is_computed_type; typedef T value_type; typedef T& lvalue_type; typedef mlc::true_ is_mutable_type; Index: oln/core/3d/image3d.hh =================================================================== --- oln/core/3d/image3d.hh (revision 650) +++ oln/core/3d/image3d.hh (working copy) @@ -58,6 +58,7 @@ typedef point3d point_type; + typedef mlc::false_ is_computed_type; typedef T value_type; typedef T& lvalue_type; typedef mlc::true_ is_mutable_type; Index: oln/core/gen/mapimage.hh =================================================================== --- oln/core/gen/mapimage.hh (revision 650) +++ oln/core/gen/mapimage.hh (working copy) @@ -55,6 +55,7 @@ typedef fwd_piter_bbox_<topo_type> fwd_piter_type; typedef bkd_piter_bbox_<topo_type> bkd_piter_type; + typedef mlc::false_ is_computed_type; typedef value_t value_type; typedef mlc::true_ is_mutable_type; Index: oln/morpher/value_cast.hh =================================================================== --- oln/morpher/value_cast.hh (revision 649) +++ oln/morpher/value_cast.hh (working copy) @@ -57,6 +57,7 @@ template <typename Image, typename Value> struct vtypes< morpher::value_cast<Image, Value> > { + typedef mlc::true_ is_computed_type; typedef Value value_type; typedef mlc::false_ is_mutable_type; }; Index: oln/morpher/thru_fun.hh =================================================================== --- oln/morpher/thru_fun.hh (revision 649) +++ oln/morpher/thru_fun.hh (working copy) @@ -59,7 +59,8 @@ { private: typedef oln_type_of(Image, rvalue) old_value_type; - public: + public: + typedef mlc::true_ is_computed_type; typedef xtd_res_1(Fun, old_value_type) value_type; typedef mlc::false_ is_mutable_type; }; Index: oln/morpher/internal/image_value_morpher.hh =================================================================== --- oln/morpher/internal/image_value_morpher.hh (revision 649) +++ oln/morpher/internal/image_value_morpher.hh (working copy) @@ -64,8 +64,11 @@ { // 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::undefined is_mutable_type; }; template <typename Image, typename Exact>