https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Fix the mutability of value-wise random accessible images.
* oln/core/typedefs.hh (is_value_wise_mutable_type): New virtual
type declaration.
* oln/core/abstract/image/value_wise_accessibility/hierarchy.hh
(struct case_<image_hierarchy_wrt_value_wise_accessibility, E, 2>):
Re-enable.
Swap with...
(struct case_<image_hierarchy_wrt_value_wise_accessibility, E, 1>):
...this case.
* oln/morpher/with_lut.hh
(vtypes< morpher::with_lut<Image, Lut> >::is_value_wise_mutable_type):
New virtual type.
Set to mlc::true_.
core/abstract/image/value_wise_accessibility/hierarchy.hh | 27 +++++++-------
core/typedefs.hh | 2 +
morpher/with_lut.hh | 10 ++++-
3 files changed, 24 insertions(+), 15 deletions(-)
Index: oln/core/typedefs.hh
--- oln/core/typedefs.hh (revision 690)
+++ oln/core/typedefs.hh (working copy)
@@ -156,6 +156,8 @@
mlc_decl_typedef(size_type); // FIXME: To be removed.
mlc_decl_typedef(topo_type);
mlc_decl_typedef(bbox_type);
+
+ mlc_decl_typedef(is_value_wise_mutable_type);
// --------------------------------------------------------------------
// FIXME: To be enabled later.
// --------------------------------------------------------------------
Index: oln/core/abstract/image/value_wise_accessibility/hierarchy.hh
--- oln/core/abstract/image/value_wise_accessibility/hierarchy.hh (revision 690)
+++ oln/core/abstract/image/value_wise_accessibility/hierarchy.hh (working copy)
@@ -122,31 +122,32 @@
} // end of namespace oln::abstract
- /*-------------------.
- | Dimension switch. |
- `-------------------*/
+ /*----------------------------------.
+ | Value-wise accessibility switch. |
+ `----------------------------------*/
/* FIXME: Handle mutability. This is not easy, as, for instance an
image with LUT has no lvalue type, but can be perfectly const or
mutable. How can we deal with this? By adding a specific
vtype? */
- /// With value-wise random accessibility (
+ /// With mutable value-wise random accessibility.
template <typename E>
struct case_< image_hierarchy_wrt_value_wise_accessibility, E, 1 > :
- where_< mlc_is_ok(oln_type_of(E, fwd_viter)) >
+ where_< mlc_and( mlc_is_ok(oln_type_of(E, fwd_viter)),
+ mlc_eq( oln_type_of(E, is_value_wise_mutable),
+ mlc::true_) ) >
{
typedef abstract::mutable_image_being_value_wise_random_accessible<E> ret;
};
-// /// With accessibility.
-// template <typename E>
-// struct case_< image_hierarchy_wrt_value_wise_accessibility, E, 2 > :
-// where_< mlc_and( mlc_is_ok(oln_type_of(E, fwd_viter)),
-// mlc_is_ok(oln_type_of(E, lvalue)) ) >
-// {
-// typedef abstract::mutable_image_being_value_wise_random_accessible<E> ret;
-// };
+ /// With (constant) value-wise random accessibility.
+ template <typename E>
+ struct case_< image_hierarchy_wrt_value_wise_accessibility, E, 2 > :
+ where_< mlc_is_ok(oln_type_of(E, fwd_viter)) >
+ {
+ typedef abstract::image_being_value_wise_random_accessible<E> ret;
+ };
} // end of namespace oln
Index: oln/morpher/with_lut.hh
--- oln/morpher/with_lut.hh (revision 690)
+++ oln/morpher/with_lut.hh (working copy)
@@ -67,8 +67,14 @@
typedef Lut lut_type;
// rvalue_type: see below.
- // lvalue_type: undefined (see
- // oln/morpher/internal/image_value_morpher.hh).
+ /* lvalue_type: undefined
+ (see oln/morpher/internal/image_value_morpher.hh). */
+
+ /* Mutability.
+ As the virtual type `lvalue' is undefined in with_lut<>, it is
+ not point-wise mutable. However, it is value-wise mutable,
+ i.e., the values of the look-up table can be modified. */
+ typedef mlc::true_ is_value_wise_mutable_type;
// fwd_viter_type: see below.
// mutable_fwd_viter_type: see below.