Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
October 2006
- 3 participants
- 108 discussions
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Clean up virtual types declarations.
* oln/core/typedefs.hh (size_type): Remove virtual type
declaration.
Clean up.
typedefs.hh | 58 ----------------------------------------------------------
1 file changed, 58 deletions(-)
Index: oln/core/typedefs.hh
--- oln/core/typedefs.hh (revision 692)
+++ oln/core/typedefs.hh (working copy)
@@ -84,14 +84,6 @@
| Iterators. |
`------------*/
-// --------------------------------------------------------------------
-// FIXME: To be enabled later.
-// --------------------------------------------------------------------
-// mlc_decl_typedef(iter_type);
-// mlc_decl_typedef(fwd_iter_type);
-// mlc_decl_typedef(bkd_iter_type);
-// --------------------------------------------------------------------
-
mlc_decl_typedef(piter_type);
mlc_decl_typedef(fwd_piter_type);
mlc_decl_typedef(bkd_piter_type);
@@ -123,22 +115,11 @@
| category::image. |
`------------------*/
-// --------------------------------------------------------------------
-// FIXME: To be enabled later.
-// --------------------------------------------------------------------
-// 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);
-// --------------------------------------------------------------------
-// FIXME: To be enabled later.
-// --------------------------------------------------------------------
-// mlc_decl_typedef(value_storage_type);
-// mlc_decl_typedef(storage_type);
-// --------------------------------------------------------------------
mlc_decl_typedef(psite_type);
mlc_decl_typedef(point_type);
mlc_decl_typedef(dpoint_type);
@@ -146,37 +127,11 @@
mlc_decl_typedef(neighborhood_type);
mlc_decl_typedef(subset_type);
-// --------------------------------------------------------------------
-// FIXME: To be enabled later.
-// --------------------------------------------------------------------
-// mlc_decl_typedef(image_type);
-// --------------------------------------------------------------------
-
mlc_decl_typedef(delegated_type);
- 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.
-// --------------------------------------------------------------------
-// mlc_decl_typedef(window_type);
-// --------------------------------------------------------------------
-
-
- // ------------------------------ //
- // Extension in image_operators. //
- // ------------------------------ //
-
-// --------------------------------------------------------------------
-// FIXME: To be enabled later.
-// --------------------------------------------------------------------
-// mlc_decl_typedef(output_type);
-// mlc_decl_typedef(input_type);
-// mlc_decl_typedef(input1_type);
-// mlc_decl_typedef(input2_type);
-// --------------------------------------------------------------------
/*-----------------.
@@ -204,19 +159,6 @@
mlc_decl_typedef(lut_iter_type);
- /*------------------------------------.
- | category::fun1 and category::fun2. |
- `------------------------------------*/
-
-// --------------------------------------------------------------------
-// FIXME: To be enabled later.
-// --------------------------------------------------------------------
-// mlc_decl_typedef(res_type);
-// mlc_decl_typedef(arg_type);
-// mlc_decl_typedef(left_type);
-// mlc_decl_typedef(right_type);
-// --------------------------------------------------------------------
-
} // end of namespace oln
1
0
692: Rename the ``accessibility'' hierarchy as ``point_wise_accessibility''.
by Roland Levillain 31 Oct '06
by Roland Levillain 31 Oct '06
31 Oct '06
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Rename the ``accessibility'' hierarchy as ``point_wise_accessibility''.
* oln/core/abstract/image/accessibility/hierarchy.hh:
Rename as...
* oln/core/abstract/image/point_wise_accessibility/hierarchy.hh:
...this.
Adjust header guards.
(oln::abstract::image_being_random_accessible): Rename as...
(oln::abstract::image_being_point_wise_random_accessible): ...this.
Adjust.
(oln::case_<image_hierarchy_wrt_accessibility, E, 1>): Rename as...
(oln::case_<image_hierarchy_wrt_point_wise_accessibility, E, 1>):
...this.
Adjust.
* oln/core/abstract/image/hierarchies.hh,
* oln/core/abstract/image/all.hh,
* oln/core/abstract/image/hybrid/classical.hh: Adjust.
* oln/core/automatic/image/image_being_random_accessible.hh:
Adjust.
Rename as...
* oln/core/automatic/image/image_being_point_wise_random_accessible.hh:
...this.
Adjust header guards.
* oln/Makefile.am (nobase_oln_HEADERS): Remove
core/abstract/image/accessibility/hierarchy.hh and
core/automatic/image/image_being_random_accessible.hh.
Add core/abstract/image/point_wise_accessibility/hierarchy.hh
and core/automatic/image/image_being_point_wise_random_accessible.hh.
Remove duplicate core/automatic/image/image_having_neighborhood.hh
Makefile.am | 9 +-
core/abstract/image/all.hh | 4 -
core/abstract/image/hierarchies.hh | 2
core/abstract/image/hybrid/classical.hh | 10 +-
core/abstract/image/point_wise_accessibility/hierarchy.hh | 40 +++++-----
core/automatic/image/image_being_point_wise_random_accessible.hh | 16 ++--
6 files changed, 40 insertions(+), 41 deletions(-)
Index: oln/core/automatic/image/image_being_point_wise_random_accessible.hh
--- oln/core/automatic/image/image_being_point_wise_random_accessible.hh (revision 690)
+++ oln/core/automatic/image/image_being_point_wise_random_accessible.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_RANDOM_ACCESSIBLE_HH
-# define OLN_CORE_AUTOMATIC_IMAGE_IMAGE_BEING_RANDOM_ACCESSIBLE_HH
+#ifndef OLN_CORE_AUTOMATIC_IMAGE_IMAGE_BEING_POINT_WISE_RANDOM_ACCESSIBLE_HH
+# define OLN_CORE_AUTOMATIC_IMAGE_IMAGE_BEING_POINT_WISE_RANDOM_ACCESSIBLE_HH
# include <oln/core/automatic/impl.hh>
# include <oln/morpher/tags.hh>
@@ -38,7 +38,7 @@
// Forward declaration.
namespace abstract
{
- template <typename E> class image_being_random_accessible;
+ template <typename E> class image_being_point_wise_random_accessible;
} // end of namespace oln::abstract
@@ -47,10 +47,10 @@
{
/// Default implementation corresponding to the interface
- /// oln::abstract::image_being_random_accessible.
+ /// oln::abstract::image_being_point_wise_random_accessible.
template <typename E, typename M>
- class set_impl<abstract::image_being_random_accessible, M, E> :
+ class set_impl<abstract::image_being_point_wise_random_accessible, M, E> :
public virtual stc::any__simple<E>
{
private:
@@ -69,14 +69,14 @@
template <typename E, typename M>
bool
- set_impl<abstract::image_being_random_accessible, M, E>::impl_has(const typename set_impl<abstract::image_being_random_accessible, M, E>::point_t& p) const
+ set_impl<abstract::image_being_point_wise_random_accessible, M, E>::impl_has(const typename set_impl<abstract::image_being_point_wise_random_accessible, M, E>::point_t& p) const
{
return this->exact().topo().has(p);
}
template <typename E, typename M>
bool
- set_impl<abstract::image_being_random_accessible, M, E>::impl_has_large(const typename set_impl<abstract::image_being_random_accessible, M, E>::point_t& p) const
+ set_impl<abstract::image_being_point_wise_random_accessible, M, E>::impl_has_large(const typename set_impl<abstract::image_being_point_wise_random_accessible, M, E>::point_t& p) const
{
return this->exact().has(p);
}
@@ -87,4 +87,4 @@
} // end of namespace oln
-#endif // ! OLN_CORE_AUTOMATIC_IMAGE_IMAGE_BEING_RANDOM_ACCESSIBLE_HH
+#endif // ! OLN_CORE_AUTOMATIC_IMAGE_IMAGE_BEING_POINT_WISE_RANDOM_ACCESSIBLE_HH
Index: oln/core/abstract/image/hybrid/classical.hh
--- oln/core/abstract/image/hybrid/classical.hh (revision 691)
+++ oln/core/abstract/image/hybrid/classical.hh (working copy)
@@ -35,7 +35,7 @@
# include <oln/core/abstract/image/dimension/2d.hh>
# include <oln/core/abstract/image/dimension/3d.hh>
# include <oln/core/abstract/image/bbox/hierarchy.hh>
-# include <oln/core/abstract/image/accessibility/hierarchy.hh>
+# include <oln/core/abstract/image/point_wise_accessibility/hierarchy.hh>
/* Image dimension hierarchy (summary).
@@ -63,10 +63,10 @@
| `---------------------' | |
| | | |
| | | |
- ,-------------------------------------------------------------.
- | if (deduce_type_of(I, topo, is_random_accessible) == true) |
+ ,------------------------------------------------------------------------.
+ | if (deduce_type_of(I, topo, is_point_wise_random_accessible) == true) |
| and (deduce_type_of(I, topo, bbox) != not_found) |
- `-------------------------------------------------------------'
+ `------------------------------------------------------------------------'
| | | |
o o o o
@@ -99,7 +99,7 @@
template <typename E>
struct classical_image
: public virtual abstract::image_having_bbox<E>,
- public virtual abstract::image_being_random_accessible<E>
+ public virtual abstract::image_being_point_wise_random_accessible<E>
{
protected:
classical_image();
Index: oln/core/abstract/image/hierarchies.hh
--- oln/core/abstract/image/hierarchies.hh (revision 691)
+++ oln/core/abstract/image/hierarchies.hh (working copy)
@@ -38,7 +38,7 @@
typedef hierarchy<abstract::image, 2> image_hierarchy_wrt_type;
typedef hierarchy<abstract::image, 3> image_hierarchy_wrt_neighborhood;
typedef hierarchy<abstract::image, 4> image_hierarchy_wrt_bbox;
- typedef hierarchy<abstract::image, 5> image_hierarchy_wrt_accessibility;
+ typedef hierarchy<abstract::image, 5> image_hierarchy_wrt_point_wise_accessibility;
typedef hierarchy<abstract::image, 6> image_hierarchy_wrt_mutability;
typedef hierarchy<abstract::image, 7> image_hierarchy_wrt_computability;
typedef hierarchy<abstract::image, 8> image_hierarchy_wrt_value_wise_accessibility;
Index: oln/core/abstract/image/all.hh
--- oln/core/abstract/image/all.hh (revision 691)
+++ oln/core/abstract/image/all.hh (working copy)
@@ -40,8 +40,8 @@
# include <oln/core/abstract/image/neighborhood/hierarchy.hh>
// Hierarchy 4: image w.r.t. bounding box.
# include <oln/core/abstract/image/bbox/hierarchy.hh>
-// Hierarchy 5: image w.r.t. point accessibility.
-# include <oln/core/abstract/image/accessibility/hierarchy.hh>
+// Hierarchy 5: image w.r.t. point point-wise accessibility.
+# include <oln/core/abstract/image/point_wise_accessibility/hierarchy.hh>
// Hierarchy 6: image w.r.t. data mutability.
# include <oln/core/abstract/image/mutability/hierarchy.hh>
// Hierarchy 7: image w.r.t. computability.
Index: oln/core/abstract/image/point_wise_accessibility/hierarchy.hh
--- oln/core/abstract/image/point_wise_accessibility/hierarchy.hh (revision 691)
+++ oln/core/abstract/image/point_wise_accessibility/hierarchy.hh (working copy)
@@ -25,29 +25,29 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef OLN_CORE_ABSTRACT_IMAGE_ACCESSIBILITY_HIERARCHY_HH
-# define OLN_CORE_ABSTRACT_IMAGE_ACCESSIBILITY_HIERARCHY_HH
+#ifndef OLN_CORE_ABSTRACT_IMAGE_POINT_WISE_ACCESSIBILITY_HIERARCHY_HH
+# define OLN_CORE_ABSTRACT_IMAGE_POINT_WISE_ACCESSIBILITY_HIERARCHY_HH
# include <oln/core/abstract/image.hh>
# include <oln/core/abstract/image/hierarchies.hh>
-# include <oln/core/automatic/image/image_being_random_accessible.hh>
+# include <oln/core/automatic/image/image_being_point_wise_random_accessible.hh>
namespace oln
{
- /*-------------------------.
- | Dimension abstractions. |
- `-------------------------*/
+ /*----------------------------------------.
+ | Point-wise accessibility abstractions. |
+ `----------------------------------------*/
namespace abstract
{
- /// Image having a accessibility.
+ /// Image having a point-wise random accessibility.
template <typename E>
- struct image_being_random_accessible :
+ struct image_being_point_wise_random_accessible :
public virtual image<E>,
- public automatic::get_impl< image_being_random_accessible, E >
+ public automatic::get_impl< image_being_point_wise_random_accessible, E >
{
typedef oln_type_of(E, point) point_t;
@@ -62,7 +62,7 @@
protected:
/// Constructor (protected, empty).
- image_being_random_accessible();
+ image_being_point_wise_random_accessible();
};
@@ -70,19 +70,19 @@
# ifndef OLN_INCLUDE_ONLY
template <typename E>
- bool image_being_random_accessible<E>::has(const typename image_being_random_accessible<E>::point_t& p) const
+ bool image_being_point_wise_random_accessible<E>::has(const typename image_being_point_wise_random_accessible<E>::point_t& p) const
{
return this->exact().impl_has(p);
}
template <typename E>
- bool image_being_random_accessible<E>::has_large(const typename image_being_random_accessible<E>::point_t& p) const
+ bool image_being_point_wise_random_accessible<E>::has_large(const typename image_being_point_wise_random_accessible<E>::point_t& p) const
{
return this->exact().impl_has_large(p);
}
template <typename E>
- image_being_random_accessible<E>::image_being_random_accessible()
+ image_being_point_wise_random_accessible<E>::image_being_point_wise_random_accessible()
{
}
@@ -91,19 +91,19 @@
} // end of namespace oln::abstract
- /*-------------------.
- | Dimension switch. |
- `-------------------*/
+ /*----------------------------------.
+ | Point-wise accessibility switch. |
+ `----------------------------------*/
- /// With accessibility.
+ /// With point-wise accessibility.
template <typename E>
- struct case_< image_hierarchy_wrt_accessibility, E, 1 > :
+ struct case_< image_hierarchy_wrt_point_wise_accessibility, E, 1 > :
where_< mlc::eq_< oln_deduce_type_of(E, topo, is_random_accessible), mlc::true_ > >
{
- typedef abstract::image_being_random_accessible<E> ret;
+ typedef abstract::image_being_point_wise_random_accessible<E> ret;
};
} // end of namespace oln
-#endif // ! OLN_CORE_ABSTRACT_IMAGE_ACCESSIBILITY_HIERARCHY_HH
+#endif // ! OLN_CORE_ABSTRACT_IMAGE_POINT_WISE_ACCESSIBILITY_HIERARCHY_HH
Index: oln/Makefile.am
--- oln/Makefile.am (revision 691)
+++ oln/Makefile.am (working copy)
@@ -33,8 +33,6 @@
core/3d/topo3d.hh \
core/3d/window3d.hh \
\
- core/abstract/image/accessibility/hierarchy.hh \
- \
core/abstract/image/bbox/hierarchy.hh \
\
core/abstract/image/computability/hierarchy.hh \
@@ -50,6 +48,8 @@
\
core/abstract/image/neighborhood/hierarchy.hh \
\
+ core/abstract/image/point_wise_accessibility/hierarchy.hh \
+ \
core/abstract/image/type/binary.hh \
core/abstract/image/type/color.hh \
core/abstract/image/type/data.hh \
@@ -105,10 +105,9 @@
core/automatic/image/mutable_image1d.hh \
core/automatic/image/mutable_image2d.hh \
core/automatic/image/mutable_image3d.hh \
- core/automatic/image/image_being_random_accessible.hh \
- core/automatic/image/image_having_neighborhood.hh \
- core/automatic/image/image_having_neighborhood.hh \
+ core/automatic/image/image_being_point_wise_random_accessible.hh \
core/automatic/image/image_being_value_wise_random_accessible.hh \
+ core/automatic/image/image_having_neighborhood.hh \
\
core/automatic/topology/topology_being_random_accessible.hh \
core/automatic/topology/topology_having_bbox.hh \
1
0
31 Oct '06
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.
1
0
https://svn.lrde.epita.fr/svn/oln/trunk
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Fix CXXFLAGS usage.
* configure.ac: Erase CXXFLAGS if the user doesn't set it.
configure.ac | 6 ++++++
extended/ChangeLog | 4 ++++
extended/tests/Makefile.am | 7 +++----
metalic/ChangeLog | 4 ++++
metalic/tests/Makefile.am | 7 +++----
olena/ChangeLog | 7 +++++++
olena/tests/algorithms/Makefile.am | 8 ++++----
olena/tests/core/Makefile.am | 8 ++++----
olena/tests/io/Makefile.am | 8 ++++----
olena/tests/morphers/Makefile.am | 8 ++++----
olena/tests/value/Makefile.am | 8 ++++----
static/ChangeLog | 5 +++++
static/stc/scoop.hh | 3 ++-
static/tests/Makefile.am | 7 +++----
14 files changed, 57 insertions(+), 33 deletions(-)
Index: extended/tests/Makefile.am
--- extended/tests/Makefile.am (revision 689)
+++ extended/tests/Makefile.am (working copy)
@@ -6,11 +6,10 @@
#
# AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_DEBUG)
#
-# when oln.m4 is available in the distribution.
-# Meanwhile, alter CXXFLAGS to turn off any optimization (Automake will
-# warn against this, but that's OK).
+# when oln.m4 is available in the distribution, instead of using the
+# set-by-hand TESTS_CXXFLAGS.
TESTS_CXXFLAGS = @TESTS_CXXFLAGS@
-CXXFLAGS += $(TESTS_CXXFLAGS)
+AM_CXXFLAGS = $(TESTS_CXXFLAGS)
check_PROGRAMS = \
Index: extended/ChangeLog
--- extended/ChangeLog (revision 689)
+++ extended/ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2006-10-31 Roland Levillain <roland(a)lrde.epita.fr>
+
+ * tests/Makefile.am: Alter AM_CXXFLAGS instead of CXXFLAGS.
+
2006-10-27 Roland Levillain <roland(a)lrde.epita.fr>
Fix the distribution.
Index: configure.ac
--- configure.ac (revision 689)
+++ configure.ac (working copy)
@@ -23,6 +23,12 @@
## C++ compiler set up. ##
## --------------------- ##
+# If the user doesn't provide any CXXFLAGS, prevent Autoconf from
+# settings its own default ones (e.g., `-g -O2' for g++).
+if test ! ${CXXFLAGS+set}; then
+ CXXFLAGS=""
+fi
+
# Look for a C++ compiler.
AC_LANG([C++])
AC_PROG_CXX
Index: static/tests/Makefile.am
--- static/tests/Makefile.am (revision 689)
+++ static/tests/Makefile.am (working copy)
@@ -6,11 +6,10 @@
#
# AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_DEBUG)
#
-# when oln.m4 is available in the distribution.
-# Meanwhile, alter CXXFLAGS to turn off any optimization (Automake will
-# warn against this, but that's OK).
+# when oln.m4 is available in the distribution, instead of using the
+# set-by-hand TESTS_CXXFLAGS.
TESTS_CXXFLAGS = @TESTS_CXXFLAGS@
-CXXFLAGS += $(TESTS_CXXFLAGS)
+AM_CXXFLAGS = $(TESTS_CXXFLAGS)
check_PROGRAMS = \
Index: static/ChangeLog
--- static/ChangeLog (revision 689)
+++ static/ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2006-10-31 Roland Levillain <roland(a)lrde.epita.fr>
+
+ * tests/Makefile.am: Alter AM_CXXFLAGS instead of CXXFLAGS.
+ * stc/scoop.hh: Fix comment.
+
2006-10-09 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
* stc/scoop.hh (stc_virtual_typedef): Remove this macro which
Index: static/stc/scoop.hh
--- static/stc/scoop.hh (revision 689)
+++ static/stc/scoop.hh (working copy)
@@ -63,7 +63,7 @@
namespace stc
{
- /// Error messages raised by static assertions.
+ /// Error messages raised by static assertions/abortions.
namespace ERROR
{
@@ -203,6 +203,7 @@
\
/** Accessor helper: specializations for the case of two super */ \
/** classes or more. */ \
+ /* FIXME: Currently works only for 2 and 3 super types. */ \
template <typename super1, typename super2, typename super3> \
struct get_super_types_helper< mlc::valist_ <super1, super2, super3> > \
{ \
Index: metalic/tests/Makefile.am
--- metalic/tests/Makefile.am (revision 689)
+++ metalic/tests/Makefile.am (working copy)
@@ -6,11 +6,10 @@
#
# AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_DEBUG)
#
-# when oln.m4 is available in the distribution.
-# Meanwhile, alter CXXFLAGS to turn off any optimization (Automake will
-# warn against this, but that's OK).
+# when oln.m4 is available in the distribution, instead of using the
+# set-by-hand TESTS_CXXFLAGS.
TESTS_CXXFLAGS = @TESTS_CXXFLAGS@
-CXXFLAGS += $(TESTS_CXXFLAGS)
+AM_CXXFLAGS = $(TESTS_CXXFLAGS)
check_PROGRAMS = \
Index: metalic/ChangeLog
--- metalic/ChangeLog (revision 689)
+++ metalic/ChangeLog (working copy)
@@ -1,3 +1,7 @@
+2006-10-31 Roland Levillain <roland(a)lrde.epita.fr>
+
+ * tests/Makefile.am: Alter AM_CXXFLAGS instead of CXXFLAGS.
+
2006-10-27 Roland Levillain <roland(a)lrde.epita.fr>
Fix the distribution.
Index: olena/tests/morphers/Makefile.am
--- olena/tests/morphers/Makefile.am (revision 689)
+++ olena/tests/morphers/Makefile.am (working copy)
@@ -12,11 +12,11 @@
#
# AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_DEBUG)
#
-# when oln.m4 is available in the distribution.
-# Meanwhile, alter CXXFLAGS to turn off any optimization (Automake will
-# warn against this, but that's OK).
+# when oln.m4 is available in the distribution, instead of using the
+# set-by-hand TESTS_CXXFLAGS.
TESTS_CXXFLAGS = @TESTS_CXXFLAGS@
-CXXFLAGS += $(TESTS_CXXFLAGS)
+AM_CXXFLAGS = $(TESTS_CXXFLAGS)
+
check_PROGRAMS = \
identity_morpher \
Index: olena/tests/io/Makefile.am
--- olena/tests/io/Makefile.am (revision 689)
+++ olena/tests/io/Makefile.am (working copy)
@@ -12,11 +12,11 @@
#
# AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_DEBUG)
#
-# when oln.m4 is available in the distribution.
-# Meanwhile, alter CXXFLAGS to turn off any optimization (Automake will
-# warn against this, but that's OK).
+# when oln.m4 is available in the distribution, instead of using the
+# set-by-hand TESTS_CXXFLAGS.
TESTS_CXXFLAGS = @TESTS_CXXFLAGS@
-CXXFLAGS += $(TESTS_CXXFLAGS)
+AM_CXXFLAGS = $(TESTS_CXXFLAGS)
+
check_PROGRAMS = \
io_pnm
Index: olena/tests/core/Makefile.am
--- olena/tests/core/Makefile.am (revision 689)
+++ olena/tests/core/Makefile.am (working copy)
@@ -12,11 +12,11 @@
#
# AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_DEBUG)
#
-# when oln.m4 is available in the distribution.
-# Meanwhile, alter CXXFLAGS to turn off any optimization (Automake will
-# warn against this, but that's OK).
+# when oln.m4 is available in the distribution, instead of using the
+# set-by-hand TESTS_CXXFLAGS.
TESTS_CXXFLAGS = @TESTS_CXXFLAGS@
-CXXFLAGS += $(TESTS_CXXFLAGS)
+AM_CXXFLAGS = $(TESTS_CXXFLAGS)
+
check_PROGRAMS = \
dpoint2d \
Index: olena/tests/algorithms/Makefile.am
--- olena/tests/algorithms/Makefile.am (revision 689)
+++ olena/tests/algorithms/Makefile.am (working copy)
@@ -16,11 +16,11 @@
#
# AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_DEBUG)
#
-# when oln.m4 is available in the distribution.
-# Meanwhile, alter CXXFLAGS to turn off any optimization (Automake will
-# warn against this, but that's OK).
+# when oln.m4 is available in the distribution, instead of using the
+# set-by-hand TESTS_CXXFLAGS.
TESTS_CXXFLAGS = @TESTS_CXXFLAGS@
-CXXFLAGS += $(TESTS_CXXFLAGS)
+AM_CXXFLAGS = $(TESTS_CXXFLAGS)
+
check_PROGRAMS = \
fill
Index: olena/tests/value/Makefile.am
--- olena/tests/value/Makefile.am (revision 689)
+++ olena/tests/value/Makefile.am (working copy)
@@ -12,11 +12,11 @@
#
# AM_CXXFLAGS = $(CXXFLAGS_STRICT) $(CXXFLAGS_DEBUG)
#
-# when oln.m4 is available in the distribution.
-# Meanwhile, alter CXXFLAGS to turn off any optimization (Automake will
-# warn against this, but that's OK).
+# when oln.m4 is available in the distribution, instead of using the
+# set-by-hand TESTS_CXXFLAGS.
TESTS_CXXFLAGS = @TESTS_CXXFLAGS@
-CXXFLAGS += $(TESTS_CXXFLAGS)
+AM_CXXFLAGS = $(TESTS_CXXFLAGS)
+
check_PROGRAMS = \
accessor \
Index: olena/ChangeLog
--- olena/ChangeLog (revision 689)
+++ olena/ChangeLog (working copy)
@@ -1,3 +1,10 @@
+2006-10-31 Roland Levillain <roland(a)lrde.epita.fr>
+
+ * tests/algorithms/Makefile.am, tests/core/Makefile.am,
+ * tests/io/Makefile.am, tests/morphers/Makefile.am,
+ * tests/value/Makefile.am, tests/value/Makefile.am:
+ Alter AM_CXXFLAGS instead of CXXFLAGS.
+
2006-10-27 Roland Levillain <roland(a)lrde.epita.fr>
Various fixes.
1
0
https://svn.lrde.epita.fr/svn/oln/trunk
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
* TODO: Update.
TODO | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
Index: TODO
--- TODO (revision 688)
+++ TODO (working copy)
@@ -1,6 +1,68 @@
See also the TODO in oln-proto-1.0 and oln-proto-stl-style.
+* Clean up
+
+** Separate interface from implementation
+Move the contents of each block surrounded by OLN_INCLUDE_ONLY into a
+.hxx file. Don't forget to keep the #ifndef/#endif directives, and to
+comment the closing #endif. Hence, this:
+
+ // ------------------------------------------------------------
+ // foo.hh
+ #ifndef FOO_HH
+ # define FOO_HH
+
+ // (Interface.)
+
+ # ifndef OLN_INCLUDE_ONLY
+
+ // (Implementation.)
+
+ # endif
+
+ #endif // ! FOO_HH
+ // ------------------------------------------------------------
+
+should be turned into these:
+
+ // ------------------------------------------------------------
+ // foo.hh
+ #ifndef FOO_HH
+ # define FOO_HH
+
+ // (Interface.)
+
+ # ifndef OLN_INCLUDE_ONLY
+ # include <foo.hxx>
+ # endif
+
+ #endif // ! FOO_HH
+ // ------------------------------------------------------------
+
+ // ------------------------------------------------------------
+ // foo.hxx
+ #ifndef FOO_HXX
+ # define FOO_HXX
+
+ // (Implementation.)
+
+ #endif // ! FOO_HXX
+ // ------------------------------------------------------------
+
+
+(BTW, I (Roland) think that OLN_INTERFACE_ONLY would be more
+appropriate than OLN_INCLUDE_ONLY.)
+
+
+** Update the address of the FSF in Copyright notices (write a script)
+
+** Check dates for every copyright header
+Use the repository of Olena 0.10 (and previous) and Olena proto-1.0 to
+find when files have been created and modified. This task could be a
+part of the code review process.
+
+
* Release process
This is to be done later, before the release of the whole project or
of one or some of its components.
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Various fixes.
* oln/core/automatic/image/mutable_image1d.hh: Fix header guards,
(were the same as oln/core/automatic/image/image1d.hh's).
(oln::abstract::mutable_image1d): Forward-declare it.
s/abstract::image1d/abstract::mutable_image1d/g.
* oln/core/abstract/image/dimension/1d.hh (mutable_image1d)
* oln/core/abstract/image/dimension/2d.hh (mutable_image2d)
* oln/core/abstract/image/dimension/3d.hh (mutable_image3d): Fix
the lookup of impl_at().
* oln/core/type_fun/slice.hh: Remove unnecessary headers.
* oln/core/abstract/array.hh, oln/core/abstract/functions.hh,
* oln/core/internal/point_nd.hh, oln/morpher/thru_mfun.hh: Add
missing headers.
* oln/morpher/thru_fun.hh (xtd/mexpr.hh): Include it.
(struct case_<tag::fun_operator_1, mlc::pair_<Fun, A>, 1>): Turn
into...
(struct case_<tag::fun_operator_1, mlc::pair_<Fun, A>, 2>):
...this.
* oln/value/proxy.hh: Fix header guards.
(oln/core/typedefs.hh): Include it.
* oln/Makefile.am (nobase_oln_HEADERS): Add
core/abstract/image/computability/hierarchy.hh,
core/abstract/image/value_wise_accessibility/hierarchy.hh,
core/automatic/image/image_being_value_wise_random_accessible.hh,
core/gen/topo_add_isubset.hh, core/gen/fwd_viter_lut.hh,
core/internal/fwd_viter_lut.hh and value/two_way.hh.
oln/Makefile.am | 14 +++++++++++++-
oln/core/abstract/array.hh | 1 +
oln/core/abstract/functions.hh | 1 +
oln/core/abstract/image/dimension/1d.hh | 5 +++++
oln/core/abstract/image/dimension/2d.hh | 5 +++++
oln/core/abstract/image/dimension/3d.hh | 5 +++++
oln/core/automatic/image/mutable_image1d.hh | 12 ++++++------
oln/core/gen/topo_lbbox.hh | 3 ---
oln/core/internal/point_nd.hh | 4 ++++
oln/core/type_fun/slice.hh | 5 -----
oln/morpher/thru_fun.hh | 7 ++++---
oln/morpher/thru_mfun.hh | 1 +
oln/value/proxy.hh | 7 ++++---
tests/value/accessor.cc | 4 ++--
14 files changed, 51 insertions(+), 23 deletions(-)
Index: tests/value/accessor.cc
--- tests/value/accessor.cc (revision 687)
+++ tests/value/accessor.cc (working copy)
@@ -28,7 +28,7 @@
/// Test oln::value::a_*.
#include <iostream>
-#include <oln/color/rgb.hh>
+#include <oln/value/color/rgb.hh>
#include <oln/basics2d.hh>
#include <oln/value/accessor.hh>
@@ -39,7 +39,7 @@
{
using namespace oln;
- typedef color::rgb_<int> rgb_t;
+ typedef value::color::rgb_<int> rgb_t;
rgb_t c;
image2d<rgb_t> ima(3,3);
Index: oln/core/automatic/image/mutable_image1d.hh
--- oln/core/automatic/image/mutable_image1d.hh (revision 687)
+++ oln/core/automatic/image/mutable_image1d.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_IMAGE1D_HH
-# define OLN_CORE_AUTOMATIC_IMAGE_IMAGE1D_HH
+#ifndef OLN_CORE_AUTOMATIC_IMAGE_MUTABLE_IMAGE1D_HH
+# define OLN_CORE_AUTOMATIC_IMAGE_MUTABLE_IMAGE1D_HH
# include <oln/core/automatic/impl.hh>
# include <oln/morpher/tags.hh>
@@ -38,7 +38,7 @@
// Forward declaration.
namespace abstract
{
- template <typename E> class image1d;
+ template <typename E> class mutable_image1d;
} // end of namespace oln::abstract
@@ -50,7 +50,7 @@
/// Default implementation corresponding to the interface
/// oln::abstract::image1d.
template <typename E, typename tag>
- class set_impl<abstract::image1d, tag, E> :
+ class set_impl<abstract::mutable_image1d, tag, E> :
public virtual stc::any__simple<E>
{
public:
@@ -66,7 +66,7 @@
template <typename E, typename tag>
oln_lvalue(E)
- set_impl<abstract::image1d, tag, E>
+ set_impl<abstract::mutable_image1d, tag, E>
::impl_at(const oln_coord(E)& index)
{
point1d tmp(index);
@@ -79,4 +79,4 @@
} // end of namespace oln
-#endif // ! OLN_CORE_AUTOMATIC_IMAGE_IMAGE1D_HH
+#endif // ! OLN_CORE_AUTOMATIC_IMAGE_MUTABLE_IMAGE1D_HH
Index: oln/core/type_fun/slice.hh
--- oln/core/type_fun/slice.hh (revision 687)
+++ oln/core/type_fun/slice.hh (working copy)
@@ -30,13 +30,8 @@
# include <mlc/flags.hh>
-# include <oln/core/1d/point1d.hh>
# include <oln/core/1d/topo1d.hh>
-
-# include <oln/core/2d/point2d.hh>
# include <oln/core/2d/topo2d.hh>
-
-# include <oln/core/3d/point3d.hh>
# include <oln/core/3d/topo3d.hh>
Index: oln/core/abstract/image/dimension/1d.hh
--- oln/core/abstract/image/dimension/1d.hh (revision 687)
+++ oln/core/abstract/image/dimension/1d.hh (working copy)
@@ -65,8 +65,13 @@
public automatic::get_impl<mutable_image1d, E>
{
public:
+ // Resolve an ambiguity w.r.t. impl_at().
+ // FIXME: Too hacky!
+ using automatic::set_impl<abstract::image1d, oln_type_of(E, morpher), E>::impl_at;
+ using automatic::set_impl<abstract::mutable_image1d, oln_type_of(E, morpher), E>::impl_at;
using image1d<E>::at;
+
oln_lvalue(E) at(const oln_coord(E)& index);
protected:
Index: oln/core/abstract/image/dimension/2d.hh
--- oln/core/abstract/image/dimension/2d.hh (revision 687)
+++ oln/core/abstract/image/dimension/2d.hh (working copy)
@@ -65,8 +65,13 @@
public automatic::get_impl<mutable_image2d, E>
{
public:
+ // Resolve an ambiguity w.r.t. impl_at().
+ // FIXME: Too hacky!
+ using automatic::set_impl<abstract::image2d, oln_type_of(E, morpher), E>::impl_at;
+ using automatic::set_impl<abstract::mutable_image2d, oln_type_of(E, morpher), E>::impl_at;
using image2d<E>::at;
+
oln_lvalue(E) at(const oln_coord(E)& row, const oln_coord(E)& col);
protected:
Index: oln/core/abstract/image/dimension/3d.hh
--- oln/core/abstract/image/dimension/3d.hh (revision 687)
+++ oln/core/abstract/image/dimension/3d.hh (working copy)
@@ -70,8 +70,13 @@
public automatic::get_impl<mutable_image3d, E>
{
public:
+ // Resolve an ambiguity w.r.t. impl_at().
+ // FIXME: Too hacky!
+ using automatic::set_impl<abstract::image3d, oln_type_of(E, morpher), E>::impl_at;
+ using automatic::set_impl<abstract::mutable_image3d, oln_type_of(E, morpher), E>::impl_at;
using image3d<E>::at;
+
oln_lvalue(E) at(const oln_coord(E)& slice,
const oln_coord(E)& row,
const oln_coord(E)& col);
Index: oln/core/abstract/functions.hh
--- oln/core/abstract/functions.hh (revision 687)
+++ oln/core/abstract/functions.hh (working copy)
@@ -31,6 +31,7 @@
# include <stc/any.hh>
# include <oln/core/type.hh>
# include <oln/core/abstract/image.hh>
+# include <oln/core/abstract/image/mutability/hierarchy.hh>
namespace oln
Index: oln/core/abstract/array.hh
--- oln/core/abstract/array.hh (revision 687)
+++ oln/core/abstract/array.hh (working copy)
@@ -28,6 +28,7 @@
#ifndef OLN_CORE_ABSTRACT_ARRAY_HH
# define OLN_CORE_ABSTRACT_ARRAY_HH
+# include <oln/core/type.hh>
# include <oln/debug/track.hh>
Index: oln/core/gen/topo_lbbox.hh
--- oln/core/gen/topo_lbbox.hh (revision 687)
+++ oln/core/gen/topo_lbbox.hh (working copy)
@@ -31,12 +31,9 @@
# include <oln/core/gen/bbox.hh>
# include <oln/core/topology_entry.hh>
-
-
namespace oln
{
-
// Forward declarations.
template <typename point> class topo_lbbox_;
Index: oln/core/internal/point_nd.hh
--- oln/core/internal/point_nd.hh (revision 687)
+++ oln/core/internal/point_nd.hh (working copy)
@@ -31,7 +31,11 @@
# include <xtd/vec.hh>
# include <xtd/optraits.hh>
+// FIXME: There should be a header grouping the files required to make
+// the extensible traits mechanism work.
# include <oln/core/traits_id.hh>
+# include <oln/value/proxy.hh>
+# include <oln/core/traits.hh>
# include <oln/core/abstract/point.hh>
# include <oln/core/internal/dpoint_nd.hh>
Index: oln/Makefile.am
--- oln/Makefile.am (revision 687)
+++ oln/Makefile.am (working copy)
@@ -37,6 +37,8 @@
\
core/abstract/image/bbox/hierarchy.hh \
\
+ core/abstract/image/computability/hierarchy.hh \
+ \
core/abstract/image/dimension/1d.hh \
core/abstract/image/dimension/2d.hh \
core/abstract/image/dimension/3d.hh \
@@ -56,6 +58,8 @@
core/abstract/image/type/integre.hh \
core/abstract/image/type/label.hh \
\
+ core/abstract/image/value_wise_accessibility/hierarchy.hh \
+ \
core/abstract/image/all.hh \
core/abstract/image/hierarchies.hh \
\
@@ -104,12 +108,15 @@
core/automatic/image/image_being_random_accessible.hh \
core/automatic/image/image_having_neighborhood.hh \
core/automatic/image/image_having_neighborhood.hh \
- core/automatic/impl.hh \
+ core/automatic/image/image_being_value_wise_random_accessible.hh \
+ \
core/automatic/topology/topology_being_random_accessible.hh \
core/automatic/topology/topology_having_bbox.hh \
core/automatic/topology/topology_having_neighborhood.hh \
core/automatic/topology/topology_having_subset.hh \
\
+ core/automatic/impl.hh \
+ \
core/gen/bbox.hh \
core/gen/bbox_bkd_piter.hh \
core/gen/bbox_fwd_piter.hh \
@@ -120,11 +127,13 @@
core/gen/fwd_niter_neighb.hh \
core/gen/fwd_piter_bbox.hh \
core/gen/fwd_qiter_win.hh \
+ core/gen/fwd_viter_lut.hh \
core/gen/piter_isubset.hh \
core/gen/grid.hh \
core/gen/mapimage.hh \
core/gen/neighb.hh \
core/gen/pw_value.hh \
+ core/gen/topo_add_isubset.hh \
core/gen/topo_add_nbh.hh \
core/gen/topo_bbox.hh \
core/gen/topo_lbbox.hh \
@@ -141,6 +150,7 @@
core/internal/bbox_bkd_piter.hh \
core/internal/bbox_fwd_piter.hh \
core/internal/dpoint_nd.hh \
+ core/internal/fwd_viter_lut.hh \
core/internal/point_nd.hh \
core/internal/topology_morpher.hh \
core/internal/tracked_ptr.hh \
@@ -191,11 +201,13 @@
\
value/accessor.hh \
value/all.hh \
+ value/bin.hh \
value/default.hh \
value/greylevel.hh \
value/proxy.hh \
value/rw_counter.hh \
value/tags.hh \
+ value/two_way.hh \
\
basics1d.hh \
basics2d.hh \
Index: oln/morpher/thru_mfun.hh
--- oln/morpher/thru_mfun.hh (revision 687)
+++ oln/morpher/thru_mfun.hh (working copy)
@@ -30,6 +30,7 @@
# include <xtd/res.hh>
# include <xtd/abstract/open_nary_fun.hh>
+# include <xtd/abstract/mutable_fun.hh>
# include <xtd/mexpr.hh>
# include <oln/morpher/internal/image_value_morpher.hh>
Index: oln/morpher/thru_fun.hh
--- oln/morpher/thru_fun.hh (revision 687)
+++ oln/morpher/thru_fun.hh (working copy)
@@ -28,12 +28,13 @@
#ifndef OLN_MORPHER_THRU_FUN
# define OLN_MORPHER_THRU_FUN
-# include <xtd/abstract/open_nary_fun.hh>
# include <xtd/res.hh>
+// For xtd::case_<xtd::tag::fun_operator_1, mlc::pair_<F, Expr>, 1>
+# include <xtd/mexpr.hh>
+# include <xtd/abstract/open_nary_fun.hh>
# include <oln/morpher/internal/image_value_morpher.hh>
-
namespace oln
{
@@ -135,7 +136,7 @@
// where A is an oln::abstract::image<I>
template <typename Fun, typename A>
- struct case_ < tag::fun_operator_1, mlc::pair_<Fun, A>, 1 >
+ struct case_ < tag::fun_operator_1, mlc::pair_<Fun, A>, 2 >
: where_< mlc_is_a(A, oln::abstract::image) >
{
typedef stc_to_exact(A) I;
Index: oln/value/proxy.hh
--- oln/value/proxy.hh (revision 687)
+++ oln/value/proxy.hh (working copy)
@@ -25,10 +25,11 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef OLN_CORE_VALUE_PROXY_HH
-# define OLN_CORE_VALUE_PROXY_HH
+#ifndef OLN_VALUE_PROXY_HH
+# define OLN_VALUE_PROXY_HH
# include <xtd/optraits.hh>
+# include <oln/core/typedefs.hh>
# include <oln/core/type.hh>
# include <oln/core/traits_id.hh>
@@ -469,4 +470,4 @@
} // end of namespace oln
-#endif // ! OLN_CORE_VALUE_PROXY_HH
+#endif // ! OLN_VALUE_PROXY_HH
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/metalic
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Fix the distribution.
* mlc/basic.hh: Fix dates in copyright notice.
* mlc/Makefile.am (nobase_mlc_HEADERS): Add basic.hh.
Makefile.am | 1 +
basic.hh | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
Index: mlc/basic.hh
--- mlc/basic.hh (revision 686)
+++ mlc/basic.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 EPITA Research and Development Laboratory
+// 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
Index: mlc/Makefile.am
--- mlc/Makefile.am (revision 686)
+++ mlc/Makefile.am (working copy)
@@ -5,6 +5,7 @@
nobase_mlc_HEADERS = \
abort.hh \
assert.hh \
+ basic.hh \
bexpr.hh \
bool.hh \
case.hh \
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/extended
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Fix the distribution.
* xtd/Makefile.am (nobase_xtd_HEADERS): Add math/ops.hh.
Makefile.am | 1 +
1 file changed, 1 insertion(+)
Index: xtd/Makefile.am
--- xtd/Makefile.am (revision 685)
+++ xtd/Makefile.am (working copy)
@@ -38,6 +38,7 @@
math/log.hh \
math/log10.hh \
math/logic.hh \
+ math/ops.hh \
math/pow.hh \
math/sin.hh \
math/sinh.hh \
1
0
26 Oct '06
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Extend morpher adding a look-up table (oln::morpher::with_lut).
* oln/core/abstract/image/hierarchies.hh
(image_hierarchy_wrt_value_wise_accessibility): New hierarchy.
(image_hybrid_hierarchy_wrt_classical)
(image_hierarchy_wrt_value, image_hierarchy_wrt_data_retrieval):
Adjust numbers.
* oln/core/abstract/image/all.hh
(oln/core/abstract/image/value_wise_accessibility/hierarchy.hh):
Include it.
Adjust.
* oln/core/abstract/image/value_wise_accessibility/hierarchy.hh: New.
* oln/core/automatic/image/image_being_value_wise_random_accessible.hh:
New.
* oln/core/internal/fwd_viter_lut.hh,
* oln/core/gen/fwd_viter_lut.hh: New.
* oln/core/typedefs.hh (fwd_viter_type, mutable_fwd_viter_type)
(lut_type, lut_iter_type): New virtual types declarations.
* oln/core/lookup_table.hh (lookup_table): Rename the first two
parameters to Orig_Value and New_Value.
Add two parameters Orig_Value_Compare and New_Value_Compare,
defaulting to std::less<Orig_Value> and std::less<New_Value>
respectively.
(lookup_table::key_type, lookup_table::data_type): Rename typedefs
as...
(lookup_table::orig_value_type, lookup_table::new_value_type):
...these.
(lookup_table::map_type): Remove typedef.
(lookup_table::orig_value_type, lookup_table::new_value_type)
(lookup_table::const_iterator, lookup_table::iterator): New
typedefs.
Adjust signatures of methods.
(lookup_table::map): Remove method.
(lookup_table::begin, lookup_table::end, lookup_table::find)
(lookup_table::orig_to_new_map, lookup_table::new_to_orig_map):
New methods.
(lookup_table::map_): Remove attributes.
(lookup_table::orig_to_new_map_, lookup_table::new_to_orig_map_):
New attributes.
(lookup_table::add): Adjust method.
* oln/morpher/with_lut.hh: Adjust.
(single_vtype<morpher::with_lut<Image, Lut>, typedef_::fwd_viter_type>)
(single_vtype<morpher::with_lut<Image ,Lut>,
typedef_::mutable_fwd_viter_type>):
New.
(with_lut::lut_t, with_lut::value_t, with_lut::rvalue_t)
(with_lut::psite_t): Rename typedefs as...
(with_lut::lut_type, with_lut::value_type, with_lut::rvalue_type)
(with_lut::psite_type): ...these.
Adjust.
(with_lut::fwd_viter_type, with_lut::mutable_fwd_viter_type):
New typedefs.
(with_lut::impl_value): New methods.
(operator+ (const abstract::image<I>&, const lookup_table<K, D>&)):
Turn into...
(operator+ (const abstract::image<I>&, lookup_table<K, D>&)):
...this.
Adjust.
* tests/morphers/with_lut.cc: Augment this test.
* oln/value/color/rgb.hh
(rgb_<T>::operator==(const rgb_<U>&)): New operator.
* TODO: New.
TODO | 23
oln/core/abstract/image/all.hh | 6
oln/core/abstract/image/hierarchies.hh | 7
oln/core/abstract/image/value_wise_accessibility/hierarchy.hh | 154 +++++
oln/core/automatic/image/image_being_value_wise_random_accessible.hh | 104 +++
oln/core/gen/fwd_viter_lut.hh | 302 ++++++++++
oln/core/internal/fwd_viter_lut.hh | 171 +++++
oln/core/iterator_vtypes.hh | 2
oln/core/lookup_table.hh | 185 ++++--
oln/core/typedefs.hh | 15
oln/morpher/slice.hh | 5
oln/morpher/with_lut.hh | 101 ++-
oln/value/color/rgb.hh | 14
tests/morphers/with_lut.cc | 106 ++-
14 files changed, 1093 insertions(+), 102 deletions(-)
Index: tests/morphers/with_lut.cc
--- tests/morphers/with_lut.cc (revision 684)
+++ tests/morphers/with_lut.cc (working copy)
@@ -34,17 +34,65 @@
#include <oln/debug/print.hh>
-// FIXME: Remove.
-using namespace oln;
-
+// A simple (fake) routine.
template <typename I>
void image_test(const oln::abstract::image<I>&)
{
// Do nothing.
}
+
+/*--------------------------------------------------------------.
+| Equipment of the new value type of the look-up table (rgb8). |
+`--------------------------------------------------------------*/
+
oln::value::color::rgb8 white(255, 255, 255);
oln::value::color::rgb8 blue ( 0, 0, 255);
+oln::value::color::rgb8 red (255, 0, 0);
+
+// We don't want to equip rgb8 with an operator<, nor to specialize
+// std::less, so we pass the functor rgb8_less_t as fourth parameter
+// of the look-up table.
+xtd::lexi_less_t lexi_less;
+struct rgb8_less_t
+{
+ bool operator()(const oln::value::color::rgb8& lhs,
+ const oln::value::color::rgb8& rhs) const
+ {
+ return lexi_less(lhs.to_vec(), rhs.to_vec());
+ }
+};
+
+// FIXME: Move this elsewhere?
+namespace oln
+{
+ std::ostream&
+ operator<< (std::ostream& ostr, value::color::rgb8 val)
+ {
+ // The static_cast are needed because components of rgb8 are
+ // unsigned chars, printed as a classic chars.
+ ostr << "("
+ << static_cast<int>(val.red()) << ", "
+ << static_cast<int>(val.green()) << ", "
+ << static_cast<int>(val.blue())
+ << ")";
+ return ostr;
+ }
+
+} // end of namespace oln
+
+
+/*---------------------.
+| Look-up table type. |
+`---------------------*/
+
+typedef oln::lookup_table< unsigned, oln::value::color::rgb8,
+ std::less<unsigned>, rgb8_less_t > lut_t;
+
+
+/*-------.
+| Test. |
+`-------*/
int main()
{
@@ -52,45 +100,53 @@
unsigned data[] = { 0, 1, 2, 0, 1, 2, 0, 1, 2};
- typedef image2d<unsigned> image_t;
+ typedef oln::image2d<unsigned> image_t;
image_t ima(3, 3);
- level::fill(ima, data);
- debug::print(ima);
+ oln::level::fill(ima, data);
+ oln::debug::print(ima);
- typedef lookup_table<unsigned, rgb8> lut_t;
lut_t lut;
rgb8 c(16, 6, 4);
lut.
add(0, blue).
add(1, white).
add(2, c);
- std::cout << lut << std::endl;
- typedef morpher::with_lut<image_t, lut_t> lutimage_t;
- lutimage_t ima2 = ima + lut;
+ typedef oln::morpher::with_lut<image_t, lut_t> image_with_lut_t;
+ // FIXME: ``ima + lut'' doesn't work. Maybe a `using' statement is
+ // required.
+ image_with_lut_t ima_with_lut(ima, lut);
+
+#if 0
+ // Disable the display to speed up the test.
+ std::cout << "lut = " << std::endl << ima_with_lut.lut() << std::endl;
+ oln::debug::print(ima_with_lut);
+ std::cout << std::endl;
+#endif
- // ima2 is an image, and can be as argument to to image routines.
- image_test(ima2);
+ image_test(ima_with_lut);
- // FIXME: To be enabled later.
#if 0
- // it is value-wise accessible:
- ima2.value(c) = red;
+ std::cout << ima_with_lut.value(c) << std::endl;
#endif
- // let's look at it
- debug::print(ima2);
+ // Change a value in the LUT.
+ ima_with_lut.value(c) = red;
+
+#if 0
+ // Disable the display to speed up the test.
+ std::cout << "lut = " << std::endl << ima_with_lut.lut() << std::endl;
+ oln::debug::print(ima_with_lut);
std::cout << std::endl;
+#endif
- // it is a 2D image so we have:
- point2d p(1, 1);
- std::cout << "ima2(p) =" << ima2(p) << std::endl;
- // or (likewise):
- std::cout << "ima2.at(1, 1) =" << ima2.at(1, 1) << std::endl;
+ oln::point2d p(1, 2);
+ assert(ima_with_lut(p) == red);
+ assert(ima_with_lut.at(1, 2) == red);
- // FIXME: To be enabled later.
+ // FIXME: To be enabled later, when oln::level::fill is specialized
+ // for abstract::mutable_image_being_value_wise_random_accessible.
#if 0
- // FIXME...
- level::apply(ima2, fun); // 3 ops only !!!
+ oln::level::apply(ima_with_lut, fun); // 3 ops only !!!
#endif
}
Index: TODO
--- TODO (revision 0)
+++ TODO (revision 0)
@@ -0,0 +1,23 @@
+* Renaming
+
+** point_accessibility
+
+Rename oln/core/abstract/image/accessibility
+into oln/core/abstract/image/point_wise_accessibility;
+rename structures as well, and adjust clients.
+
+** lvalue vs wvalue
+
+Rename lvalue (``left value'') as wvalue (``writable value'')?
+(Recall that rvalue can stand for either ``right-value'' or ``readable
+value'', even if the latter makes more sense).
+
+Or even, rename rvalue and lvalue as ro_value (read-only) and rw_value
+(read-write).
+
+
+
+Local Variables:
+mode: outline
+ispell-local-dictionary: "american"
+End:
Index: oln/core/typedefs.hh
--- oln/core/typedefs.hh (revision 684)
+++ oln/core/typedefs.hh (working copy)
@@ -90,6 +90,7 @@
// mlc_decl_typedef(iter_type);
// mlc_decl_typedef(fwd_iter_type);
// mlc_decl_typedef(bkd_iter_type);
+// --------------------------------------------------------------------
mlc_decl_typedef(piter_type);
mlc_decl_typedef(fwd_piter_type);
@@ -102,7 +103,11 @@
mlc_decl_typedef(niter_type);
mlc_decl_typedef(fwd_niter_type);
mlc_decl_typedef(bkd_niter_type);
-// --------------------------------------------------------------------
+
+ mlc_decl_typedef(fwd_viter_type);
+ mlc_decl_typedef(mutable_fwd_viter_type);
+ // FIXME: bkd_viter_type.
+ // FIXME: mutable_bkd_viter_type.
/*----------------------.
@@ -189,6 +194,14 @@
mlc_decl_typedef(vec_type);
+ /*-------------------------.
+ | category::lookup_table. |
+ `-------------------------*/
+
+ mlc_decl_typedef(lut_type);
+ mlc_decl_typedef(lut_iter_type);
+
+
/*------------------------------------.
| category::fun1 and category::fun2. |
`------------------------------------*/
Index: oln/core/automatic/image/image_being_value_wise_random_accessible.hh
--- oln/core/automatic/image/image_being_value_wise_random_accessible.hh (revision 0)
+++ oln/core/automatic/image/image_being_value_wise_random_accessible.hh (revision 0)
@@ -0,0 +1,104 @@
+// 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_VALUE_WISE_RANDOM_ACCESSIBLE_HH
+# define OLN_CORE_AUTOMATIC_IMAGE_IMAGE_BEING_VALUE_WISE_RANDOM_ACCESSIBLE_HH
+
+# include <oln/core/automatic/impl.hh>
+# include <oln/morpher/tags.hh>
+
+
+namespace oln
+{
+
+ // Forward declaration.
+ namespace abstract
+ {
+ template <typename E> class image_being_value_wise_random_accessible;
+ template <typename E> class mutable_image_being_value_wise_random_accessible;
+
+ } // end of namespace oln::abstract
+
+
+ namespace automatic
+ {
+
+ /// Default implementation corresponding to the interface
+ /// oln::abstract::image_being_value_wise_random_accessible.
+ template <typename E, typename M>
+ class set_impl<abstract::image_being_value_wise_random_accessible, M, E> :
+ public virtual stc::any__simple<E>
+ {
+ public:
+ typedef oln_type_of(E, value) value_type;
+ typedef oln_type_of(E, fwd_viter) fwd_viter_type;
+
+ public:
+ fwd_viter_type impl_value(const value_type& v) const;
+ };
+
+
+ /// Default implementation corresponding to the interface
+ /// oln::abstract::mutable_image_being_value_wise_random_accessible.
+ template <typename E, typename M>
+ class set_impl<abstract::mutable_image_being_value_wise_random_accessible,
+ M, E> :
+ public virtual stc::any__simple<E>
+ {
+ public:
+ typedef oln_type_of(E, value) value_type;
+ typedef oln_type_of(E, fwd_viter) fwd_viter_type;
+
+ public:
+ fwd_viter_type impl_value(const value_type& v);
+ };
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename E, typename M>
+ typename set_impl<abstract::image_being_value_wise_random_accessible, M, E>::fwd_viter_type
+ set_impl<abstract::image_being_value_wise_random_accessible, M, E>::impl_value(const typename set_impl<abstract::image_being_value_wise_random_accessible, M, E>::value_type& v) const
+ {
+ return this->exact().delegate().value(v);
+ }
+
+ template <typename E, typename M>
+ typename set_impl<abstract::mutable_image_being_value_wise_random_accessible, M, E>::fwd_viter_type
+ set_impl<abstract::mutable_image_being_value_wise_random_accessible, M, E>::impl_value(const typename set_impl<abstract::mutable_image_being_value_wise_random_accessible, M, E>::value_type& v)
+ {
+ return this->exact().delegate().value(v);
+ }
+
+# endif
+
+ } // end of namespace oln::automatic
+
+} // end of namespace oln
+
+#endif // ! OLN_CORE_AUTOMATIC_IMAGE_IMAGE_BEING_VALUE_WISE_RANDOM_ACCESSIBLE_HH
Index: oln/core/iterator_vtypes.hh
--- oln/core/iterator_vtypes.hh (revision 684)
+++ oln/core/iterator_vtypes.hh (working copy)
@@ -33,7 +33,6 @@
# include <oln/core/1d/aliases.hh>
# include <oln/core/2d/aliases.hh>
# include <oln/core/3d/aliases.hh>
-// # include <oln/core/type_fun/slice.hh>
namespace oln
@@ -272,7 +271,6 @@
};
-
} // end of namespace oln
Index: oln/core/abstract/image/hierarchies.hh
--- oln/core/abstract/image/hierarchies.hh (revision 684)
+++ oln/core/abstract/image/hierarchies.hh (working copy)
@@ -41,13 +41,14 @@
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, 8> image_hierarchy_wrt_value_wise_accessibility;
- typedef hierarchy<abstract::image, 8> image_hybrid_hierarchy_wrt_classical;
+ typedef hierarchy<abstract::image, 9> image_hybrid_hierarchy_wrt_classical;
// FIXME: To be continued.
#if 0
- typedef hierarchy<abstract::image, 9> image_hierarchy_wrt_value;
- typedef hierarchy<abstract::image, 10> image_hierarchy_wrt_data_retrieval;
+ typedef hierarchy<abstract::image, 10> image_hierarchy_wrt_value;
+ typedef hierarchy<abstract::image, 11> image_hierarchy_wrt_data_retrieval;
// ...
#endif
Index: oln/core/abstract/image/all.hh
--- oln/core/abstract/image/all.hh (revision 684)
+++ oln/core/abstract/image/all.hh (working copy)
@@ -40,14 +40,16 @@
# include <oln/core/abstract/image/neighborhood/hierarchy.hh>
// Hierarchy 4: image w.r.t. bounding box.
# include <oln/core/abstract/image/bbox/hierarchy.hh>
-// Hierarchy 5: image w.r.t. accessibility.
+// Hierarchy 5: image w.r.t. point accessibility.
# include <oln/core/abstract/image/accessibility/hierarchy.hh>
// Hierarchy 6: image w.r.t. data mutability.
# include <oln/core/abstract/image/mutability/hierarchy.hh>
// Hierarchy 7: image w.r.t. computability.
# include <oln/core/abstract/image/computability/hierarchy.hh>
+// Hierarchy 8: image w.r.t. value-wise accessibility.
+# include <oln/core/abstract/image/value_wise_accessibility/hierarchy.hh>
-// Hybrid hierarchy 8: image w.r.t. classical features.
+// (Hybrid) hierarchy 9: image w.r.t. classical features.
# include <oln/core/abstract/image/hybrid/classical.hh>
#endif // ! OLN_CORE_ABSTRACT_IMAGE_ALL_HH
Index: oln/core/abstract/image/value_wise_accessibility/hierarchy.hh
--- oln/core/abstract/image/value_wise_accessibility/hierarchy.hh (revision 0)
+++ oln/core/abstract/image/value_wise_accessibility/hierarchy.hh (revision 0)
@@ -0,0 +1,154 @@
+// 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_VALUE_WISE_ACCESSIBILITY_HIERARCHY_HH
+# define OLN_CORE_ABSTRACT_IMAGE_VALUE_WISE_ACCESSIBILITY_HIERARCHY_HH
+
+# include <mlc/logic.hh>
+# include <mlc/cmp.hh>
+
+# include <oln/core/abstract/image.hh>
+# include <oln/core/abstract/image/hierarchies.hh>
+# include <oln/core/automatic/image/image_being_value_wise_random_accessible.hh>
+
+
+namespace oln
+{
+
+ /*----------------------------------------.
+ | Value-wise accessibility abstractions. |
+ `----------------------------------------*/
+
+ namespace abstract
+ {
+
+ /// Image having a value-wise random accessibility.
+ template <typename E>
+ struct image_being_value_wise_random_accessible :
+ public virtual image<E>,
+ public automatic::get_impl< image_being_value_wise_random_accessible, E >
+ {
+ typedef oln_type_of(E, value) value_t;
+ typedef oln_type_of(E, fwd_viter) fwd_viter_t;
+
+
+ public:
+ // Value descriptor (read-only access).
+ fwd_viter_t value(const value_t& v) const;
+
+ protected:
+ /// Constructor (protected, empty).
+ image_being_value_wise_random_accessible();
+ };
+
+ /// Mutable image having a value-wise random accessibility.
+ template <typename E>
+ struct mutable_image_being_value_wise_random_accessible :
+ public virtual image_being_value_wise_random_accessible<E>,
+ public automatic::get_impl< mutable_image_being_value_wise_random_accessible, E >
+ {
+ typedef oln_type_of(E, value) value_t;
+ typedef oln_type_of(E, mutable_fwd_viter) mutable_fwd_viter_t;
+
+ public:
+ using image_being_value_wise_random_accessible<E>::value;
+ // Value descriptor (read-write access).
+ mutable_fwd_viter_t value(const value_t& v);
+
+ protected:
+ /// Constructor (protected, empty).
+ mutable_image_being_value_wise_random_accessible();
+ };
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ // image_being_value_wise_random_accessible.
+
+ template <typename E>
+ typename image_being_value_wise_random_accessible<E>::fwd_viter_t
+ image_being_value_wise_random_accessible<E>::value(const typename image_being_value_wise_random_accessible<E>::value_t& v) const
+ {
+ return this->exact().impl_value(v);
+ }
+
+ template <typename E>
+ image_being_value_wise_random_accessible<E>::image_being_value_wise_random_accessible()
+ {
+ }
+
+
+ // mutable_image_being_value_wise_random_accessible.
+
+ template <typename E>
+ typename mutable_image_being_value_wise_random_accessible<E>::mutable_fwd_viter_t
+ mutable_image_being_value_wise_random_accessible<E>::value(const typename mutable_image_being_value_wise_random_accessible<E>::value_t& v)
+ {
+ return this->exact().impl_value(v);
+ }
+
+ template <typename E>
+ mutable_image_being_value_wise_random_accessible<E>::mutable_image_being_value_wise_random_accessible()
+ {
+ }
+
+# endif
+
+ } // end of namespace oln::abstract
+
+
+ /*-------------------.
+ | Dimension 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 (
+ template <typename E>
+ struct case_< image_hierarchy_wrt_value_wise_accessibility, E, 1 > :
+ where_< mlc_is_ok(oln_type_of(E, fwd_viter)) >
+ {
+ 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;
+// };
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_ABSTRACT_IMAGE_VALUE_WISE_ACCESSIBILITY_HIERARCHY_HH
Index: oln/core/gen/fwd_viter_lut.hh
--- oln/core/gen/fwd_viter_lut.hh (revision 0)
+++ oln/core/gen/fwd_viter_lut.hh (revision 0)
@@ -0,0 +1,302 @@
+// 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_GEN_FWD_VITER_LUT_HH
+# define OLN_CORE_GEN_FWD_VITER_LUT_HH
+
+# include <oln/core/internal/fwd_viter_lut.hh>
+# include <oln/core/lookup_table.hh>
+
+namespace oln
+{
+
+ /*------------.
+ | fwd_viter. |
+ `------------*/
+
+ // Forward declaration.
+ template <typename Lut> class fwd_viter_lut;
+
+
+ /// Super type declaration.
+ template <typename Lut>
+ struct set_super_type< fwd_viter_lut<Lut> >
+ {
+ typedef fwd_viter_lut<Lut> self_t;
+ typedef internal::fwd_viter_lut<self_t> ret;
+ };
+
+
+ /// Virtual types associated to oln::fwd_viter_lut<Lut>.
+ template <typename Lut>
+ struct vtypes< fwd_viter_lut<Lut> >
+ {
+ // The look-up table is immutable.
+ typedef const Lut lut_type;
+ typedef typename Lut::const_iterator lut_iter_type;
+ typedef typename Lut::new_value_type rvalue_type;
+ };
+
+
+ /// Const forward value iterator on look-up table.
+ template <typename Lut>
+ class fwd_viter_lut :
+ public stc_get_supers(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;
+
+ public:
+ typedef oln_type_of(self_t, lut) lut_t;
+ typedef oln_type_of(self_t, rvalue) rvalue_type;
+
+ public:
+ // Construct an uninitialized value iterator.
+ fwd_viter_lut(const Lut& lut);
+ // Construct an iterator pointing to value \a val.
+ fwd_viter_lut(const Lut& lut, const rvalue_type& val);
+
+ // Get the value pointed by this iterator (const version).
+ operator rvalue_type() const;
+
+ void print(std::ostream& ostr) const;
+ };
+
+
+ template <typename Lut>
+ std::ostream& operator<<(std::ostream& ostr,
+ const fwd_viter_lut<Lut>& t);
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename Lut>
+ fwd_viter_lut<Lut>::fwd_viter_lut(const Lut& lut)
+ : super_t(lut)
+ {
+ // Initialize underlying iterator (i.e., \a i_.)
+ this->invalidate();
+ }
+
+ template <typename Lut>
+ fwd_viter_lut<Lut>::fwd_viter_lut(const Lut& lut,
+ const typename fwd_viter_lut<Lut>::rvalue_type& val)
+ : super_t(lut, val)
+ {
+ // The underlying iterator is initialized by the super class.
+ }
+
+ template <typename Lut>
+ fwd_viter_lut<Lut>::operator typename fwd_viter_lut<Lut>::rvalue_type() const
+ {
+ precondition(this->is_valid());
+ return this->i_->second;
+ }
+
+ template <typename Lut>
+ void fwd_viter_lut<Lut>::print(std::ostream& ostr) const
+ {
+ precondition(this->is_valid());
+ ostr << "fwd_viter_lut<Lut> { value = " << this->i_->second << " }";
+ }
+
+
+ template <typename Lut>
+ std::ostream& operator<<(std::ostream& ostr,
+ const fwd_viter_lut<Lut>& t)
+ {
+ t.print(ostr);
+ return ostr;
+ }
+
+# endif
+
+
+
+ /*--------------------.
+ | mutable_fwd_viter. |
+ `--------------------*/
+
+ // Forward declaration.
+ template <typename Lut> class mutable_fwd_viter_lut;
+
+
+ /// Super type declaration.
+ template <typename Lut>
+ struct set_super_type< mutable_fwd_viter_lut<Lut> >
+ {
+ typedef mutable_fwd_viter_lut<Lut> self_t;
+ typedef internal::fwd_viter_lut<self_t> ret;
+ };
+
+
+ /// Virtual types associated to oln::mutable_fwd_viter_lut<Lut>.
+ template <typename Lut>
+ struct vtypes< mutable_fwd_viter_lut<Lut> >
+ {
+ typedef Lut lut_type;
+ typedef typename Lut::iterator lut_iter_type;
+ typedef typename Lut::new_value_type rvalue_type;
+ typedef typename Lut::new_value_type& lvalue_type;
+ };
+
+
+ /// Const forward value iterator on look-up table.
+ template <typename Lut>
+ class mutable_fwd_viter_lut :
+ public stc_get_supers(mutable_fwd_viter_lut<Lut>)
+ // Check that Lut is a look-up table.
+ // FIXME: an abstract::lookup_table would be useful.
+ {
+ typedef mutable_fwd_viter_lut<Lut> self_t;
+ typedef stc_get_super(self_t) super_t;
+ typedef typename Lut::orig_value_type orig_value_t;
+ typedef typename Lut::new_value_type new_value_t;
+
+ public:
+ typedef Lut lut_t;
+ typedef oln_type_of(self_t, rvalue) rvalue_type;
+ typedef oln_type_of(self_t, lvalue) lvalue_type;
+
+ self_t& operator=(const rvalue_type& rhs);
+
+ public:
+ // Construct an uninitialized value iterator.
+ mutable_fwd_viter_lut(Lut& lut);
+ // Construct an iterator pointing to value \a val.
+ mutable_fwd_viter_lut(Lut& lut, const rvalue_type& val);
+
+ // Get the value pointed by this iterator (const version).
+ operator rvalue_type() const;
+ // Get the value pointed by this iterator (mutable version).
+ operator lvalue_type();
+
+ void print(std::ostream& ostr) const;
+ };
+
+
+ template <typename Lut>
+ std::ostream& operator<<(std::ostream& ostr,
+ const mutable_fwd_viter_lut<Lut>& t);
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename Lut>
+ mutable_fwd_viter_lut<Lut>::mutable_fwd_viter_lut(Lut& lut)
+ : super_t(lut)
+ {
+ // Initialize underlying iterator (i.e., \a i_.)
+ this->invalidate();
+ }
+
+ template <typename Lut>
+ mutable_fwd_viter_lut<Lut>::mutable_fwd_viter_lut(Lut& lut,
+ const typename mutable_fwd_viter_lut<Lut>::rvalue_type& val)
+ : super_t(lut, val)
+ {
+ // The underlying iterator is initialized by the super class.
+ }
+
+ template <typename Lut>
+ mutable_fwd_viter_lut<Lut>::operator typename mutable_fwd_viter_lut<Lut>::rvalue_type() const
+ {
+ precondition(this->is_valid());
+ return this->i_->second;
+ }
+
+ template <typename Lut>
+ mutable_fwd_viter_lut<Lut>::operator typename mutable_fwd_viter_lut<Lut>::lvalue_type()
+ {
+ precondition(this->is_valid());
+ return this->i_->second;
+ }
+
+ template <typename Lut>
+ mutable_fwd_viter_lut<Lut>&
+ mutable_fwd_viter_lut<Lut>::operator=(const typename mutable_fwd_viter_lut<Lut>::rvalue_type& rhs)
+ {
+ precondition(this->is_valid());
+
+ // Current ``new'' value.
+ new_value_t cur_new_val = this->i_->first;
+
+ // Shortcuts.
+ typedef typename Lut::iterator new_iter_t;
+ typedef std::pair<new_iter_t, new_iter_t> new_iter_range_t;
+
+ // Current ``original'' value(s) associated to the next ``new'' value RHS.
+ new_iter_range_t cur_orig_val_range =
+ this->lut_.new_to_orig_map().equal_range(cur_new_val);
+ // A temporary map where additional bindings will be stored.
+ typename Lut::new_to_orig_map_type additional_bindings;
+
+ for (new_iter_t j = cur_orig_val_range.first;
+ j != cur_orig_val_range.second; ++j)
+ {
+ // Update the orig-to-new map (substitution).
+ orig_value_t orig_val = j->second;
+ this->lut_.orig_to_new_map()[orig_val] = rhs;
+ // Populate the temp map.
+ additional_bindings.insert(std::make_pair(rhs, orig_val));
+ }
+ // Update the new-to-orig map (deletion).
+ this->lut_.new_to_orig_map().erase(cur_orig_val_range.first,
+ cur_orig_val_range.second);
+ // Update the new-to-orig map (insertion).
+ this->lut_.new_to_orig_map().insert(additional_bindings.begin(),
+ additional_bindings.end());
+ return *this;
+ }
+
+ template <typename Lut>
+ void mutable_fwd_viter_lut<Lut>::print(std::ostream& ostr) const
+ {
+ precondition(this->is_valid());
+ ostr
+ << "mutable_fwd_viter_lut<Lut> { value = " << this->i_->second << " }";
+ }
+
+
+ template <typename Lut>
+ std::ostream& operator<<(std::ostream& ostr,
+ const mutable_fwd_viter_lut<Lut>& t)
+ {
+ t.print(ostr);
+ return ostr;
+ }
+
+# endif
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_GEN_FWD_VITER_LUT_HH
Index: oln/core/internal/fwd_viter_lut.hh
--- oln/core/internal/fwd_viter_lut.hh (revision 0)
+++ oln/core/internal/fwd_viter_lut.hh (revision 0)
@@ -0,0 +1,171 @@
+// 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_INTERNAL_FWD_VITER_LUT_HH
+# define OLN_CORE_INTERNAL_FWD_VITER_LUT_HH
+
+# include <oln/core/abstract/iterator.hh>
+
+
+namespace oln
+{
+
+ namespace internal
+ {
+ // Forward declaration.
+ template <typename Exact> class fwd_viter_lut;
+
+ } // end of namespace oln::internal
+
+
+ /// Super type declaration.
+ template <typename Exact>
+ struct set_super_type< internal::fwd_viter_lut<Exact> >
+ {
+ typedef internal::fwd_viter_lut<Exact> self_t;
+ typedef abstract::iterator<self_t> ret;
+ };
+
+
+ namespace internal
+ {
+ /// Forward value iterator on look-up table (abstract
+ /// factorization class).
+ template <typename Exact>
+ class fwd_viter_lut : public stc_get_supers(fwd_viter_lut<Exact>)
+ // Check that oln_type_of(Exact, lut) is a look-up table.
+ // FIXME: an abstract::lookup_table would be useful.
+ {
+ typedef fwd_viter_lut<Exact> self_t;
+ typedef stc_get_super(self_t) super_t;
+ typedef oln_type_of(Exact, lut_iter) lut_iter_t;
+
+ public:
+ typedef oln_type_of(Exact, lut) lut_type;
+ typedef oln_type_of(Exact, rvalue) rvalue_type;
+
+ public:
+ /// Iterator manipulators.
+ /// \{
+ void start();
+ void next();
+ void invalidate();
+ bool is_valid() const;
+ /// \}
+
+ protected:
+ // Construct an uninitialized value iterator.
+ fwd_viter_lut(lut_type& lut);
+ // Construct an iterator pointing to value \a val.
+ fwd_viter_lut(lut_type& lut, const rvalue_type& val);
+
+ protected:
+ /// Look-up table.
+ lut_type& lut_;
+ /// Iterator on \a lut_.
+ lut_iter_t i_;
+ };
+
+
+ template <typename Exact>
+ std::ostream& operator<<(std::ostream& ostr, const fwd_viter_lut<Exact>& t);
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename Exact>
+ fwd_viter_lut<Exact>::fwd_viter_lut(typename fwd_viter_lut<Exact>::lut_type& lut)
+ : super_t(),
+ lut_(lut),
+ i_()
+ {
+ // Initialize underlying iterator (i.e., \a i_.)
+ this->invalidate();
+ }
+
+ template <typename Exact>
+ fwd_viter_lut<Exact>::fwd_viter_lut(typename fwd_viter_lut<Exact>::lut_type& lut,
+ const typename fwd_viter_lut<Exact>::rvalue_type& val)
+ : super_t(),
+ lut_(lut),
+ i_()
+ {
+ // Initialize underlying iterator (i.e., \a i_.)
+ i_ = lut_.find(val);
+ assert(i_ != lut_.end());
+ }
+
+ template <typename Exact>
+ void
+ fwd_viter_lut<Exact>::start()
+ {
+ i_ = lut_.begin();
+ }
+
+ template <typename Exact>
+ void
+ fwd_viter_lut<Exact>::next()
+ {
+ /* Iterate until a different key is reached. In fact,
+ std::multimap might not be the best choice to implement
+ new_to_orig_map_. Maybe a std::map binding orig_val to a
+ std::set of new_val's would is better?. */
+ rvalue_type val = i_->first;
+ do
+ ++i_;
+ while (i_ != lut_.end() and i_->first == val);
+ }
+
+ template <typename Exact>
+ void
+ fwd_viter_lut<Exact>::invalidate()
+ {
+ i_ = lut_.end();
+ }
+
+ template <typename Exact>
+ bool
+ fwd_viter_lut<Exact>::is_valid() const
+ {
+ return (i_ != lut_.end());
+ }
+
+ template <typename Exact>
+ std::ostream& operator<<(std::ostream& ostr, const fwd_viter_lut<Exact>& t)
+ {
+ t.print(ostr);
+ return ostr;
+ }
+
+# endif
+
+ } // end of namespace oln::internal
+
+} // end of namespace oln
+
+#endif // ! OLN_CORE_INTERNAL_FWD_VITER_LUT_HH
Index: oln/core/lookup_table.hh
--- oln/core/lookup_table.hh (revision 684)
+++ oln/core/lookup_table.hh (working copy)
@@ -34,83 +34,196 @@
namespace oln
{
- template <typename Key, typename Data>
+ // FIXME: Document!
+
+ template <typename Orig_Value, typename New_Value,
+ typename Orig_Value_Compare = std::less<Orig_Value>,
+ typename New_Value_Compare = std::less<New_Value> >
class lookup_table
{
- typedef lookup_table<Key, Data> self_t;
+ typedef lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare> self_t;
public:
- typedef Key key_type;
- typedef Data data_type;
- typedef std::map<Key, Data> map_type;
+ typedef Orig_Value orig_value_type;
+ typedef New_Value new_value_type;
+ typedef std::map<Orig_Value, New_Value, Orig_Value_Compare> orig_to_new_map_type;
+ typedef std::multimap<New_Value, Orig_Value, New_Value_Compare> new_to_orig_map_type;
+
+ typedef typename new_to_orig_map_type::const_iterator const_iterator;
+ typedef typename new_to_orig_map_type::iterator iterator;
public:
lookup_table();
- self_t& add (const key_type& k, const data_type& d);
+ self_t& add (const orig_value_type& orig_value, const new_value_type& new_value);
- const data_type operator () (const key_type& key) const;
+ const new_value_type operator() (const orig_value_type& orig_value) const;
- const map_type& map() const;
+ /// (Internal) iterators.
+ /// \{
+ const_iterator begin() const;
+ iterator begin();
+
+ const_iterator end() const;
+ iterator end();
+ /// \}
+
+ const_iterator find(const new_value_type& val) const;
+ iterator find(const new_value_type& val);
+
+ /// Accessors.
+ /// \{
+ const orig_to_new_map_type& orig_to_new_map() const;
+ orig_to_new_map_type& orig_to_new_map();
+ const new_to_orig_map_type& new_to_orig_map() const;
+ new_to_orig_map_type& new_to_orig_map();
+ /// \}
private:
- std::map<Key, Data> map_;
+ orig_to_new_map_type orig_to_new_map_;
+ new_to_orig_map_type new_to_orig_map_;
};
# ifndef OLN_INCLUDE_ONLY
- template <typename Key, typename Data>
- lookup_table<Key, Data>::lookup_table() :
- map_()
+ template <typename Orig_Value, typename New_Value,
+ typename Orig_Value_Compare, typename New_Value_Compare>
+ lookup_table<Orig_Value, New_Value,
+ Orig_Value_Compare, New_Value_Compare>::lookup_table() :
+ orig_to_new_map_()
{
}
- template <typename Key, typename Data>
- lookup_table<Key, Data>&
- lookup_table<Key, Data>::add (const Key& k, const Data& d)
+ template <typename Orig_Value, typename New_Value,
+ typename Orig_Value_Compare, typename New_Value_Compare>
+ lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>&
+ lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::add (const Orig_Value& orig_value,
+ const New_Value& new_value)
{
- map_.insert(std::make_pair(k, d));
+ orig_to_new_map_.insert(std::make_pair(orig_value, new_value));
+ new_to_orig_map_.insert(std::make_pair(new_value, orig_value));
return *this;
}
- template <typename Key, typename Data>
- const Data
- lookup_table<Key, Data>::operator () (const Key& key) const
- {
- typedef typename lookup_table<Key, Data>::map_type map_t;
- typename map_t::const_iterator i = map_.find(key);
- // FIXME: Is this the expected behavior when the LUT has no data
- // for \a key.
- assert(i != map_.end());
+ template <typename Orig_Value, typename New_Value,
+ typename Orig_Value_Compare, typename New_Value_Compare>
+ const New_Value
+ lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::operator () (const Orig_Value& orig_value) const
+ {
+ typedef typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::orig_to_new_map_type orig_to_new_map_t;
+ typename orig_to_new_map_t::const_iterator i = orig_to_new_map_.find(orig_value);
+ // FIXME: Is this the expected behavior when the LUT has no new_value
+ // for \a orig_value?
+ assert(i != orig_to_new_map_.end());
return i->second;
}
- template <typename Key, typename Data>
- const typename lookup_table<Key, Data>::map_type&
- lookup_table<Key, Data>::map() const
+
+ template <typename Orig_Value, typename New_Value,
+ typename Orig_Value_Compare, typename New_Value_Compare>
+ typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::const_iterator
+ lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::begin() const
+ {
+ return new_to_orig_map_.begin();
+ }
+
+ template <typename Orig_Value, typename New_Value,
+ typename Orig_Value_Compare, typename New_Value_Compare>
+ typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::iterator
+ lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::begin()
+ {
+ return new_to_orig_map_.begin();
+ }
+
+ template <typename Orig_Value, typename New_Value,
+ typename Orig_Value_Compare, typename New_Value_Compare>
+ typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::const_iterator
+ lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::end() const
+ {
+ return new_to_orig_map_.end();
+ }
+
+ template <typename Orig_Value, typename New_Value,
+ typename Orig_Value_Compare, typename New_Value_Compare>
+ typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::iterator
+ lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::end()
+ {
+ return new_to_orig_map_.end();
+ }
+
+
+ template <typename Orig_Value, typename New_Value,
+ typename Orig_Value_Compare, typename New_Value_Compare>
+ typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::const_iterator
+ lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::find(const New_Value& val) const
+ {
+ return new_to_orig_map_.find(val);
+ }
+
+ template <typename Orig_Value, typename New_Value,
+ typename Orig_Value_Compare, typename New_Value_Compare>
+ typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::iterator
+ lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::find(const New_Value& val)
+ {
+ return new_to_orig_map_.find(val);
+ }
+
+
+ template <typename Orig_Value, typename New_Value,
+ typename Orig_Value_Compare, typename New_Value_Compare>
+ const typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::orig_to_new_map_type&
+ lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::orig_to_new_map() const
+ {
+ return orig_to_new_map_;
+ }
+
+ template <typename Orig_Value, typename New_Value,
+ typename Orig_Value_Compare, typename New_Value_Compare>
+ typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::orig_to_new_map_type&
+ lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::orig_to_new_map()
+ {
+ return orig_to_new_map_;
+ }
+
+ template <typename Orig_Value, typename New_Value,
+ typename Orig_Value_Compare, typename New_Value_Compare>
+ const typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::new_to_orig_map_type&
+ lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::new_to_orig_map() const
+ {
+ return new_to_orig_map_;
+ }
+
+ template <typename Orig_Value, typename New_Value,
+ typename Orig_Value_Compare, typename New_Value_Compare>
+ typename lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::new_to_orig_map_type&
+ lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>::new_to_orig_map()
{
- return map_;
+ return new_to_orig_map_;
}
# endif
/// Print a look-up table.
- template <typename Key, typename Data>
+ template <typename Orig_Value, typename New_Value,
+ typename Orig_Value_Compare, typename New_Value_Compare>
std::ostream&
- operator<< (std::ostream& ostr, const lookup_table<Key, Data>& lut);
+ operator<< (std::ostream& ostr,
+ const lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>& lut);
# ifndef OLN_INCLUDE_ONLY
- template <typename Key, typename Data>
+ template <typename Orig_Value, typename New_Value,
+ typename Orig_Value_Compare, typename New_Value_Compare>
std::ostream&
- operator<< (std::ostream& ostr, const lookup_table<Key, Data>& lut)
+ operator<< (std::ostream& ostr,
+ const lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare>& lut)
{
- typedef lookup_table<Key, Data> lut_t;
- const typename lut_t::map_type& map = lut.map();
- for (typename lut_t::map_type::const_iterator i = map.begin ();
+ typedef lookup_table<Orig_Value, New_Value, Orig_Value_Compare, New_Value_Compare> lut_t;
+ const typename lut_t::orig_to_new_map_type& map = lut.orig_to_new_map();
+ for (typename lut_t::orig_to_new_map_type::const_iterator i = map.begin ();
i != map.end(); ++i)
ostr << " " << i->first << " -> " << i->second << std::endl;
return ostr;
Index: oln/morpher/slice.hh
--- oln/morpher/slice.hh (revision 684)
+++ oln/morpher/slice.hh (working copy)
@@ -86,6 +86,7 @@
typedef oln_type_of(Image, value) value_type;
// rvalue_type: see below.
+ // lvalue_type: see below.
// fwd_piter_type: see oln/core/iterator_vtypes.hh.
// bkd_piter_type: see oln/core/iterator_vtypes.hh.
@@ -140,9 +141,6 @@
/// \}
-
-
-
// piters.
/// fwd_piter vtype of morpher::slice.
@@ -189,6 +187,7 @@
};
+ // FIXME: What about niters on morpher::slice?
Index: oln/morpher/with_lut.hh
--- oln/morpher/with_lut.hh (revision 684)
+++ oln/morpher/with_lut.hh (working copy)
@@ -30,6 +30,7 @@
# include <oln/morpher/internal/image_value_morpher.hh>
# include <oln/core/lookup_table.hh>
+# include <oln/core/gen/fwd_viter_lut.hh>
namespace oln
@@ -61,58 +62,84 @@
public:
typedef mlc::true_ is_computed_type;
// Value type.
- typedef typename Lut::data_type value_type;
+ typedef typename Lut::new_value_type value_type;
// Look-up table type.
typedef Lut lut_type;
+
+ // rvalue_type: see below.
+ // lvalue_type: undefined (see
+ // oln/morpher/internal/image_value_morpher.hh).
+
+ // fwd_viter_type: see below.
+ // mutable_fwd_viter_type: see below.
+
+ // FIXME: implement bkd_viter_type!
+ // FIXME: implement mutable_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;
};
- // FIXME: What about lvalue type?
+ /// Const forward viter vtype of 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;
+ };
-// // Lvalue.
-// template <typename Image>
-// struct single_vtype< morpher::slice<Image>, typedef_::lvalue_type >
-// {
-// typedef oln_type_of(Image, lvalue) ret;
-// };
+ /// Mutable forward viter vtype of morpher::with_lut.
+ template <typename Image, typename Lut>
+ struct single_vtype< morpher::with_lut<Image, Lut>,
+ typedef_::mutable_fwd_viter_type >
+ {
+ typedef mutable_fwd_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>))
- // FIXME: Ensure oln_value(Image) == Lut::data_type? Or just let
+ // FIXME: Ensure oln_value(Image) == Lut::new_value_type? Or just let
// the ctor check this property?
{
- private:
typedef with_lut<Image, Lut> self_t;
typedef stc_get_super(self_t) super_t;
- typedef Lut lut_t;
- typedef oln_type_of(self_t, value) value_t;
- typedef oln_type_of(self_t, rvalue) rvalue_t;
- typedef oln_type_of(self_t, psite) psite_t;
- // FIXME: Useful typedef?
-// typedef oln_type_of(Image, value) orig_value_t;
+
+ public:
+ typedef Lut lut_type;
+ typedef oln_type_of(self_t, value) value_type;
+ typedef oln_type_of(self_t, rvalue) rvalue_type;
+ typedef oln_type_of(self_t, psite) psite_type;
+ typedef oln_type_of(self_t, fwd_viter) fwd_viter_type;
+ typedef oln_type_of(self_t, mutable_fwd_viter) mutable_fwd_viter_type;
public:
with_lut(const Image& image, const Lut& lut);
- const lut_t& lut() const;
+ const lut_type& lut() const;
- rvalue_t impl_op_read(const psite_t& p) const;
+ rvalue_type impl_op_read(const psite_type& p) const;
- // FIXME: Implement impl_op_write() when there is value proxy?
+ // FIXME: Constness of this method?
+ fwd_viter_type impl_value(const value_type& v) const;
+ mutable_fwd_viter_type impl_value(const value_type& v);
protected:
- lut_t lut_;
+ lut_type lut_;
};
@@ -123,13 +150,12 @@
super_t(image),
lut_(lut)
{
- mlc::assert_equal_< oln_value(Image), typename Lut::key_type >::check();
+ mlc::assert_equal_< oln_value(Image), typename Lut::orig_value_type >::check();
}
template <typename Image, typename Lut>
- typename with_lut<Image, Lut>::rvalue_t
- with_lut<Image, Lut>::
- impl_op_read(const typename with_lut<Image, Lut>::psite_t& p) const
+ typename with_lut<Image, Lut>::rvalue_type
+ with_lut<Image, Lut>::impl_op_read(const typename with_lut<Image, Lut>::psite_type& p) const
{
// FIXME: What if lut_ has no value for `this->image_(p)'? At
// least, document the behavior of this method (will it abort,
@@ -138,7 +164,21 @@
}
template <typename Image, typename Lut>
- const typename with_lut<Image, Lut>::lut_t&
+ typename with_lut<Image, Lut>::fwd_viter_type
+ with_lut<Image, Lut>::impl_value(const value_type& v) const
+ {
+ return fwd_viter_type(lut_, v);
+ }
+
+ template <typename Image, typename Lut>
+ typename with_lut<Image, Lut>::mutable_fwd_viter_type
+ with_lut<Image, Lut>::impl_value(const value_type& v)
+ {
+ return mutable_fwd_viter_type(lut_, v);
+ }
+
+ template <typename Image, typename Lut>
+ const typename with_lut<Image, Lut>::lut_type&
with_lut<Image, Lut>::lut() const
{
return lut_;
@@ -149,11 +189,12 @@
} // end of namespace oln::morpher
+ // FIXME: Provide a version of op+ where the LUT is const?
template <typename I, typename K, typename D>
morpher::with_lut< I, lookup_table<K, D> >
operator + (const abstract::image<I>& image,
- const lookup_table<K, D>& lut);
+ lookup_table<K, D>& lut);
# ifndef OLN_INCLUDE_ONLY
@@ -161,11 +202,11 @@
template <typename I, typename K, typename D>
morpher::with_lut< I, lookup_table<K, D> >
operator + (const abstract::image<I>& image,
- const lookup_table<K, D>& lut)
+ lookup_table<K, D>& lut)
{
- typedef lookup_table<K, D> lut_t;
- mlc::assert_equal_< oln_value(I), typename lut_t::key_type >::check();
- morpher::with_lut<I, lut_t> tmp(image.exact(), lut);
+ typedef lookup_table<K, D> lut_type;
+ mlc::assert_equal_< oln_value(I), typename lut_type::orig_value_type >::check();
+ morpher::with_lut<I, lut_type> tmp(image.exact(), lut);
return tmp;
}
Index: oln/value/color/rgb.hh
--- oln/value/color/rgb.hh (revision 684)
+++ oln/value/color/rgb.hh (working copy)
@@ -63,6 +63,10 @@
template <typename U>
rgb_<T>& operator=(const rgb_<U>& rhs);
+ /// Op==.
+ template <typename U>
+ bool operator==(const rgb_<U>& rhs);
+
T red() const;
T& red();
typedef T red_type;
@@ -124,6 +128,16 @@
}
template <typename T>
+ template <typename U>
+ bool rgb_<T>::operator==(const rgb_<U>& rhs)
+ {
+ return
+ val_[0] == rhs.red() and
+ val_[1] == rhs.green() and
+ val_[2] == rhs.blue();
+ }
+
+ template <typename T>
T rgb_<T>::red() const
{
return val_[0];
1
0
2006-10-25 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Oops.
* oln/value/two_way.hh: New.
Index: oln/value/two_way.hh
===================================================================
--- oln/value/two_way.hh (revision 0)
+++ oln/value/two_way.hh (revision 0)
@@ -0,0 +1,81 @@
+// 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_VALUE_TWO_WAY_HH
+# define OLN_CORE_VALUE_TWO_WAY_HH
+
+# include <iostream>
+# include <oln/value/proxy.hh>
+# include <oln/core/abstract/functions.hh>
+
+
+namespace oln
+{
+
+ namespace value
+ {
+
+ template <typename I, typename F>
+ class two_way : public abstract::proxy< two_way<I,F> >
+ {
+ public:
+
+ typedef oln_value(I) value_type;
+
+ // Ctor.
+ two_way(I& ima,
+ F fun,
+ const oln_psite(I)& p);
+
+ // Read.
+ template <typename V>
+ operator V() const;
+
+ // Explicit read.
+ typename F::result_type value() const;
+
+ // Write.
+ template <typename V>
+ two_way<I,F>& operator=(const V& value);
+
+ protected:
+ I ima_;
+ F fun_;
+ const oln_psite(I)& p_;
+ };
+
+
+ template <typename I, typename F>
+ std::ostream& operator<<(std::ostream& ostr, const two_way<I,F>& proxy);
+
+
+ } // end of namespace oln::value
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_VALUE_TWO_WAY_HH
1
0