652: Replace the 'is_mutable' property by checking the 'lvalue' type.

2006-10-17 Thierry GERAUD <theo@tegucigalpa.lrde.epita.fr> Replace the 'is_mutable' property by checking the 'lvalue' type. * oln/core/automatic/image/image_being_mutable.hh: Rename as... * oln/core/automatic/image/mutable_image.hh: ...this. (image_being_mutable): Rename as... (mutable_image): ...this. * oln/level/fill.hh: Update. * oln/core/typedefs.hh (is_mutable_type): Remove; obsolete. * oln/core/abstract/image/mutability/hierarchy.hh (include) : Update. (image_being_mutable): Rename as... (mutable_image): ...this. (case_): Rely now on mlc_is_ok(oln_lvalue(E)). * oln/core/1d/image1d.hh: Update. * oln/core/2d/image2d.hh: Update. * oln/core/3d/image3d.hh: Update. * oln/core/gen/mapimage.hh: Update. * oln/morpher/value_cast.hh: Update. * oln/morpher/thru_fun.hh: Update. * oln/morpher/internal/image_value_morpher.hh: Update. Index: oln/level/fill.hh =================================================================== --- oln/level/fill.hh (revision 651) +++ oln/level/fill.hh (working copy) @@ -34,7 +34,7 @@ # include <oln/core/abstract/image.hh> # include <oln/core/abstract/iterator.hh> -# include <oln/core/automatic/image/image_being_mutable.hh> +# include <oln/core/automatic/image/mutable_image.hh> namespace oln @@ -50,7 +50,7 @@ /// Fwd decl. template <typename I> - void fill(abstract::image<I>& input, const oln_type_of(I, value)& val); + void fill(abstract::mutable_image<I>& input, const oln_value(I)& val); # ifndef OLN_INCLUDE_ONLY @@ -60,10 +60,9 @@ /// Generic version. template <typename I> - void fill(abstract::image_being_mutable<I>& input, - const oln_type_of(I, value)& val) + void fill(abstract::mutable_image<I>& input, const oln_value(I)& val) { - oln_type_of(I, piter) p(input.topo()); + oln_piter(I) p(input.topo()); for_all(p) input(p) = val; } @@ -73,14 +72,8 @@ /// Facade. template <typename I> - void fill(abstract::image<I>& input, const oln_value(I)& val) + void fill(abstract::mutable_image<I>& input, const oln_value(I)& val) { - // Precondition. - mlc::assert_< - mlc_is_a(I, abstract::image_being_mutable), - ERROR::FIRST_ARGUMENT_OF_oln_level_fill_IS_NOT_MUTABLE - >::check(); - impl::fill(input.exact(), val); } Index: oln/core/typedefs.hh =================================================================== --- oln/core/typedefs.hh (revision 651) +++ oln/core/typedefs.hh (working copy) @@ -127,7 +127,6 @@ mlc_decl_typedef(value_type); mlc_decl_typedef(rvalue_type); mlc_decl_typedef(lvalue_type); - mlc_decl_typedef(is_mutable_type); // -------------------------------------------------------------------- // FIXME: To be enabled later. Index: oln/core/automatic/image/mutable_image.hh =================================================================== --- oln/core/automatic/image/mutable_image.hh (revision 650) +++ oln/core/automatic/image/mutable_image.hh (working copy) @@ -25,8 +25,8 @@ // reasons why the executable file might be covered by the GNU General // Public License. -#ifndef OLN_CORE_AUTOMATIC_IMAGE_IMAGE_BEING_MUTABLE_HH -# define OLN_CORE_AUTOMATIC_IMAGE_IMAGE_BEING_MUTABLE_HH +#ifndef OLN_CORE_AUTOMATIC_IMAGE_MUTABLE_IMAGE_HH +# define OLN_CORE_AUTOMATIC_IMAGE_MUTABLE_IMAGE_HH # include <oln/core/automatic/impl.hh> # include <oln/morpher/tags.hh> @@ -37,7 +37,7 @@ // Forward declaration. namespace abstract { - template <typename E> class image_being_mutable; + template <typename E> class mutable_image; } // end of namespace oln::abstract @@ -45,9 +45,9 @@ namespace automatic { /// Implementation corresponding to the interface - /// oln::abstract::image_being_mutable for an identity morpher. + /// oln::abstract::mutable_image for an identity morpher. template <typename E> - class set_impl<abstract::image_being_mutable, morpher::tag::identity, E> : + class set_impl<abstract::mutable_image, morpher::tag::identity, E> : public virtual stc::any__simple<E> { public: @@ -59,7 +59,7 @@ template <typename E> oln_lvalue(E) - set_impl<abstract::image_being_mutable, morpher::tag::identity, E> + set_impl<abstract::mutable_image, morpher::tag::identity, E> ::impl_op_readwrite(const oln_psite(E)& p) { return this->exact().delegate().operator()(p); @@ -71,4 +71,4 @@ } // end of namespace oln -#endif // ! OLN_CORE_AUTOMATIC_IMAGE_IMAGE_BEING_MUTABLE_HH +#endif // ! OLN_CORE_AUTOMATIC_IMAGE_MUTABLE_IMAGE_HH Index: oln/core/automatic/image/image_being_mutable.hh =================================================================== --- oln/core/automatic/image/image_being_mutable.hh (revision 651) +++ oln/core/automatic/image/image_being_mutable.hh (working copy) @@ -1,74 +0,0 @@ -// 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_AUTOMATIC_IMAGE_IMAGE_BEING_MUTABLE_HH -# define OLN_CORE_AUTOMATIC_IMAGE_IMAGE_BEING_MUTABLE_HH - -# include <oln/core/automatic/impl.hh> -# include <oln/morpher/tags.hh> - - -namespace oln -{ - // Forward declaration. - namespace abstract - { - template <typename E> class image_being_mutable; - - } // end of namespace oln::abstract - - - namespace automatic - { - /// Implementation corresponding to the interface - /// oln::abstract::image_being_mutable for an identity morpher. - template <typename E> - class set_impl<abstract::image_being_mutable, morpher::tag::identity, E> : - public virtual stc::any__simple<E> - { - public: - /// Accessor delegation. - oln_lvalue(E) impl_op_readwrite(const oln_psite(E)& p); - }; - -# ifndef OLN_INCLUDE_ONLY - - template <typename E> - oln_lvalue(E) - set_impl<abstract::image_being_mutable, morpher::tag::identity, E> - ::impl_op_readwrite(const oln_psite(E)& p) - { - return this->exact().delegate().operator()(p); - } - -# endif - - } // end of namespace oln::automatic - -} // end of namespace oln - -#endif // ! OLN_CORE_AUTOMATIC_IMAGE_IMAGE_BEING_MUTABLE_HH Index: oln/core/abstract/image/mutability/hierarchy.hh =================================================================== --- oln/core/abstract/image/mutability/hierarchy.hh (revision 651) +++ oln/core/abstract/image/mutability/hierarchy.hh (working copy) @@ -30,7 +30,7 @@ # include <oln/core/abstract/image.hh> # include <oln/core/abstract/image/hierarchies.hh> -# include <oln/core/automatic/image/image_being_mutable.hh> +# include <oln/core/automatic/image/mutable_image.hh> @@ -46,15 +46,10 @@ /// Image being mutable. template <typename E> - struct image_being_mutable : + struct mutable_image : public virtual image<E>, - public automatic::get_impl<image_being_mutable, E> + public automatic::get_impl<mutable_image, E> { - private: - - typedef oln_type_of(E, lvalue) lvalue_t; - typedef oln_type_of(E, psite) psite_t; - public: struct decl @@ -68,15 +63,15 @@ using image<E>::operator(); - lvalue_t operator()(const psite_t& p); + oln_lvalue(E) operator()(const oln_psite(E)& p); protected: /// Constructor (protected, empty). - image_being_mutable(); + mutable_image(); /// Destructor (protected). - ~image_being_mutable(); + ~mutable_image(); }; @@ -84,19 +79,19 @@ # ifndef OLN_INCLUDE_ONLY template <typename E> - typename image_being_mutable<E>::lvalue_t - image_being_mutable<E>::operator()(const typename image_being_mutable<E>::psite_t& p) + oln_lvalue(E) + mutable_image<E>::operator()(const oln_psite(E)& p) { return this->exact().impl_op_readwrite(p); } template <typename E> - image_being_mutable<E>::image_being_mutable() + mutable_image<E>::mutable_image() { } template <typename E> - image_being_mutable<E>::~image_being_mutable() + mutable_image<E>::~mutable_image() { decl(); } @@ -113,9 +108,9 @@ /// With mutability. template <typename E> struct case_< image_hierarchy_wrt_mutability, E, 1 > : - where_< mlc::eq_< oln_type_of(E, is_mutable), mlc::true_ > > + where_< mlc_is_ok(oln_lvalue(E)) > { - typedef abstract::image_being_mutable<E> ret; + typedef abstract::mutable_image<E> ret; }; } // end of namespace oln Index: oln/core/1d/image1d.hh =================================================================== --- oln/core/1d/image1d.hh (revision 651) +++ oln/core/1d/image1d.hh (working copy) @@ -61,7 +61,6 @@ typedef mlc::false_ is_computed_type; typedef T value_type; typedef T& lvalue_type; - typedef mlc::true_ is_mutable_type; typedef image1d<T> real_type; }; Index: oln/core/2d/image2d.hh =================================================================== --- oln/core/2d/image2d.hh (revision 651) +++ oln/core/2d/image2d.hh (working copy) @@ -61,7 +61,6 @@ typedef mlc::false_ is_computed_type; typedef T value_type; typedef T& lvalue_type; - typedef mlc::true_ is_mutable_type; typedef image2d<T> real_type; }; Index: oln/core/3d/image3d.hh =================================================================== --- oln/core/3d/image3d.hh (revision 651) +++ oln/core/3d/image3d.hh (working copy) @@ -61,7 +61,6 @@ typedef mlc::false_ is_computed_type; typedef T value_type; typedef T& lvalue_type; - typedef mlc::true_ is_mutable_type; typedef image3d<T> real_type; }; Index: oln/core/gen/mapimage.hh =================================================================== --- oln/core/gen/mapimage.hh (revision 651) +++ oln/core/gen/mapimage.hh (working copy) @@ -57,8 +57,6 @@ typedef mlc::false_ is_computed_type; typedef value_t value_type; - - typedef mlc::true_ is_mutable_type; typedef value_t& lvalue_type; typedef void real_type; // FIXME Index: oln/morpher/value_cast.hh =================================================================== --- oln/morpher/value_cast.hh (revision 651) +++ oln/morpher/value_cast.hh (working copy) @@ -59,7 +59,6 @@ { typedef mlc::true_ is_computed_type; typedef Value value_type; - typedef mlc::false_ is_mutable_type; }; template <typename Image, typename Value> Index: oln/morpher/thru_fun.hh =================================================================== --- oln/morpher/thru_fun.hh (revision 651) +++ oln/morpher/thru_fun.hh (working copy) @@ -62,7 +62,6 @@ 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 651) +++ oln/morpher/internal/image_value_morpher.hh (working copy) @@ -68,7 +68,6 @@ 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>
participants (1)
-
Thierry GERAUD