https://svn.lrde.epita.fr/svn/oln/trunk/olena
I'm relieved this issue was solvable: it could have been a bad sign for
the creation and use of non-toy morphers -- even if G++ 4.1 and 4.2 seem
to handle this pretty good.
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Restore the compatibility of morphers with G++ 4.0.
* oln/core/macros.hh (oln_direct_type_of, oln_direct_type_of_):
New macros.
* oln/morpher/internal/image_extension.hh (oln): Use
`oln_direct_type_of(Exact, ...)' instead of
`oln_type_of(self_t, ...)'.
* tests/morphers.cc (main): Add more static assertions.
* tests/identity_morpher.cc: More documentation.
* tests/add_neighborhood_morpher.cc: New test.
* tests/Makefile.am (check_PROGRAMS): Add
add_neighborhood_morpher.
(add_neighborhood_morpher_SOURCES): New.
oln/core/macros.hh | 30 +++++++++---
oln/morpher/internal/image_extension.hh | 7 +-
tests/Makefile.am | 12 +++-
tests/add_neighborhood_morpher.cc | 79 ++++++++++++++++++++++++++++++++
tests/identity_morpher.cc | 22 ++++++--
tests/morphers.cc | 19 ++++++-
6 files changed, 147 insertions, 22 deletions
Index: tests/add_neighborhood_morpher.cc
--- tests/add_neighborhood_morpher.cc (revision 0)
+++ tests/add_neighborhood_morpher.cc (revision 0)
@@ -0,0 +1,79 @@
+// 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.
+
+/// Test the identity morpher.
+
+#include <mlc/assert.hh>
+#include <mlc/is_a.hh>
+
+// FIXME: We should not include oln/basics2d.hh, but only
+// oln/core/2d/image2d.hh.
+#include <oln/basics2d.hh>
+#include <oln/morpher/add_neighborhood.hh>
+
+int
+main()
+{
+ /*----------------.
+ | image2d<char>. |
+ `----------------*/
+
+ typedef oln::image2d<char> image_t;
+
+ // Sanity check: interfaces realized by oln::image2d.
+ mlc::assert_< mlc_is_a_(image_t, oln::abstract::image2d) >::check();
+ mlc::assert_< mlc_is_a_(image_t,
+ oln::abstract::grey_level_image) >::check();
+ mlc::assert_< mlc_is_a_(image_t,
+ oln::abstract::not_binary_image) >::check();
+
+ image_t ima(42, 51);
+
+
+ /*------------------------------------.
+ | add_neighborhood< image2d<char> >. |
+ `------------------------------------*/
+
+ typedef oln::morpher::add_neighborhood<image_t> image_with_nbh_t;
+
+ // Check that the instantiated add_neighborhood morpher realizes the
+ // same interfaces as the underlying morphed image.
+ mlc::assert_< mlc_is_a_(image_with_nbh_t, oln::abstract::image2d) >::check();
+ mlc::assert_< mlc_is_a_(image_with_nbh_t,
+ oln::abstract::grey_level_image) >::check();
+ mlc::assert_< mlc_is_a_(image_with_nbh_t,
+ oln::abstract::not_binary_image) >::check();
+ // Check the type of neighborhood.
+ mlc::assert_< mlc_eq(oln_type_of_(image_with_nbh_t, neighborhood),
+ oln::neighb2d) >::check();
+
+ // Instantiate a neighborhood for this image type.
+ oln_type_of_(image_with_nbh_t, neighborhood) nbh;
+ // Instantiate an object, and check its methods.
+ image_with_nbh_t ima_with_nbh(ima, nbh);
+ oln::neighb2d nbh2 = ima_with_nbh.neighborhood();
+}
Index: tests/morphers.cc
--- tests/morphers.cc (revision 557)
+++ tests/morphers.cc (working copy)
@@ -25,12 +25,13 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/// Test some morphers.
+/// Test some morphers and morpher composition.
#include <mlc/assert.hh>
#include <mlc/is_a.hh>
-// FIXME: We should not include oln/basics2d.hh, but oln/core/2d/image2d.hh.
+// FIXME: We should not include oln/basics2d.hh, but
+// oln/core/2d/image2d.hh (and oln/core/2d/neigh2d.hh ?).
#include <oln/basics2d.hh>
#include <oln/morpher/identity.hh>
#include <oln/morpher/add_neighborhood.hh>
@@ -44,12 +45,14 @@
`----------------*/
typedef oln::image2d<char> image_t;
+
// Sanity check: abstractions realized by oln::image2d.
mlc::assert_< mlc_is_a_(image_t, oln::abstract::image2d) >::check();
mlc::assert_< mlc_is_a_(image_t,
oln::abstract::grey_level_image) >::check();
mlc::assert_< mlc_is_a_(image_t,
oln::abstract::not_binary_image) >::check();
+
image_t ima(42, 51);
@@ -58,16 +61,21 @@
`------------------------------------*/
typedef oln::morpher::add_neighborhood<image_t> image_with_nbh_t;
+
// Check that the instantiated neighborhood addition morpher
// realizes the same abstraction as the underlying morphed image.
mlc::assert_< mlc_is_a_(image_with_nbh_t, oln::abstract::image2d) >::check();
mlc::assert_< mlc_is_a_(image_with_nbh_t,
oln::abstract::image_having_neighborhood) >::check();
+ mlc::assert_< mlc_is_a_(image_with_nbh_t,
+ oln::abstract::not_binary_image) >::check();
// Check the type of neighborhood.
mlc::assert_< mlc_eq(oln_type_of_(image_with_nbh_t, neighborhood),
oln::neighb2d) >::check();
- oln::neighb2d nbh;
+ // Instantiate a neighborhood for this image type.
+ oln_type_of_(image_with_nbh_t, neighborhood) nbh;
+ // Instantiate an object, and check its methods.
image_with_nbh_t ima_with_nbh(ima, nbh);
oln::neighb2d nbh2 = ima_with_nbh.neighborhood();
@@ -77,15 +85,20 @@
`------------------------------------------------*/
typedef oln::morpher::identity<image_with_nbh_t> image_with_nbh_id_t;
+
// Check that the instantiated identity morpher realizes the same
// abstraction as the underlying morphed image.
mlc::assert_< mlc_is_a_(image_with_nbh_id_t,
oln::abstract::image2d) >::check();
mlc::assert_< mlc_is_a_(image_with_nbh_id_t,
oln::abstract::image_having_neighborhood) >::check();
+ mlc::assert_< mlc_is_a_(image_with_nbh_id_t,
+ oln::abstract::not_binary_image) >::check();
// Check the type of neighborhood.
mlc::assert_< mlc_eq(oln_type_of_(image_with_nbh_id_t, neighborhood),
oln::neighb2d) >::check();
+
+ // Instantiate an object, and check its methods.
image_with_nbh_id_t ima_with_nbh_id(ima_with_nbh);
oln::neighb2d nbh3 = ima_with_nbh_id.neighborhood();
}
Index: tests/Makefile.am
--- tests/Makefile.am (revision 557)
+++ tests/Makefile.am (working copy)
@@ -11,15 +11,19 @@
check_PROGRAMS = \
grid \
- identity_morpher \
image_entry \
- morphers \
- npoints
+ npoints \
+ \
+ identity_morpher \
+ add_neighborhood_morpher \
+ morphers
grid_SOURCES = grid.cc
-identity_morpher_SOURCES = identity_morpher.cc
image_entry_SOURCES = image_entry.cc
npoints_SOURCES = npoints.cc
+# Morphers.
+identity_morpher_SOURCES = identity_morpher.cc
+add_neighborhood_morpher_SOURCES = add_neighborhood_morpher.cc
morphers_SOURCES = morphers.cc
TESTS = $(check_PROGRAMS)
Index: tests/identity_morpher.cc
--- tests/identity_morpher.cc (revision 557)
+++ tests/identity_morpher.cc (working copy)
@@ -30,31 +30,43 @@
#include <mlc/assert.hh>
#include <mlc/is_a.hh>
-// FIXME: We should not include oln/basics2d.hh, but oln/core/2d/image2d.hh.
+// FIXME: We should not include oln/basics2d.hh, but only
+// oln/core/2d/image2d.hh.
#include <oln/basics2d.hh>
#include <oln/morpher/identity.hh>
int
main()
{
-
+ /*----------------.
+ | image2d<char>. |
+ `----------------*/
typedef oln::image2d<char> image_t;
- // Sanity check: abstractions realized by oln::image2d.
+
+ // Sanity check: interfaces realized by oln::image2d.
mlc::assert_< mlc_is_a_(image_t, oln::abstract::image2d) >::check();
mlc::assert_< mlc_is_a_(image_t,
oln::abstract::grey_level_image) >::check();
mlc::assert_< mlc_is_a_(image_t,
oln::abstract::not_binary_image) >::check();
+
image_t ima(42, 51);
+
+ /*----------------------------.
+ | identity< image2d<char> >. |
+ `----------------------------*/
+
typedef oln::morpher::identity<image_t> image_id_t;
- image_id_t ima_id(ima);
+
// Check that the instantiated identity morpher realizes the same
- // abstraction as the underlying morphed image.
+ // interfaces as the underlying morphed image.
mlc::assert_< mlc_is_a_(image_id_t, oln::abstract::image2d) >::check();
mlc::assert_< mlc_is_a_(image_id_t,
oln::abstract::grey_level_image) >::check();
mlc::assert_< mlc_is_a_(image_id_t,
oln::abstract::not_binary_image) >::check();
+
+ image_id_t ima_id(ima);
}
Index: oln/core/macros.hh
--- oln/core/macros.hh (revision 557)
+++ oln/core/macros.hh (working copy)
@@ -30,18 +30,36 @@
/// \def oln_type_of(OlnType, Alias)
///
-/// Macro to retrieve an associated type \a Alias from an oln type
-/// \a OlnType whose category is not specified (version to be used inside
-/// a template).
+/// Macro to retrieve an associated type \a Alias from the exact type of
+/// an oln type \a OlnType whose category is not specified (version to be
+/// used inside a template).
# define oln_type_of(OlnType, Alias) \
stc_type_of(oln, void, OlnType, Alias)
/// \def oln_type_of(OlnType, Alias)
///
-/// Macro to retrieve an associated type \a Alias from an oln type
-/// \a OlnType whose category is not specified (version to be used
-/// outside a template).
+/// Macro to retrieve an associated type \a Alias from the exact type of
+/// an oln type \a OlnType whose category is not specified (version to be
+/// used outside a template).
# define oln_type_of_(OlnType, Alias) \
stc_type_of_(oln, void, OlnType, Alias)
+
+
+/// \def oln_direct_type_of(OlnType, Alias)
+///
+/// Macro to retrieve an associated type \a Alias from an oln type \a
+/// OlnType directly, and whose category is not specified (version to
+/// be used inside a template).
+# define oln_direct_type_of(OlnType, Alias) \
+ stc_direct_type_of(oln, void, OlnType, Alias)
+
+/// \def oln_direct_type_of_(OlnType, Alias)
+///
+/// Macro to retrieve an associated type \a Alias from an oln type \a
+/// OlnType directly, and whose category is not specified (version to
+/// be used inside a template).
+# define oln_direct_type_of_(OlnType, Alias) \
+ stc_direct_type_of_(oln, void, OlnType, Alias)
+
#endif // ! OLENA_CORE_MACROS_HH
Index: oln/morpher/internal/image_extension.hh
--- oln/morpher/internal/image_extension.hh (revision 557)
+++ oln/morpher/internal/image_extension.hh (working copy)
@@ -58,7 +58,6 @@
typedef Image ret;
};
-
namespace morpher
{
namespace internal
@@ -74,9 +73,9 @@
/// Type of morphed image.
typedef Image image_t;
- typedef oln_type_of(self_t, topo) topo_t;
- typedef oln_type_of(self_t, value) value_t;
- typedef oln_type_of(self_t, point) point_t;
+ typedef oln_direct_type_of(Exact, topo) topo_t;
+ typedef oln_direct_type_of(Exact, value) value_t;
+ typedef oln_direct_type_of(Exact, point) point_t;
public:
// FIXME: Handle the constness.
https://svn.lrde.epita.fr/svn/oln/trunk/static
Now, the task is to find where the use of `stc_direct_type_of' (instead of
`stc_type_of') is really mandatory. My guess is that we should use it
systematically inside the definition of generic (image or morpher) classes,
as long as we know its exact type from a template parameter.
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Provide two versions of type_of_: one working on `from_type'
directly (new behavior), the other working on its exact type (old
behavior).
* stc/vtypes.hh (type_of_): Don't perform the virtual type
retrieval on the exact type of `from_type', use it directly.
(exact_type_of_): New.
Perform a virtual type retrieval using the exact type of
`from_type' (i.e., implement the previous behavior of type_of_).
(stc_type_of): Adjust macro.
(stc_direct_type_of, stc_direct_type_of_): New macros.
(stc_local_type_of, stc_local_type_of_): Remove these macros, as
they are used nowhere (but in tests), and are just (useless) sugar
for `stc_type_of' and `stc_type_of_'.
* tests/vtypes.cc (my_type_of_)
* tests/vtypes-and-exact.cc (my_type_of_)
* tests/vtypes-multiple-supers.cc (my_type_of_): Adjust.
stc/vtypes.hh | 58 ++++++++++++++++++++++------------------
tests/vtypes-and-exact.cc | 2 -
tests/vtypes-multiple-supers.cc | 2 -
tests/vtypes.cc | 2 -
4 files changed, 36 insertions, 28 deletions
Index: tests/vtypes-and-exact.cc
--- tests/vtypes-and-exact.cc (revision 556)
+++ tests/vtypes-and-exact.cc (working copy)
@@ -40,7 +40,7 @@
typename my_type_of_(FromType, Typedef)
#define my_type_of_(FromType, Typedef) \
- stc_local_type_of_(my::category::my_cat, FromType, Typedef)
+ stc_type_of_(my, my::category::my_cat, FromType, Typedef)
namespace my
{
Index: tests/vtypes-multiple-supers.cc
--- tests/vtypes-multiple-supers.cc (revision 556)
+++ tests/vtypes-multiple-supers.cc (working copy)
@@ -41,7 +41,7 @@
typename my_type_of_(FromType, Typedef)
#define my_type_of_(FromType, Typedef) \
- stc_local_type_of_(my::category::my_cat, FromType, Typedef)
+ stc_type_of_(my, my::category::my_cat, FromType, Typedef)
/// \}
Index: tests/vtypes.cc
--- tests/vtypes.cc (revision 556)
+++ tests/vtypes.cc (working copy)
@@ -38,7 +38,7 @@
typename my_type_of_(FromType, Typedef)
#define my_type_of_(FromType, Typedef) \
- stc_local_type_of_(my::category::my_cat, FromType, Typedef)
+ stc_type_of_(my, my::category::my_cat, FromType, Typedef)
namespace my
{
Index: stc/vtypes.hh
--- stc/vtypes.hh (revision 556)
+++ stc/vtypes.hh (working copy)
@@ -775,23 +775,20 @@
template <typename category, typename from_type, typename typedef_type> \
struct type_of_ \
{ \
- /* Get the exact type of \a from_type. */ \
- typedef stc_to_exact(from_type) from_exact_type; \
- \
/* Look for the typedef in internal vtypes. */ \
typedef typename \
internal::rec_get_vtype<internal::tag::internal, category, \
- from_exact_type, typedef_type>::ret \
+ from_type, typedef_type>::ret \
internal_vtype_candidate; \
/* Look for the typedef as a single vtype definition. */ \
typedef typename \
internal::rec_get_vtype<internal::tag::single, category, \
- from_exact_type, typedef_type>::ret \
+ from_type, typedef_type>::ret \
single_vtype_candidate; \
/* Look for the typedef as an extended vtype. */ \
typedef typename \
internal::rec_get_vtype<internal::tag::extended, category, \
- from_exact_type, typedef_type>::ret \
+ from_type, typedef_type>::ret \
extended_vtype_candidate; \
\
/* Did we found the virtual type in any of the vtypes structures? */ \
@@ -811,6 +808,18 @@
>::ret ret; \
}; \
\
+ /** Entry point of the vtype retrieval algorithm (working on the */ \
+ /** exact version of \a from_type). */ \
+ template <typename category, typename from_type, typename typedef_type> \
+ struct exact_type_of_ \
+ { \
+ /* Get the exact type of \a from_type. */ \
+ typedef stc_to_exact(from_type) from_exact_type; \
+ /* ``Run'' type_of_. */ \
+ typedef typename \
+ type_of_<category, from_exact_type, typedef_type>::ret ret; \
+ }; \
+ \
struct e_n_d__w_i_t_h___s_e_m_i_c_o_l_o_n
@@ -928,31 +937,30 @@
// Virtual types access. //
// ---------------------- //
-// FIXME: Perhaps only ``external'' (i.e., non local) versions of
-// stc_type_of are really useful (since they are more precise), and we
-// could get rid of local versions (stc_local_type_of and
-// stc_local_type_of_).
-
-/// Get the vtype \a Typedef, declared in the current namespace,
-/// from \a FromType (version to be used inside a template).
-#define stc_local_type_of(Category, FromType, Typedef) \
- typename stc_type_of_(Category, FromType, Typedef)
-
-/// Get the vtype \a Typedef, declared in the current namespace,
-/// from \a FromType (version to be used outside a template).
-#define stc_local_type_of_(Category, FromType, Typedef) \
- type_of_<Category, FromType, typedef_:: Typedef##_type >::ret
-
-/// Get the vtype \a Typedef, declared in \a Namespace, from \a
-/// FromType (version to be used inside a template).
+/// Get the vtype \a Typedef, declared in \a Namespace, from the
+/// exact type of \a FromType (version to be used inside a template).
#define stc_type_of(Namespace, Category, FromType, Typedef) \
typename stc_type_of_(Namespace, Category, FromType, Typedef)
-/// Get the vtype \a Typedef, declared in \a Namespace, from \a
-/// FromType (version to be used outside a template).
+/// Get the vtype \a Typedef, declared in \a Namespace, from the
+/// exact type of \a FromType (version to be used outside a template).
#define stc_type_of_(Namespace, Category, FromType, Typedef) \
+ Namespace::exact_type_of_< Category, FromType, \
+ Namespace::typedef_:: Typedef##_type >::ret
+
+
+/// Get the vtype \a Typedef, declared in \a Namespace, from \a
+/// FromType directly. (version to be used inside a template).
+#define stc_direct_type_of(Namespace, Category, FromType, Typedef) \
+ typename stc_direct_type_of_(Namespace, Category, FromType, Typedef)
+
+/// Get the vtype \a Typedef, declared in \a Namespace, from \a
+/// FromType directly (version to be used outside a template).
+#define stc_direct_type_of_(Namespace, Category, FromType, Typedef) \
Namespace::type_of_<Category, FromType, \
Namespace::typedef_:: Typedef##_type >::ret
+
+
/// Declare the vtype \a Typedef in an abstract class (see sample code
/// for details). Warning: this macro assumes that the exact type
2006-09-22 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add image point iterators parameterized by the image topology;
factor code into an internal class.
* oln/core/gen/bbox_fwd_piter.hh: Change inheritance and move
methods into...
* oln/core/internal/bbox_fwd_piter.hh: ...this new class.
* oln/core/gen/bbox_bkd_piter.hh: Change inheritance and move
methods into...
* oln/core/internal/bbox_bkd_piter.hh: ...this new class.
* oln/core/gen/fwd_piter_bbox.hh: New.
* oln/core/gen/bkd_piter_bbox.hh: New.
Index: oln/core/gen/bbox_fwd_piter.hh
===================================================================
--- oln/core/gen/bbox_fwd_piter.hh (revision 555)
+++ oln/core/gen/bbox_fwd_piter.hh (working copy)
@@ -29,9 +29,7 @@
#ifndef OLENA_CORE_GEN_BBOX_FWD_PITER_HH
# define OLENA_CORE_GEN_BBOX_FWD_PITER_HH
-# include <oln/core/abstract/iterator_on_points.hh>
-# include <oln/core/abstract/point.hh>
-# include <oln/core/gen/bbox.hh>
+# include <oln/core/internal/bbox_fwd_piter.hh>
namespace oln
@@ -47,7 +45,7 @@
struct set_super_type< bbox_fwd_piter_<point> >
{
typedef bbox_fwd_piter_<point> self_t;
- typedef abstract::iterator_on_points<self_t> ret;
+ typedef internal::bbox_fwd_piter<self_t> ret;
};
@@ -63,107 +61,18 @@
/// Abstract forward point iterator class.
template <typename point>
- class bbox_fwd_piter_ : public abstract::iterator_on_points< bbox_fwd_piter_<point> >,
+ class bbox_fwd_piter_ : public internal::bbox_fwd_piter< bbox_fwd_piter_<point> >,
private mlc::assert_< mlc_is_a(point, abstract::point) >
{
typedef bbox_fwd_piter_<point> self_t;
- typedef abstract::iterator_on_points<self_t> super_t;
+ typedef internal::bbox_fwd_piter<self_t> super_t;
public:
bbox_fwd_piter_(const bbox_<point>& bb)
- : p_(),
- bb_(bb)
+ : super_t(bb)
{
- nop_ = bb_.pmax();
- ++nop_[0];
}
-
-// template <typename T>
-// bbox_fwd_piter_(const abstract::topo<T>& t)
-// {
-// mlc::assert_< mlc_is_a(T, abstract::topo_with_bbox) >::check();
-// bb_ = t.exact().bbox();
-// nop_ = bb_.pmax();
-// ++nop_[0];
-// }
-
-// template <typename Data>
-// bbox_fwd_piter_(const Data& data)
-// : bb_(data.bbox())
-// {
-// nop_ = bb_.pmax();
-// ++nop_[0];
-// }
-
- const bbox_<point>& bbox() const
- {
- return bb_;
- }
-
- void impl_start()
- {
- p_ = bb_.pmin();
- invariant(implies(p_ != nop_, bb_.has(p_)));
- }
-
- void impl_next()
- {
- invariant(implies(p_ != nop_, bb_.has(p_)));
- for (int i = point::n - 1; i >= 0; --i)
- if (p_[i] == bb_.pmax(i))
- p_[i] = bb_.pmin(i);
- else
- {
- ++p_[i];
- break;
- }
- if (p_ == bb_.pmin())
- p_ = nop_;
- }
-
- void impl_invalidate()
- {
- invariant(implies(p_ != nop_, bb_.has(p_)));
- p_ = nop_;
- }
-
- bool impl_is_valid() const
- {
- invariant(implies(p_ != nop_, bb_.has(p_)));
- return p_ != nop_;
- }
-
- point impl_to_point() const
- {
- return p_;
- }
-
- const point* impl_point_adr() const
- {
- return &p_;
- }
-
- void print(std::ostream& ostr) const
- {
- ostr << "{ bb=" << bb_
- << ", p=" << p_
- << ", nop=" << nop_
- << " }";
- }
-
- friend
- std::ostream& operator<<(std::ostream& ostr, const bbox_fwd_piter_<point>& i)
- {
- i.print(ostr);
- return ostr;
- }
-
- protected:
-
- point p_;
- bbox_<point> bb_;
- point nop_;
}; // end of class oln::bbox_fwd_piter_<point>
Index: oln/core/gen/bbox_bkd_piter.hh
===================================================================
--- oln/core/gen/bbox_bkd_piter.hh (revision 555)
+++ oln/core/gen/bbox_bkd_piter.hh (working copy)
@@ -29,9 +29,7 @@
#ifndef OLENA_CORE_GEN_BBOX_BKD_PITER_HH
# define OLENA_CORE_GEN_BBOX_BKD_PITER_HH
-# include <oln/core/abstract/iterator_on_points.hh>
-# include <oln/core/abstract/point.hh>
-# include <oln/core/gen/bbox.hh>
+# include <oln/core/internal/bbox_bkd_piter.hh>
namespace oln
@@ -47,11 +45,11 @@
struct set_super_type< bbox_bkd_piter_<point> >
{
typedef bbox_bkd_piter_<point> self_t;
- typedef abstract::iterator_on_points<self_t> ret;
+ typedef internal::bbox_bkd_piter<self_t> ret;
};
- /// Virtual types associated to oln::bbox_<point>.
+ /// Virtual types associated to oln::bbox_bkd_piter_<point>.
template <typename point>
struct vtypes< bbox_bkd_piter_<point> >
{
@@ -63,76 +61,19 @@
/// Abstract forward point iterator class.
template <typename point>
- class bbox_bkd_piter_ : public abstract::iterator_on_points< bbox_bkd_piter_<point> >,
+ class bbox_bkd_piter_ : public internal::bbox_bkd_piter< bbox_bkd_piter_<point> >,
private mlc::assert_< mlc_is_a(point, abstract::point) >
{
typedef bbox_bkd_piter_<point> self_t;
- typedef abstract::iterator_on_points<self_t> super_t;
+ typedef internal::bbox_bkd_piter<self_t> super_t;
public:
bbox_bkd_piter_(const bbox_<point>& bb)
- : p_(),
- bb_(bb)
+ : super_t(bb)
{
- nop_ = bb_.pmin();
- --nop_[0];
}
-
- const bbox_<point>& bbox() const
- {
- return bb_;
- }
-
- void impl_start()
- {
- p_ = bb_.pmax();
- invariant(implies(p_ != nop_, bb_.has(p_)));
- }
-
- void impl_next()
- {
- invariant(implies(p_ != nop_, bb_.has(p_)));
- for (int i = point::n - 1; i >= 0; --i)
- if (p_[i] == bb_.pmin(i))
- p_[i] = bb_.pmax(i);
- else
- {
- --p_[i];
- break;
- }
- if (p_ == bb_.pmax())
- p_ = nop_;
- }
-
- void impl_invalidate()
- {
- invariant(implies(p_ != nop_, bb_.has(p_)));
- p_ = nop_;
- }
-
- bool impl_is_valid() const
- {
- invariant(implies(p_ != nop_, bb_.has(p_)));
- return p_ != nop_;
- }
-
- point impl_to_point() const
- {
- return p_;
- }
-
- const point* impl_point_adr() const
- {
- return &p_;
- }
-
- protected:
-
- point p_;
- bbox_<point> bb_;
- point nop_;
-
+
}; // end of class oln::bbox_bkd_piter_<point>
Index: oln/core/gen/fwd_piter_bbox.hh
===================================================================
--- oln/core/gen/fwd_piter_bbox.hh (revision 0)
+++ oln/core/gen/fwd_piter_bbox.hh (revision 0)
@@ -0,0 +1,108 @@
+// Copyright (C) 2001, 2003, 2004, 2005, 2006 EPITA Research and
+// Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLENA_CORE_GEN_FWD_PITER_BBOX_HH
+# define OLENA_CORE_GEN_FWD_PITER_BBOX_HH
+
+# include <oln/core/abstract/topology.hh>
+# include <oln/core/internal/bbox_fwd_piter.hh>
+
+
+namespace oln
+{
+
+
+ // Forward declaration.
+ template <typename topo> class fwd_piter_bbox_;
+
+
+ // Super type declaration.
+ template <typename topo>
+ struct set_super_type< fwd_piter_bbox_<topo> >
+ {
+ typedef fwd_piter_bbox_<topo> self_t;
+ typedef internal::bbox_fwd_piter<self_t> ret;
+ };
+
+
+ /// Virtual types associated to oln::fwd_piter_bbox_<topo>.
+ template <typename topo>
+ struct vtypes< fwd_piter_bbox_<topo> >
+ {
+ typedef oln_type_of(topo, point) point_type;
+ typedef oln_type_of(topo, grid) grid_type;
+ };
+
+
+
+ /// Abstract forward point iterator class.
+ template <typename topo_t>
+ class fwd_piter_bbox_ : public internal::bbox_fwd_piter< fwd_piter_bbox_<topo_t> >,
+ private mlc::assert_< mlc_is_a(topo_t, abstract::topology) >
+ {
+ typedef fwd_piter_bbox_<topo_t> self_t;
+ typedef internal::bbox_fwd_piter<self_t> super_t;
+
+ public:
+
+ template <typename T>
+ fwd_piter_bbox_(const abstract::topology<T>& topo)
+ : super_t(topo.exact().bbox()),
+ topo_(topo.exact())
+ {
+ }
+
+ const topo_t& topo() const
+ {
+ return topo_;
+ }
+
+ void print(std::ostream& ostr) const
+ {
+ ostr << "{ p=" << super_t::p_
+ << " }";
+ }
+
+ friend
+ std::ostream& operator<<(std::ostream& ostr, const fwd_piter_bbox_<topo_t>& t)
+ {
+ t.print(ostr);
+ return ostr;
+ }
+
+ protected:
+
+ const topo_t& topo_;
+
+ }; // end of class oln::fwd_piter_bbox_<point>
+
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_GEN_FWD_PITER_BBOX_HH
Index: oln/core/gen/bkd_piter_bbox.hh
===================================================================
--- oln/core/gen/bkd_piter_bbox.hh (revision 0)
+++ oln/core/gen/bkd_piter_bbox.hh (revision 0)
@@ -0,0 +1,108 @@
+// Copyright (C) 2001, 2003, 2004, 2005, 2006 EPITA Research and
+// Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLENA_CORE_GEN_BKD_PITER_BBOX_HH
+# define OLENA_CORE_GEN_BKD_PITER_BBOX_HH
+
+# include <oln/core/abstract/topology.hh>
+# include <oln/core/internal/bbox_bkd_piter.hh>
+
+
+namespace oln
+{
+
+
+ // Forward declaration.
+ template <typename topo> class bkd_piter_bbox_;
+
+
+ // Super type declaration.
+ template <typename topo>
+ struct set_super_type< bkd_piter_bbox_<topo> >
+ {
+ typedef bkd_piter_bbox_<topo> self_t;
+ typedef internal::bbox_bkd_piter<self_t> ret;
+ };
+
+
+ /// Virtual types associated to oln::bkd_piter_bbox_<topo>.
+ template <typename topo>
+ struct vtypes< bkd_piter_bbox_<topo> >
+ {
+ typedef oln_type_of(topo, point) point_type;
+ typedef oln_type_of(topo, grid) grid_type;
+ };
+
+
+
+ /// Abstract forward point iterator class.
+ template <typename topo_t>
+ class bkd_piter_bbox_ : public internal::bbox_bkd_piter< bkd_piter_bbox_<topo_t> >,
+ private mlc::assert_< mlc_is_a(topo_t, abstract::topology) >
+ {
+ typedef bkd_piter_bbox_<topo_t> self_t;
+ typedef internal::bbox_bkd_piter<self_t> super_t;
+
+ public:
+
+ template <typename T>
+ bkd_piter_bbox_(const abstract::topology<T>& topo)
+ : super_t(topo.exact().bbox()),
+ topo_(topo.exact())
+ {
+ }
+
+ const topo_t& topo() const
+ {
+ return topo_;
+ }
+
+ void print(std::ostream& ostr) const
+ {
+ ostr << "{ p=" << super_t::p_
+ << " }";
+ }
+
+ friend
+ std::ostream& operator<<(std::ostream& ostr, const bkd_piter_bbox_<topo_t>& t)
+ {
+ t.print(ostr);
+ return ostr;
+ }
+
+ protected:
+
+ const topo_t& topo_;
+
+ }; // end of class oln::bkd_piter_bbox_<point>
+
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_GEN_BKD_PITER_BBOX_HH
Index: oln/core/internal/bbox_fwd_piter.hh
===================================================================
--- oln/core/internal/bbox_fwd_piter.hh (revision 0)
+++ oln/core/internal/bbox_fwd_piter.hh (revision 0)
@@ -0,0 +1,137 @@
+// Copyright (C) 2001, 2003, 2004, 2005, 2006 EPITA Research and
+// Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLENA_CORE_INTERNAL_BBOX_FWD_PITER_HH
+# define OLENA_CORE_INTERNAL_BBOX_FWD_PITER_HH
+
+# include <oln/core/abstract/iterator_on_points.hh>
+# include <oln/core/abstract/point.hh>
+# include <oln/core/gen/bbox.hh>
+
+
+namespace oln
+{
+
+
+ // Forward declaration.
+ namespace internal {
+ template <typename E> class bbox_fwd_piter;
+ }
+
+
+ // Super type declaration.
+ template <typename E>
+ struct set_super_type< internal::bbox_fwd_piter<E> >
+ {
+ typedef abstract::iterator_on_points<E> ret;
+ };
+
+
+
+ namespace internal
+ {
+
+ /// Internal forward point iterator class; this class factors code.
+ template <typename E>
+ class bbox_fwd_piter : public abstract::iterator_on_points<E>
+ {
+ typedef oln_type_of(E, point) point_t;
+
+ public:
+
+ bbox_fwd_piter(const bbox_<point_t>& bb)
+ : p_(),
+ bb_(bb)
+ {
+ nop_ = bb_.pmax();
+ ++nop_[0];
+ }
+
+ const bbox_<point_t>& bbox() const
+ {
+ return bb_;
+ }
+
+ void impl_start()
+ {
+ p_ = bb_.pmin();
+ invariant(implies(p_ != nop_, bb_.has(p_)));
+ }
+
+ void impl_next()
+ {
+ invariant(implies(p_ != nop_, bb_.has(p_)));
+ for (int i = point_t::n - 1; i >= 0; --i)
+ if (p_[i] == bb_.pmax(i))
+ p_[i] = bb_.pmin(i);
+ else
+ {
+ ++p_[i];
+ break;
+ }
+ if (p_ == bb_.pmin())
+ p_ = nop_;
+ }
+
+ void impl_invalidate()
+ {
+ invariant(implies(p_ != nop_, bb_.has(p_)));
+ p_ = nop_;
+ }
+
+ bool impl_is_valid() const
+ {
+ invariant(implies(p_ != nop_, bb_.has(p_)));
+ return p_ != nop_;
+ }
+
+ point_t impl_to_point() const
+ {
+ return p_;
+ }
+
+ const point_t* impl_point_adr() const
+ {
+ return &p_;
+ }
+
+ protected:
+
+ point_t p_;
+ bbox_<point_t> bb_;
+ point_t nop_;
+
+ }; // end of class oln::internal::bbox_fwd_piter<E>
+
+
+ } // end of namespace oln::internal
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_INTERNAL_BBOX_FWD_PITER_HH
Index: oln/core/internal/bbox_bkd_piter.hh
===================================================================
--- oln/core/internal/bbox_bkd_piter.hh (revision 0)
+++ oln/core/internal/bbox_bkd_piter.hh (revision 0)
@@ -0,0 +1,137 @@
+// Copyright (C) 2001, 2003, 2004, 2005, 2006 EPITA Research and
+// Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLENA_CORE_INTERNAL_BBOX_BKD_PITER_HH
+# define OLENA_CORE_INTERNAL_BBOX_BKD_PITER_HH
+
+# include <oln/core/abstract/iterator_on_points.hh>
+# include <oln/core/abstract/point.hh>
+# include <oln/core/gen/bbox.hh>
+
+
+namespace oln
+{
+
+
+ // Forward declaration.
+ namespace internal {
+ template <typename E> class bbox_bkd_piter;
+ }
+
+
+ // Super type declaration.
+ template <typename E>
+ struct set_super_type< internal::bbox_bkd_piter<E> >
+ {
+ typedef abstract::iterator_on_points<E> ret;
+ };
+
+
+
+ namespace internal
+ {
+
+ /// Internal backward point iterator class; this class factors code.
+ template <typename E>
+ class bbox_bkd_piter : public abstract::iterator_on_points<E>
+ {
+ typedef oln_type_of(E, point) point_t;
+
+ public:
+
+ bbox_bkd_piter(const bbox_<point_t>& bb)
+ : p_(),
+ bb_(bb)
+ {
+ nop_ = bb_.pmin();
+ --nop_[0];
+ }
+
+ const bbox_<point_t>& bbox() const
+ {
+ return bb_;
+ }
+
+ void impl_start()
+ {
+ p_ = bb_.pmax();
+ invariant(implies(p_ != nop_, bb_.has(p_)));
+ }
+
+ void impl_next()
+ {
+ invariant(implies(p_ != nop_, bb_.has(p_)));
+ for (int i = point_t::n - 1; i >= 0; --i)
+ if (p_[i] == bb_.pmin(i))
+ p_[i] = bb_.pmax(i);
+ else
+ {
+ --p_[i];
+ break;
+ }
+ if (p_ == bb_.pmax())
+ p_ = nop_;
+ }
+
+ void impl_invalidate()
+ {
+ invariant(implies(p_ != nop_, bb_.has(p_)));
+ p_ = nop_;
+ }
+
+ bool impl_is_valid() const
+ {
+ invariant(implies(p_ != nop_, bb_.has(p_)));
+ return p_ != nop_;
+ }
+
+ point_t impl_to_point() const
+ {
+ return p_;
+ }
+
+ const point_t* impl_point_adr() const
+ {
+ return &p_;
+ }
+
+ protected:
+
+ point_t p_;
+ bbox_<point_t> bb_;
+ point_t nop_;
+
+ }; // end of class oln::internal::bbox_bkd_piter<E>
+
+
+ } // end of namespace oln::internal
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_INTERNAL_BBOX_BKD_PITER_HH
2006-09-20 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add classes for classical 2d neighborhood.
* oln/core/neighborhood_entry.hh: New.
* oln/core/abstract/neighborhood.hh: New.
* oln/core/2d/neighb2d.hh: New.
* oln/core/gen/neighb.hh: New.
* oln/core/2d/aliases.hh (neighb2d): New.
* oln/basics2d.hh: Update.
Index: oln/core/neighborhood_entry.hh
===================================================================
--- oln/core/neighborhood_entry.hh (revision 0)
+++ oln/core/neighborhood_entry.hh (revision 0)
@@ -0,0 +1,63 @@
+// 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 OLENA_CORE_NEIGHBORHOOD_ENTRY_HH
+# define OLENA_CORE_NEIGHBORHOOD_ENTRY_HH
+
+# include <oln/core/abstract/entry.hh>
+# include <oln/core/abstract/neighborhood.hh>
+
+
+
+namespace oln
+{
+
+
+ /// Entry class for point sets: neighborhood_entry<E> is an alias for
+ /// entry< abstract::neighborhood, E>.
+
+ template <typename E>
+ struct neighborhood_entry : public entry< abstract::neighborhood, E>
+ {
+ protected:
+ neighborhood_entry() {}
+ };
+
+
+ /// Virtual types associated to neighborhood_entry<E>.
+
+ template <typename E>
+ struct vtypes< neighborhood_entry<E> >
+ {
+ typedef mlc::undefined grid_type;
+ };
+
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_NEIGHBORHOOD_ENTRY_HH
Index: oln/core/abstract/neighborhood.hh
===================================================================
--- oln/core/abstract/neighborhood.hh (revision 0)
+++ oln/core/abstract/neighborhood.hh (revision 0)
@@ -0,0 +1,82 @@
+// 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 OLENA_CORE_ABSTRACT_NEIGHBORHOOD_HH
+# define OLENA_CORE_ABSTRACT_NEIGHBORHOOD_HH
+
+# include <oln/core/typedefs.hh>
+
+
+namespace oln
+{
+
+ namespace abstract
+ {
+
+
+ /// Abstract neighborhood class.
+ template <typename E>
+ class neighborhood : public virtual stc::any__simple<E>,
+ public virtual oln::type
+ {
+ public:
+
+ bool is_valid() const
+ {
+ return this->exact().impl_is_valid();
+ }
+
+ struct decl
+ {
+ stc_virtual_typedef(grid);
+
+ decl() {
+ }
+ };
+
+ protected:
+
+ neighborhood()
+ {}
+
+ ~neighborhood() { decl(); }
+
+ }; // end of class oln::abstract::neighborhood<E>
+
+
+
+ } // end of namespace oln::abstract
+
+} // end of namespace oln
+
+
+
+// # include <oln/core/abstract/neighborhood_hierarchies.hh>
+
+
+
+#endif // ! OLENA_CORE_ABSTRACT_NEIGHBORHOOD_HH
Index: oln/core/2d/aliases.hh
===================================================================
--- oln/core/2d/aliases.hh (revision 552)
+++ oln/core/2d/aliases.hh (working copy)
@@ -37,6 +37,7 @@
/// Forward declarations.
template <typename C> class point2d_;
template <typename C> class dpoint2d_;
+ template <typename D> class neighb_;
template <typename P> class bbox_;
template <typename P> class topo_bbox_;
template <typename P> class bbox_fwd_piter_;
@@ -50,6 +51,8 @@
typedef point2d_<int> point2d;
typedef dpoint2d_<int> dpoint2d;
+ typedef neighb_<dpoint2d> neighb2d;
+
typedef bbox_<point2d> bbox2d;
typedef bbox_fwd_piter_<point2d> fwd_piter2d;
typedef bbox_bkd_piter_<point2d> bkd_piter2d;
Index: oln/core/2d/neighb2d.hh
===================================================================
--- oln/core/2d/neighb2d.hh (revision 0)
+++ oln/core/2d/neighb2d.hh (revision 0)
@@ -0,0 +1,104 @@
+// Copyright (C) 2001, 2002, 2003, 2004, 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 OLENA_CORE_2D_NEIGHB2D_HH
+# define OLENA_CORE_2D_NEIGHB2D_HH
+
+# include <oln/core/gen/neighb.hh>
+# include <oln/core/2d/aliases.hh>
+
+
+namespace oln
+{
+
+
+ neighb2d c4()
+ {
+ static bool flower = true;
+ static neighb2d the_;
+ if (flower)
+ {
+ the_
+ .add(dpoint2d(0, 1))
+ .add(dpoint2d(1, 0));
+ flower = false;
+ }
+ return the_;
+ }
+
+
+ neighb2d c8()
+ {
+ static bool flower = true;
+ static neighb2d the_;
+ if (flower)
+ {
+ the_
+ .add(dpoint2d(0, 1))
+ .add(dpoint2d(1,-1))
+ .add(dpoint2d(1, 0))
+ .add(dpoint2d(1, 1));
+ flower = false;
+ }
+ return the_;
+ }
+
+
+ neighb2d c2_row()
+ {
+ static bool flower = true;
+ static neighb2d the_;
+ if (flower)
+ {
+ the_
+ .add(dpoint2d(0, 1));
+ flower = false;
+ }
+ return the_;
+ }
+
+
+ neighb2d c2_col()
+ {
+ static bool flower = true;
+ static neighb2d the_;
+ if (flower)
+ {
+ the_
+ .add(dpoint2d(1, 0));
+ flower = false;
+ }
+ return the_;
+ }
+
+
+} // end of namespace oln
+
+
+
+#endif // ! OLENA_CORE_2D_NEIGHB2D_HH
+
Index: oln/core/gen/neighb.hh
===================================================================
--- oln/core/gen/neighb.hh (revision 0)
+++ oln/core/gen/neighb.hh (revision 0)
@@ -0,0 +1,123 @@
+// Copyright (C) 2001, 2003, 2004, 2005, 2006 EPITA Research and
+// Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLENA_CORE_GEN_NEIGHB_HH
+# define OLENA_CORE_GEN_NEIGHB_HH
+
+# include <set>
+# include <vector>
+# include <oln/core/neighborhood_entry.hh>
+
+
+namespace oln
+{
+
+
+ // Forward declaration.
+ template <typename dpoint> class neighb_;
+
+
+ // Super type declaration.
+ template <typename dpoint>
+ struct set_super_type< neighb_<dpoint> >
+ {
+ typedef neighb_<dpoint> self_t;
+ typedef neighborhood_entry<self_t> ret;
+ };
+
+
+ /// Virtual types associated to oln::neighb_<dpoint>.
+ template <typename dpoint>
+ struct vtypes< neighb_<dpoint> >
+ {
+ typedef oln_type_of(dpoint, grid) grid_type;
+ };
+
+
+
+ /// Abstract forward dpoint iterator class.
+ template <typename dpoint>
+ class neighb_ : public neighborhood_entry< neighb_<dpoint> >,
+ private mlc::assert_< mlc_is_a(dpoint, abstract::dpoint) >
+ {
+ typedef neighb_<dpoint> self_t;
+ typedef neighborhood_entry<self_t> super_t;
+
+ public:
+
+ neighb_()
+ {
+ }
+
+ self_t& add(const dpoint& dp)
+ {
+ s_.insert(dp);
+ s_.insert(-dp);
+ update_();
+ return *this;
+ }
+
+ template <typename D>
+ self_t& add(const abstract::dpoint<D>& dp)
+ {
+ return this->add(dp.exact());
+ }
+
+ unsigned card() const
+ {
+ return v_.size();
+ }
+
+ dpoint dp(unsigned i) const
+ {
+ precondition(i < v_.size());
+ return v_[i];
+ }
+
+ // void print(std::ostream& ostr) const;
+ // friend std::ostream& operator<<(std::ostream& ostr, const neighb_<dpoint>& nbh);
+
+ protected:
+
+ std::set<dpoint> s_;
+ std::vector<dpoint> v_;
+
+ void update_()
+ {
+ v_.clear();
+ std::copy(s_.begin(), s_.end(),
+ std::back_inserter(v_));
+ }
+
+ }; // end of class oln::neighb_<dpoint>
+
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_GEN_NEIGHB_HH
Index: oln/basics2d.hh
===================================================================
--- oln/basics2d.hh (revision 552)
+++ oln/basics2d.hh (working copy)
@@ -50,7 +50,11 @@
# include <oln/core/gen/topo_bbox.hh>
namespace oln { template class topo_bbox_<point2d>; }
+# include <oln/core/gen/neighb.hh>
+namespace oln { template class neighb_<dpoint2d>; }
+# include <oln/core/2d/neighb2d.hh>
+
# include <oln/core/2d/image2d.hh>
https://svn.lrde.epita.fr/svn/oln/trunk/olena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Add the first two morphers: identity and neighborhood addition.
* oln/core/typedefs.hh (morpher_type, neighborhood_type): New
typedef declarations.
(neighb_type, image_neighbness_type, image_constness_type)
(image_dimension_type, image_typeness_type)
(image_valuedness_type, image_rawness_type): Remove typedef
declarations.
* oln/core/image_entry.hh
(single_vtype<image_entry<E>, typedef_::morpher_type>): New
virtual type.
* oln/core/abstract/image.hh: Check it.
* oln/core/abstract/image_hierarchies.hh
(image_dimension_hierarchy, image_type_hierarchy): Rename as...
(image_hierarchy_wrt_dimension, image_hierarchy_wrt_type):
...this.
(image_neighborhood_hierarchy): Make it the third image hierarchy.
Rename as...
(image_hierarchy_wrt_neighborhood).
(image_value_hierarchy, image_rawness_hierarchy): Adjust and
rename as...
(image_hierarchy_wrt_value, image_hierarchy_wrt_data_retrieval):
...this.
(oln/core/abstract/image_having_neighborhood.hh): Include it.
* oln/core/abstract/image_dimension.hh:
s/image_dimension_hierarchy/image_hierarchy_wrt_dimension/.
(oln::abstract::image1d, oln::abstract::image2d)
(oln::abstract::image3d): Inherit from automatic::impl.
* oln/core/abstract/image_type.hh,
* oln/core/abstract/image_type_integre.hh:
s/image_type_hierarchy/image_hierarchy_wrt_type/.
* oln/core/abstract/image_having_neighborhood.hh: New
abstraction.
* oln/automatic/image_having_neighborhood.hh: New automatic
implementation.
* oln/morpher/internal/image_extension.hh: New abstract
class.
* oln/morpher/identity.hh,
* oln/morpher/add_neighborhood.hh: New morphers.
* tests/morphers.cc, tests/identity_morpher.cc: New tests.
* oln/Makefile.am (nobase_oln_HEADERS): Catch up with renamings
from the previous patches.
Add automatic/image_having_neighborhood.hh,
core/abstract/image_having_neighborhood.hh,
morpher/internal/image_extension.hh,
morpher/add_neighborhood.hh and
morpher/identity.hh.
* tests/Makefile.am (check_PROGRAMS): Add identity_morpher and
morphers.
(identity_morpher_SOURCES, morphers_SOURCES): New.
* oln/core/abstract/topology_hierarchies.hh: Aesthetic changes.
oln/Makefile.am | 39 ++++---
oln/automatic/image_having_neighborhood.hh | 62 +++++++++++
oln/core/abstract/image.hh | 2
oln/core/abstract/image_dimension.hh | 20 ++-
oln/core/abstract/image_having_neighborhood.hh | 101 +++++++++++++++++++
oln/core/abstract/image_hierarchies.hh | 17 ++-
oln/core/abstract/image_type.hh | 6 -
oln/core/abstract/image_type_integre.hh | 8 -
oln/core/abstract/topology_hierarchies.hh | 4
oln/core/image_entry.hh | 17 ++-
oln/core/typedefs.hh | 17 ---
oln/morpher/add_neighborhood.hh | 130 +++++++++++++++++++++++++
oln/morpher/identity.hh | 97 ++++++++++++++++++
oln/morpher/internal/image_extension.hh | 122 +++++++++++++++++++++++
tests/Makefile.am | 4
tests/identity_morpher.cc | 42 ++++++++
tests/morphers.cc | 62 +++++++++++
17 files changed, 698 insertions(+), 52 deletions(-)
Index: tests/morphers.cc
--- tests/morphers.cc (revision 0)
+++ tests/morphers.cc (revision 0)
@@ -0,0 +1,62 @@
+// 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.
+
+/// Test the identity morpher.
+
+// FIXME: We should not include oln/basics2d.hh, but oln/core/2d/image2d.hh.
+#include <oln/basics2d.hh>
+#include <oln/morpher/identity.hh>
+#include <oln/morpher/add_neighborhood.hh>
+
+// FIXME: Fake!
+// To be removed as soon as neighborhood2d is written.
+namespace oln
+{
+ struct neighborhood2d {};
+}
+
+int
+main()
+{
+ typedef oln::image2d<int> image_t;
+ image_t ima (42, 51);
+
+ typedef oln::morpher::add_neighborhood<image_t> image_with_nbh_t;
+ // FIXME: Using `oln_type_of_(image_t, neighborhood)' seems
+ // mandatory here. In fact, we cannot use oln::neighborhood2d
+ // directly like this
+ //
+ // oln::neighborhood2d nbh;
+ //
+ // since it confuses the compiler (g++ 4.0)!
+ typedef oln_type_of_(image_t, neighborhood) neighborhood_t;
+ neighborhood_t nbh;
+ image_with_nbh_t ima_with_nbh(ima, nbh);
+
+ typedef oln::morpher::identity<image_with_nbh_t> image_with_nbh_id_t;
+ image_with_nbh_id_t ima_with_nbh_id(ima_with_nbh);
+}
Index: tests/Makefile.am
--- tests/Makefile.am (revision 551)
+++ tests/Makefile.am (working copy)
@@ -11,11 +11,15 @@
check_PROGRAMS = \
grid \
+ identity_morpher \
image_entry \
+ morphers \
npoints
grid_SOURCES = grid.cc
+identity_morpher_SOURCES = identity_morpher.cc
image_entry_SOURCES = image_entry.cc
npoints_SOURCES = npoints.cc
+morphers_SOURCES = morphers.cc
TESTS = $(check_PROGRAMS)
Index: tests/identity_morpher.cc
--- tests/identity_morpher.cc (revision 0)
+++ tests/identity_morpher.cc (revision 0)
@@ -0,0 +1,42 @@
+// 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.
+
+/// Test the identity morpher.
+
+// FIXME: We should not include oln/basics2d.hh, but oln/core/2d/image2d.hh.
+#include <oln/basics2d.hh>
+#include <oln/morpher/identity.hh>
+
+int
+main()
+{
+ typedef oln::image2d<int> image_t;
+ image_t ima (42, 51);
+
+ typedef oln::morpher::identity<image_t> image_id_t;
+ image_id_t ima_id(ima);
+}
Index: oln/automatic/image_having_neighborhood.hh
--- oln/automatic/image_having_neighborhood.hh (revision 0)
+++ oln/automatic/image_having_neighborhood.hh (revision 0)
@@ -0,0 +1,62 @@
+// 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 OLENA_AUTOMATIC_IMAGE_HAVING_NEIGHBORDHOOD_HH
+# define OLENA_AUTOMATIC_IMAGE_HAVING_NEIGHBORDHOOD_HH
+
+# include <oln/core/typedefs.hh>
+# include <oln/morphers/identity.hh>
+# include <oln/core/abstract/image_dimension.hh>
+
+namespace oln
+{
+ namespace automatic
+ {
+
+ /// Implementation corresponding to the interface
+ /// oln::abstract::image1d for an identity morpher.
+ template <abstract::image_having_neighborhood, morpher::tag::identity,
+ typename E>
+ class impl
+ {
+ private:
+ typedef oln_type_of(E, neighborhood) neighborhood_t;
+
+ public:
+ /// Accessor delegation.
+ neighborhood_t impl_neighborhood()
+ {
+ return delegate().impl_neighborhood()
+
+ }
+ };
+
+ } // end of namespace automatic
+
+} // end of namespace oln
+
+#endif // ! OLENA_AUTOMATIC_IMAGE_HAVING_NEIGHBORDHOOD_HH
Index: oln/core/typedefs.hh
--- oln/core/typedefs.hh (revision 551)
+++ oln/core/typedefs.hh (working copy)
@@ -65,6 +65,7 @@
`-------*/
mlc_decl_typedef(exact_type);
+ mlc_decl_typedef(morpher_type);
/*----------.
@@ -119,16 +120,19 @@
// --------------------------------------------------------------------
mlc_decl_typedef(value_type);
mlc_decl_typedef(rvalue_type);
+
// --------------------------------------------------------------------
// FIXME: To be enabled later.
// --------------------------------------------------------------------
-// mlc_decl_typedef(neighb_type);
// 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);
+
+ mlc_decl_typedef(neighborhood_type);
+
// --------------------------------------------------------------------
// FIXME: To be enabled later.
// --------------------------------------------------------------------
@@ -144,17 +148,6 @@
// FIXME: To be enabled later.
// --------------------------------------------------------------------
// mlc_decl_typedef(window_type);
-
-// mlc_decl_typedef(image_neighbness_type);
-// mlc_decl_typedef(image_constness_type);
-// --------------------------------------------------------------------
- mlc_decl_typedef(image_dimension_type);
- mlc_decl_typedef(image_typeness_type);
-// --------------------------------------------------------------------
-// FIXME: To be enabled later.
-// --------------------------------------------------------------------
-// mlc_decl_typedef(image_valuedness_type);
-// mlc_decl_typedef(image_rawness_type);
// --------------------------------------------------------------------
// ------------------------------ //
Index: oln/core/image_entry.hh
--- oln/core/image_entry.hh (revision 551)
+++ oln/core/image_entry.hh (working copy)
@@ -56,17 +56,19 @@
typedef mlc::undefined topo_type;
typedef mlc::undefined grid_type;
- // psite_type: see below
+ // psite_type: see below.
typedef mlc::undefined point_type;
- // piter_type: see below
+ // piter_type: see below.
typedef mlc::undefined fwd_piter_type;
typedef mlc::undefined bkd_piter_type;
typedef mlc::undefined value_type;
- // rvalue_type: see below
+ // rvalue_type: see below.
typedef mlc::undefined concrete_type;
+
+ // morpher_type: see below.
};
@@ -90,6 +92,15 @@
typedef oln_type_of(E, value) ret;
};
+ /// \brief Morpher type.
+ ///
+ /// Optionally contains a tag indicating a kind of morpher.
+ template <typename E>
+ struct single_vtype< image_entry<E>, typedef_::morpher_type >
+ {
+ typedef mlc::none ret;
+ };
+
} // end of namespace oln
Index: oln/core/abstract/image.hh
--- oln/core/abstract/image.hh (revision 551)
+++ oln/core/abstract/image.hh (working copy)
@@ -77,6 +77,8 @@
stc_virtual_typedef(concrete);
+ stc_virtual_typedef(morpher);
+
decl() {
// FIXME: ...
}
Index: oln/core/abstract/topology_hierarchies.hh
--- oln/core/abstract/topology_hierarchies.hh (revision 551)
+++ oln/core/abstract/topology_hierarchies.hh (working copy)
@@ -40,10 +40,10 @@
} // end of namespace oln
-// hierarchy 1: topology wrt accessibility
+// Hierarchy 1: topology w.r.t. accessibility.
# include <oln/core/abstract/topology_being_random_accessible.hh>
-// hierarchy 2: topology wrt bbox
+// Hierarchy 2: topology w.r.t. bbox.
# include <oln/core/abstract/topology_having_bbox.hh>
Index: oln/core/abstract/image_type.hh
--- oln/core/abstract/image_type.hh (revision 551)
+++ oln/core/abstract/image_type.hh (working copy)
@@ -232,7 +232,7 @@
/// Binary case.
template <typename E>
- struct case_< image_type_hierarchy, E, 1 > :
+ struct case_< image_hierarchy_wrt_type, E, 1 > :
where_< mlc::eq_< oln_type_of(E, value), bool > >
{
// Definition of the super class corresponding to this case.
@@ -241,7 +241,7 @@
/// Grey-level case.
template <typename E>
- struct case_< image_type_hierarchy, E, 2 > :
+ struct case_< image_hierarchy_wrt_type, E, 2 > :
where_< mlc::or_list_< mlc::eq_<oln_type_of(E, value), char>,
mlc::eq_<oln_type_of(E, value), signed char>,
mlc::eq_<oln_type_of(E, value), unsigned char> > >
@@ -259,7 +259,7 @@
/// Default case: image of ``data''.
template <typename E>
- struct default_case_< image_type_hierarchy, E >
+ struct default_case_< image_hierarchy_wrt_type, E >
{
// Definition of the super class corresponding to this case
// (abstract::data_image_ is the conjunction of
Index: oln/core/abstract/image_dimension.hh
--- oln/core/abstract/image_dimension.hh (revision 551)
+++ oln/core/abstract/image_dimension.hh (working copy)
@@ -51,7 +51,7 @@
o
|
- /switch_<image_dimension_hierarchy, I>::ret/
+ /switch_<image_hierarchy_wrt_dimension, I>::ret/
(image dimension selector)
^
|
@@ -81,7 +81,9 @@
/// Class of 1-D images.
template <typename E>
- struct image1d : public virtual image<E>
+ struct image1d :
+ public virtual image<E>,
+ public automatic::impl< image1d, oln_type_of(E, morpher), E>
{
protected:
/// Constructor (protected, empty).
@@ -90,7 +92,9 @@
/// Class of 2-D images.
template <typename E>
- struct image2d : public virtual image<E>
+ struct image2d :
+ public virtual image<E>,
+ public automatic::impl< image2d, oln_type_of(E, morpher), E>
{
protected:
/// Constructor (protected, empty).
@@ -99,7 +103,9 @@
/// Class of 3-D images.
template <typename E>
- struct image3d : public virtual image<E>
+ struct image3d :
+ public virtual image<E>,
+ public automatic::impl< image3d, oln_type_of(E, morpher), E>
{
protected:
/// Constructor (protected, empty).
@@ -125,7 +131,7 @@
/// 1-D case.
template <typename E>
- struct case_< image_dimension_hierarchy, E, 1 > :
+ struct case_< image_hierarchy_wrt_dimension, E, 1 > :
where_< mlc::eq_< oln_type_of(E, grid), oln::grid1d > >
{
typedef abstract::image1d<E> ret;
@@ -133,7 +139,7 @@
/// 2-D case.
template <typename E>
- struct case_< image_dimension_hierarchy, E, 2 > :
+ struct case_< image_hierarchy_wrt_dimension, E, 2 > :
where_< mlc::eq_< oln_type_of(E, grid), oln::grid2d > >
{
typedef abstract::image2d<E> ret;
@@ -141,7 +147,7 @@
/// 3-D case.
template <typename E>
- struct case_< image_dimension_hierarchy, E, 3 > :
+ struct case_< image_hierarchy_wrt_dimension, E, 3 > :
where_< mlc::eq_< oln_type_of(E, grid), oln::grid3d > >
{
typedef abstract::image3d<E> ret;
Index: oln/core/abstract/image_hierarchies.hh
--- oln/core/abstract/image_hierarchies.hh (revision 551)
+++ oln/core/abstract/image_hierarchies.hh (working copy)
@@ -34,24 +34,29 @@
namespace oln
{
- typedef hierarchy<abstract::image, 1> image_dimension_hierarchy;
- typedef hierarchy<abstract::image, 2> image_type_hierarchy;
+ typedef hierarchy<abstract::image, 1> image_hierarchy_wrt_dimension;
+ typedef hierarchy<abstract::image, 2> image_hierarchy_wrt_type;
+ typedef hierarchy<abstract::image, 3> image_hierarchy_wrt_neighborhood;
// FIXME: To be continued.
#if 0
- typedef hierarchy<abstract::image, 3> image_value_hierarchy;
- // FIXME: Rename (``rawness'' means ``crudit�'' in French...).
- typedef hierarchy<abstract::image, 4> image_rawness_hierarchy;
- typedef hierarchy<abstract::image, 5> image_neighborhood_hierarchy;
+ typedef hierarchy<abstract::image, 4> image_hierarchy_wrt_value;
+ typedef hierarchy<abstract::image, 5> image_hierarchy_wrt_data_retrieval;
// ...
#endif
} // end of namespace oln
+// Hierarchy 1: topology w.r.t. dimension.
# include <oln/core/abstract/image_dimension.hh>
+
+// Hierarchy 2: topology w.r.t. type of data.
# include <oln/core/abstract/image_type.hh>
+// Hierarchy 3: topology w.r.t. neighborhood.
+# include <oln/core/abstract/image_having_neighborhood.hh>
+
#endif // ! OLENA_CORE_ABSTRACT_IMAGE_HIERARCHIES_HH
Index: oln/core/abstract/image_type_integre.hh
--- oln/core/abstract/image_type_integre.hh (revision 551)
+++ oln/core/abstract/image_type_integre.hh (working copy)
@@ -96,7 +96,7 @@
/// Binary case.
template <typename E>
- struct case_< image_type_hierarchy, E, 3 > :
+ struct case_< image_hierarchy_wrt_type, E, 3 > :
where_< mlc::or_list_< mlc::eq_<oln_type_of(E, value), ntg::bin>,
ntg::eq_<ntg::int_u, 1, oln_type_of(E, value)>,
ntg::eq_<ntg::int_s, 1, oln_type_of(E, value)> > >
@@ -107,7 +107,7 @@
/// Grey-level case.
template <typename E>
- struct case_< image_type_hierarchy, E, 4 > :
+ struct case_< image_hierarchy_wrt_type, E, 4 > :
where_< mlc_is_a( mlc_comma_1(oln_type_of(E, value)), ntg::real_value ) >
{
// Definition of the super class corresponding to this case
@@ -118,7 +118,7 @@
/// Label case.
template <typename E>
- struct case_< image_type_hierarchy, E, 5 > :
+ struct case_< image_hierarchy_wrt_type, E, 5 > :
where_< mlc_is_a( mlc_comma_1(oln_type_of(E, value)), ntg::enum_value ) >
{
// Definition of the super class corresponding to this case
@@ -129,7 +129,7 @@
/// Color case.
template <typename E>
- struct case_< image_type_hierarchy, E, 6 > :
+ struct case_< image_hierarchy_wrt_type, E, 6 > :
where_< mlc_is_a( mlc_comma_1(oln_type_of(E, value)), ntg::color_value ) >
{
// Definition of the super class corresponding to this case
Index: oln/core/abstract/image_having_neighborhood.hh
--- oln/core/abstract/image_having_neighborhood.hh (revision 0)
+++ oln/core/abstract/image_having_neighborhood.hh (revision 0)
@@ -0,0 +1,101 @@
+// 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 OLENA_CORE_ABSTRACT_IMAGE_HAVING_NEIGHBORHOOD_HH
+# define OLENA_CORE_ABSTRACT_IMAGE_HAVING_NEIGHBORHOOD_HH
+
+# include <oln/core/abstract/image.hh>
+
+
+/* Image having neighborhood hierarchy (summary).
+
+
+FIXME: TODO!
+
+
+ Default case: If the neighborhood type returned by
+ `oln_type_of(I, neighborhood)', the entry is directly plugged to
+ abstract::image<I>. */
+
+
+namespace oln
+{
+
+ /*-------------------------.
+ | Dimension abstractions. |
+ `-------------------------*/
+
+ namespace abstract
+ {
+
+ /// Class of 1-D images.
+ template <typename E>
+ struct image_having_neighborhood :
+ public virtual image<E>,
+ public automatic::impl< image_having_neighborhood,
+ oln_type_of(E, morpher),
+ E >
+ {
+ protected:
+ /// Constructor (protected, empty).
+ image_having_neighborhood() {}
+ };
+
+ } // end of namespace oln::abstract
+
+
+ /*-------------------.
+ | Dimension switch. |
+ `-------------------*/
+
+ /// With neig
+ template <typename E>
+ struct case_< image_hierarchy_wrt_neighborhood, E, 1 > :
+ where_< mlc::neq_< oln_type_of(E, neighborhood), mlc::none > >
+ {
+ typedef abstract::image_having_neighborhood<E> ret;
+ };
+
+
+ /*-----------------.
+ | External vtype. |
+ `-----------------*/
+
+ // Forward declaration.
+ template <typename E> struct image_entry;
+
+ /// Neighborhood type, as extended virtual type.
+ template <typename E>
+ struct ext_vtype < image_entry<E>, typedef_::neighborhood_type >
+ {
+ typedef mlc::none ret;
+ };
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_HAVING_NEIGHBORHOOD_HH
Index: oln/Makefile.am
--- oln/Makefile.am (revision 551)
+++ oln/Makefile.am (working copy)
@@ -3,6 +3,8 @@
olndir = $(includedir)/oln
nobase_oln_HEADERS = \
+ automatic/image_having_neighborhood.hh \
+ \
core/1d/grid1d.hh \
\
core/2d/grid2d.hh \
@@ -19,42 +21,49 @@
core/abstract/any.hh \
core/abstract/bbox.hh \
core/abstract/dpoint.hh \
- core/abstract/dpoint_nd.hh \
core/abstract/entry.hh \
core/abstract/grid.hh \
- core/abstract/image_dimension.hh \
core/abstract/image.hh \
+ core/abstract/image_dimension.hh \
+ core/abstract/image_having_neighborhood.hh \
core/abstract/image_hierarchies.hh \
core/abstract/image_type.hh \
core/abstract/image_type_integre.hh \
- core/abstract/iter.hh \
- core/abstract/piter.hh \
+ core/abstract/iterator.hh \
+ core/abstract/iterator_on_points.hh \
core/abstract/point.hh \
- core/abstract/point_nd.hh \
- core/abstract/pset_bboxed.hh \
- core/abstract/pset_cnx.hh \
- core/abstract/pset_fixed.hh \
- core/abstract/pset.hh \
- core/abstract/pset_hierarchies.hh \
- core/abstract/pset_ra.hh \
+ core/abstract/point_set.hh \
+ core/abstract/point_set_being_connected.hh \
+ core/abstract/point_set_being_random_accessible.hh \
+ core/abstract/point_set_having_bbox.hh \
+ core/abstract/point_set_having_known_size.hh \
+ core/abstract/point_set_hierarchies.hh \
core/abstract/topology.hh \
- core/abstract/topology_hierarchies.hh \
core/abstract/topology_being_random_accessible.hh \
core/abstract/topology_having_bbox.hh \
+ core/abstract/topology_hierarchies.hh \
\
core/gen/bbox.hh \
+ core/gen/bbox_bkd_piter.hh \
+ core/gen/bbox_fwd_piter.hh \
core/gen/topo_bbox.hh \
- core/gen/bkd_piter.hh \
- core/gen/fwd_piter.hh \
+ \
+ core/internal/dpoint_nd.hh \
+ core/internal/point_nd.hh \
\
core/case.hh \
core/image_entry.hh \
core/macros.hh \
- core/pset_entry.hh \
+ core/point_set_entry.hh \
core/traits.hh \
core/traits_id.hh \
core/topology_entry.hh \
core/typedefs.hh \
core/type.hh \
\
+ morpher/internal/image_extension.hh \
+ \
+ morpher/add_neighborhood.hh \
+ morpher/identity.hh \
+ \
basics2d.hh
Index: oln/morpher/identity.hh
--- oln/morpher/identity.hh (revision 0)
+++ oln/morpher/identity.hh (revision 0)
@@ -0,0 +1,97 @@
+// 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 OLENA_MORPHER_IDENTITY
+# define OLENA_MORPHER_IDENTITY
+
+# include <oln/morpher/internal/image_extension.hh>
+
+
+namespace oln
+{
+
+ namespace morpher
+ {
+ // Forward declaration.
+ template <typename Image>
+ struct identity;
+
+
+ namespace tag
+ {
+ /// Tag associated to oln::morpher::identity.
+ struct identity;
+
+ } // end of namespace oln::morpher::tag
+
+ } // end of namespace oln::morpher
+
+
+ /// Super type.
+ template <typename Image>
+ struct set_super_type< morpher::identity<Image> >
+ {
+ typedef morpher::identity<Image> self_t;
+ typedef morpher::internal::image_extension<Image, self_t> ret;
+ };
+
+
+ /// New virtual types associated with oln::morpher::identity.
+ /// \{
+ template <typename Image>
+ struct single_vtype < morpher::identity<Image>, typedef_::morpher_type >
+ {
+ typedef oln::morpher::tag::identity ret;
+ };
+ /// \}
+
+
+ namespace morpher
+ {
+ /// Identity morpher.
+ template <typename Image>
+ // FIXME:
+ class identity : public stc_get_supers(identity<Image>)
+ {
+ private:
+ typedef identity<Image> self_t;
+ typedef stc_get_nth_super(self_t, 1) super_t;
+
+ public:
+ // FIXME: Handle the constness.
+ identity(const Image& image) :
+ super_t(image)
+ {
+ }
+
+ };
+
+ } // end of namespace oln::morpher
+
+} // end of namespace oln
+
+#endif // ! OLENA_MORPHER_IDENTITY
Index: oln/morpher/internal/image_extension.hh
--- oln/morpher/internal/image_extension.hh (revision 0)
+++ oln/morpher/internal/image_extension.hh (revision 0)
@@ -0,0 +1,122 @@
+// 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 OLENA_MORPHER_INTERNAL_IMAGE_EXTENSION
+# define OLENA_MORPHER_INTERNAL_IMAGE_EXTENSION
+
+# include <oln/core/image_entry.hh>
+
+
+namespace oln
+{
+ namespace morpher
+ {
+ namespace internal
+ {
+
+ // Forward declaration.
+ template <typename Image, typename Exact>
+ struct image_extension;
+
+ } // end of namespace oln::morpher::internal
+
+ } // end of namespace oln::morpher
+
+
+ // FIXME: Use set_super_type instead?
+ /// Create an ``uplink'' from
+ /// oln::morpher::internal::image_extension to the morphed \a Image,
+ /// so as to get all its virtual types.
+ template <typename Image, typename Exact>
+ struct set_pseudosuper_type< morpher::internal::image_extension<Image,
+ Exact> >
+ {
+ typedef Image ret;
+ };
+
+
+ namespace morpher
+ {
+ namespace internal
+ {
+
+ /// Image_Extension morpher.
+ template <typename Image, typename Exact>
+ class image_extension :
+ public oln::image_entry< image_extension<Image, Exact> >
+ {
+ private:
+ typedef image_extension<Image, Exact> self_t;
+
+ /// Type of morphed image.
+ typedef Image image_t;
+
+ typedef oln_type_of(self_t, topo) topo_t;
+ typedef oln_type_of(self_t, value) value_t;
+ typedef oln_type_of(self_t, point) point_t;
+
+ public:
+ // FIXME: Handle the constness.
+ image_extension(const Image& image) :
+ image_(image)
+ {
+ }
+
+ const Image& delegate() const
+ {
+ return image_;
+ }
+
+ /// Delegations.
+ /// \{
+ const topo_t& impl_topo() const
+ {
+ return delegate()->impl_topo();
+ }
+
+ value_t impl_op_read(const point_t& p) const
+ {
+ return delegate()->impl_op_read(p);
+ }
+
+ bool impl_has(const point_t& p) const
+ {
+ return delegate()->impl_has(p);
+ }
+ /// \}
+
+ protected:
+ const Image& image_;
+ };
+
+ } // end of namespace oln::morpher::internal
+
+ } // end of namespace oln::morpher
+
+} // end of namespace oln
+
+#endif // ! OLENA_MORPHER_INTERNAL_IMAGE_EXTENSION
Index: oln/morpher/add_neighborhood.hh
--- oln/morpher/add_neighborhood.hh (revision 0)
+++ oln/morpher/add_neighborhood.hh (revision 0)
@@ -0,0 +1,130 @@
+// 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 OLENA_MORPHER_ADD_NEIGHBORHOOD
+# define OLENA_MORPHER_ADD_NEIGHBORHOOD
+
+# include <oln/morpher/internal/image_extension.hh>
+
+
+namespace oln
+{
+
+ namespace morpher
+ {
+ // Forward declaration.
+ template <typename Image>
+ struct add_neighborhood;
+
+ namespace tag
+ {
+ /// Tag associated to oln::morpher::add_neighborhood.
+ struct add_neighborhood;
+
+ } // end of namespace oln::morpher::tag
+
+ } // end of namespace oln::morpher
+
+
+ /// Super type.
+ template <typename Image>
+ struct set_super_type< morpher::add_neighborhood<Image> >
+ {
+ typedef morpher::add_neighborhood<Image> self_t;
+ typedef morpher::internal::image_extension<Image, self_t> ret;
+ };
+
+
+ /// New virtual types associated with oln::morpher::add_neighborhood.
+ /// \{
+ template <typename Image>
+ struct single_vtype < morpher::add_neighborhood<Image>,
+ typedef_::morpher_type >
+ {
+ typedef oln::morpher::tag::add_neighborhood ret;
+ };
+ /// \}
+
+
+ namespace morpher
+ {
+ /// Neighborhood addition morpher.
+ template <typename Image>
+ class add_neighborhood : public stc_get_supers(add_neighborhood<Image>)
+ {
+ private:
+ typedef add_neighborhood<Image> self_t;
+ typedef stc_get_nth_super(self_t, 1) super_t;
+ typedef oln_type_of(Image, neighborhood) neighborhood_t;
+
+ public:
+ // FIXME: Handle the constness.
+ add_neighborhood(const Image& image, const neighborhood_t& nbh) :
+ super_t(image), nbh_(nbh)
+ {
+ }
+
+ neighborhood_t impl_neighborhood() const
+ {
+ return nbh_;
+ }
+
+ protected:
+ neighborhood_t nbh_;
+ };
+
+ } // end of namespace oln::morpher
+
+} // end of namespace oln
+
+
+// FIXME: This is probably not the right place for this.
+// Where should we move this?
+#include <oln/core/abstract/image.hh>
+namespace oln
+{
+ /// Neighborhood-related definitions.
+ /// \{
+ // Forward declarations.
+ template <typename T> struct image2d;
+ struct neighborhood2d;
+ namespace morpher {
+ template <typename Image> struct add_neighborhood;
+ }
+
+ // External vtype.
+ template <typename T>
+ struct ext_vtype < morpher::add_neighborhood< oln::image2d<T> >,
+ typedef_::neighborhood_type >
+ {
+ typedef neighborhood2d ret;
+ };
+ /// \}
+}
+
+
+#endif // ! OLENA_MORPHER_ADD_NEIGHBORHOOD
2006-09-18 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Rename point set related classes.
* oln/core/pset_entry.hh: Update and rename as...
* oln/core/point_set_entry.hh: ...this.
* oln/core/abstract/pset_fixed.hh: Update and rename as...
* oln/core/abstract/point_set_having_known_size.hh: ...this.
* oln/core/abstract/pset_ra.hh: Update and rename as...
* oln/core/abstract/point_set_being_random_accessible.hh: ...this.
* oln/core/abstract/pset_bboxed.hh: Update and rename as...
* oln/core/abstract/point_set_having_bbox.hh: ...this.
* oln/core/abstract/pset.hh: Update and rename as...
* oln/core/abstract/point_set.hh: ...this.
* oln/core/abstract/pset_hierarchies.hh: Update and rename as...
* oln/core/abstract/point_set_hierarchies.hh: ...this.
* oln/core/abstract/pset_cnx.hh: Update and rename as...
* oln/core/abstract/point_set_being_connected.hh: ...this.
* oln/core/abstract/piter.hh: Update and rename as...
* oln/core/abstract/iterator_on_points.hh: ...this.
* oln/core/abstract/iter.hh: Update and rename as...
* oln/core/abstract/iterator.hh: ...this.
* oln/core/typedefs.hh
(fixed_type, ra_type, cnx_type): Rename as...
(has_known_size_type, is_random_accessible_type): ...these and...
(is_connected_type): ....this.
* oln/core/abstract/bbox.hh: Update.
* oln/core/gen/fwd_piter.hh: Update.
* oln/core/gen/bkd_piter.hh: Update.
Index: oln/core/typedefs.hh
===================================================================
--- oln/core/typedefs.hh (revision 548)
+++ oln/core/typedefs.hh (working copy)
@@ -99,14 +99,13 @@
// --------------------------------------------------------------------
- /*-----------------.
- | category::pset. |
- `------------------*/
+ /*----------------------.
+ | category::point_set. |
+ `-----------------------*/
- mlc_decl_typedef(fixed_type);
- mlc_decl_typedef(ra_type);
+ mlc_decl_typedef(has_known_size_type);
mlc_decl_typedef(is_random_accessible_type);
- mlc_decl_typedef(cnx_type);
+ mlc_decl_typedef(is_connected_type);
/*------------------.
Index: oln/core/point_set_entry.hh
===================================================================
--- oln/core/point_set_entry.hh (revision 547)
+++ oln/core/point_set_entry.hh (working copy)
@@ -25,11 +25,11 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef OLENA_CORE_PSET_ENTRY_HH
-# define OLENA_CORE_PSET_ENTRY_HH
+#ifndef OLENA_CORE_POINT_SET_ENTRY_HH
+# define OLENA_CORE_POINT_SET_ENTRY_HH
# include <oln/core/abstract/entry.hh>
-# include <oln/core/abstract/pset.hh>
+# include <oln/core/abstract/point_set.hh>
@@ -37,21 +37,21 @@
{
- /// Entry class for point sets: pset_entry<E> is an alias for
- /// entry< abstract::pset, E>.
+ /// Entry class for point sets: point_set_entry<E> is an alias for
+ /// entry< abstract::point_set, E>.
template <typename E>
- struct pset_entry : public entry< abstract::pset, E>
+ struct point_set_entry : public entry< abstract::point_set, E>
{
protected:
- pset_entry() {}
+ point_set_entry() {}
};
- /// Virtual types associated to pset_entry<E>.
+ /// Virtual types associated to point_set_entry<E>.
template <typename E>
- struct vtypes< pset_entry<E> >
+ struct vtypes< point_set_entry<E> >
{
typedef mlc::undefined point_type;
@@ -60,13 +60,13 @@
typedef mlc::undefined bkd_piter_type;
typedef mlc::none bbox_type;
- typedef mlc::undefined ra_type;
- typedef mlc::undefined fixed_type;
+ typedef mlc::undefined is_random_accessible_type;
+ typedef mlc::undefined has_known_size_type;
};
template <typename E>
- struct single_vtype< pset_entry<E>, typedef_::coord_type >
+ struct single_vtype< point_set_entry<E>, typedef_::coord_type >
{
typedef oln_type_of(E, point) P;
typedef oln_type_of(P, coord) ret;
@@ -74,7 +74,7 @@
template <typename E>
- struct single_vtype< pset_entry<E>, typedef_::grid_type >
+ struct single_vtype< point_set_entry<E>, typedef_::grid_type >
{
typedef oln_type_of(E, point) P;
typedef oln_type_of(P, grid) ret;
@@ -82,7 +82,7 @@
template <typename E>
- struct single_vtype< pset_entry<E>, typedef_::dim_type >
+ struct single_vtype< point_set_entry<E>, typedef_::dim_type >
{
typedef oln_type_of(E, point) P;
typedef oln_type_of(P, dim) ret;
@@ -90,7 +90,7 @@
template <typename E>
- struct single_vtype< pset_entry<E>, typedef_::piter_type >
+ struct single_vtype< point_set_entry<E>, typedef_::piter_type >
{
typedef oln_type_of(E, fwd_piter) ret;
};
@@ -99,4 +99,4 @@
} // end of namespace oln
-#endif // ! OLENA_CORE_PSET_ENTRY_HH
+#endif // ! OLENA_CORE_POINT_SET_ENTRY_HH
Index: oln/core/pset_entry.hh
===================================================================
--- oln/core/pset_entry.hh (revision 548)
+++ oln/core/pset_entry.hh (working copy)
@@ -1,102 +0,0 @@
-// Copyright (C) 2006 EPITA Research and Development Laboratory
-//
-// This file is part of the Olena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
-//
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-#ifndef OLENA_CORE_PSET_ENTRY_HH
-# define OLENA_CORE_PSET_ENTRY_HH
-
-# include <oln/core/abstract/entry.hh>
-# include <oln/core/abstract/pset.hh>
-
-
-
-namespace oln
-{
-
-
- /// Entry class for point sets: pset_entry<E> is an alias for
- /// entry< abstract::pset, E>.
-
- template <typename E>
- struct pset_entry : public entry< abstract::pset, E>
- {
- protected:
- pset_entry() {}
- };
-
-
- /// Virtual types associated to pset_entry<E>.
-
- template <typename E>
- struct vtypes< pset_entry<E> >
- {
- typedef mlc::undefined point_type;
-
- typedef mlc::undefined piter_type;
- typedef mlc::undefined fwd_piter_type;
- typedef mlc::undefined bkd_piter_type;
-
- typedef mlc::none bbox_type;
- typedef mlc::undefined ra_type;
- typedef mlc::undefined fixed_type;
- };
-
-
- template <typename E>
- struct single_vtype< pset_entry<E>, typedef_::coord_type >
- {
- typedef oln_type_of(E, point) P;
- typedef oln_type_of(P, coord) ret;
- };
-
-
- template <typename E>
- struct single_vtype< pset_entry<E>, typedef_::grid_type >
- {
- typedef oln_type_of(E, point) P;
- typedef oln_type_of(P, grid) ret;
- };
-
-
- template <typename E>
- struct single_vtype< pset_entry<E>, typedef_::dim_type >
- {
- typedef oln_type_of(E, point) P;
- typedef oln_type_of(P, dim) ret;
- };
-
-
- template <typename E>
- struct single_vtype< pset_entry<E>, typedef_::piter_type >
- {
- typedef oln_type_of(E, fwd_piter) ret;
- };
-
-
-} // end of namespace oln
-
-
-#endif // ! OLENA_CORE_PSET_ENTRY_HH
Index: oln/core/abstract/point_set_being_random_accessible.hh
===================================================================
--- oln/core/abstract/point_set_being_random_accessible.hh (revision 547)
+++ oln/core/abstract/point_set_being_random_accessible.hh (working copy)
@@ -25,10 +25,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef OLENA_CORE_ABSTRACT_PSET_RA_HH
-# define OLENA_CORE_ABSTRACT_PSET_RA_HH
+#ifndef OLENA_CORE_ABSTRACT_POINT_SET_BEING_RANDOM_ACCESSIBLE_HH
+# define OLENA_CORE_ABSTRACT_POINT_SET_BEING_RANDOM_ACCESSIBLE_HH
-# include <oln/core/abstract/pset.hh>
+# include <oln/core/abstract/point_set.hh>
@@ -40,7 +40,7 @@
template <typename E>
- class ra_pset : public virtual pset<E>
+ class point_set_being_random_accessible : public virtual point_set<E>
{
typedef oln_type_of(E, point) point_t;
@@ -52,7 +52,7 @@
}
protected:
- ra_pset()
+ point_set_being_random_accessible()
{}
};
@@ -61,14 +61,14 @@
template <typename E>
- struct case_ < pset_ra_hierarchy, E, 1 >
- : where_< mlc::eq_< oln_type_of(E, ra), mlc::true_ > >
+ struct case_ < point_set_hierarchy_wrt_accessibility, E, 1 >
+ : where_< mlc::eq_< oln_type_of(E, is_random_accessible), mlc::true_ > >
{
- typedef abstract::ra_pset<E> ret;
+ typedef abstract::point_set_being_random_accessible<E> ret;
};
} // end of namespace oln
-#endif // ! OLENA_CORE_ABSTRACT_PSET_RA_HH
+#endif // ! OLENA_CORE_ABSTRACT_POINT_SET_BEING_RANDOM_ACCESSIBLE_HH
Index: oln/core/abstract/pset_fixed.hh
===================================================================
--- oln/core/abstract/pset_fixed.hh (revision 548)
+++ oln/core/abstract/pset_fixed.hh (working copy)
@@ -1,73 +0,0 @@
-// Copyright (C) 2006 EPITA Research and Development Laboratory
-//
-// This file is part of the Olena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
-//
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-#ifndef OLENA_CORE_ABSTRACT_PSET_FIXED_HH
-# define OLENA_CORE_ABSTRACT_PSET_FIXED_HH
-
-# include <oln/core/abstract/pset.hh>
-
-
-
-namespace oln
-{
-
- namespace abstract
- {
-
-
- template <typename E>
- class fixed_pset : public virtual pset<E>
- {
- public:
-
- unsigned npoints() const
- {
- return this->exact().impl_npoints();
- }
-
- protected:
- fixed_pset()
- {}
- };
-
-
- } // end of namespace oln::abstract
-
-
- template <typename E>
- struct case_ < pset_fixed_hierarchy, E, 1 >
- : where_< mlc::eq_< oln_type_of(E, fixed), mlc::true_ > >
- {
- typedef abstract::fixed_pset<E> ret;
- };
-
-
-} // end of namespace oln
-
-
-#endif // ! OLENA_CORE_ABSTRACT_PSET_FIXED_HH
-
Index: oln/core/abstract/point_set_being_connected.hh
===================================================================
--- oln/core/abstract/point_set_being_connected.hh (revision 547)
+++ oln/core/abstract/point_set_being_connected.hh (working copy)
@@ -25,10 +25,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef OLENA_CORE_ABSTRACT_PSET_CNX_HH
-# define OLENA_CORE_ABSTRACT_PSET_CNX_HH
+#ifndef OLENA_CORE_ABSTRACT_POINT_SET_BEING_CONNECTED_HH
+# define OLENA_CORE_ABSTRACT_POINT_SET_BEING_CONNECTED_HH
-# include <oln/core/abstract/pset.hh>
+# include <oln/core/abstract/point_set.hh>
namespace oln
@@ -39,7 +39,7 @@
template <typename E>
- class cnx2d_pset : public virtual abstract::pset<E>
+ class point_set_being_2d_connected : public virtual abstract::point_set<E>
{
public:
@@ -57,7 +57,7 @@
protected:
- cnx2d_pset()
+ point_set_being_2d_connected()
{}
};
@@ -67,17 +67,16 @@
template <typename E>
- struct case_ < pset_cnx_hierarchy, E, 1 >
+ struct case_ < point_set_hierarchy_wrt_connectivity, E, 1 >
: where_< mlc::and_list_< mlc::neq_< oln_type_of(E, bbox), mlc::none >,
- mlc::eq_< oln_type_of(E, cnx), mlc::true_ >,
+ mlc::eq_< oln_type_of(E, is_connected), mlc::true_ >,
mlc::eq_< oln_type_of(E, grid), grid2d > > >
{
- typedef abstract::cnx2d_pset<E> ret;
+ typedef abstract::point_set_being_2d_connected<E> ret;
};
} // end of namespace oln
-#endif // ! OLENA_CORE_ABSTRACT_PSET_CNX_HH
-
+#endif // ! OLENA_CORE_ABSTRACT_POINT_SET_BEING_CONNECTED_HH
Index: oln/core/abstract/pset_ra.hh
===================================================================
--- oln/core/abstract/pset_ra.hh (revision 548)
+++ oln/core/abstract/pset_ra.hh (working copy)
@@ -1,74 +0,0 @@
-// Copyright (C) 2006 EPITA Research and Development Laboratory
-//
-// This file is part of the Olena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
-//
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-#ifndef OLENA_CORE_ABSTRACT_PSET_RA_HH
-# define OLENA_CORE_ABSTRACT_PSET_RA_HH
-
-# include <oln/core/abstract/pset.hh>
-
-
-
-namespace oln
-{
-
- namespace abstract
- {
-
-
- template <typename E>
- class ra_pset : public virtual pset<E>
- {
- typedef oln_type_of(E, point) point_t;
-
- public:
-
- bool has(const point_t& p) const
- {
- return this->exact().impl_has(p);
- }
-
- protected:
- ra_pset()
- {}
- };
-
-
- } // end of namespace oln::abstract
-
-
- template <typename E>
- struct case_ < pset_ra_hierarchy, E, 1 >
- : where_< mlc::eq_< oln_type_of(E, ra), mlc::true_ > >
- {
- typedef abstract::ra_pset<E> ret;
- };
-
-
-} // end of namespace oln
-
-
-#endif // ! OLENA_CORE_ABSTRACT_PSET_RA_HH
Index: oln/core/abstract/pset_bboxed.hh
===================================================================
--- oln/core/abstract/pset_bboxed.hh (revision 548)
+++ oln/core/abstract/pset_bboxed.hh (working copy)
@@ -1,111 +0,0 @@
-// Copyright (C) 2006 EPITA Research and Development Laboratory
-//
-// This file is part of the Olena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
-//
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-#ifndef OLENA_CORE_ABSTRACT_PSET_BBOXED_HH
-# define OLENA_CORE_ABSTRACT_PSET_BBOXED_HH
-
-# include <oln/core/abstract/pset.hh>
-
-
-namespace oln
-{
-
- namespace abstract
- {
-
-
- template <typename E>
- class bboxed_pset : public virtual pset<E>
- {
- typedef oln_type_of(E, point) point_t;
- typedef oln_type_of(E, bbox) bbox_t;
-
- typedef oln_type_of(point_t, coord) coord_t;
- typedef oln_type_of(point_t, dim) dim_t;
- enum { n = mlc_value(dim_t) };
-
- public:
-
- const bbox_t& bbox() const
- {
- return this->exact().impl_box();
- }
-
- const point_t& pmin() const
- {
- precondition(this->is_valid());
- return pmin_;
- }
-
- coord_t pmin(unsigned i) const
- {
- precondition(this->is_valid() and i < n);
- return pmin_[i];
- }
-
- const point_t& pmax() const
- {
- precondition(this->is_valid());
- return pmax_;
- }
-
- coord_t pmax(unsigned i) const
- {
- precondition(this->is_valid() and i < n);
- return pmax_[i];
- }
-
- unsigned len(unsigned i) const
- {
- precondition(this->is_valid() and i < n);
- return pmax_[i] - pmin_[i] + 1;
- }
-
- protected:
-
- bboxed_pset()
- {}
-
- point_t pmin_, pmax_;
- };
-
-
- } // end of namespace oln::abstract
-
-
- template <typename E>
- struct case_ < pset_bboxed_hierarchy, E, 1 >
- : where_< mlc::neq_< oln_type_of(E, bbox), mlc::none > >
- {
- typedef abstract::bboxed_pset<E> ret;
- };
-
-
-} // end of namespace oln
-
-
-#endif // ! OLENA_CORE_ABSTRACT_PSET_BBOXED_HH
Index: oln/core/abstract/point_set.hh
===================================================================
--- oln/core/abstract/point_set.hh (revision 547)
+++ oln/core/abstract/point_set.hh (working copy)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef OLENA_CORE_ABSTRACT_PSET_HH
-# define OLENA_CORE_ABSTRACT_PSET_HH
+#ifndef OLENA_CORE_ABSTRACT_POINT_SET_HH
+# define OLENA_CORE_ABSTRACT_POINT_SET_HH
# include <oln/core/typedefs.hh>
@@ -40,8 +40,8 @@
/// Abstract point class.
template <typename E>
- class pset : public virtual stc::any__simple<E>,
- public virtual oln::type
+ class point_set : public virtual stc::any__simple<E>,
+ public virtual oln::type
{
public:
@@ -58,10 +58,10 @@
stc_virtual_typedef(fwd_piter);
stc_virtual_typedef(bkd_piter);
- stc_virtual_typedef(bbox); // for being bboxed; provides .bbox()
- stc_virtual_typedef(ra); // for random access; provides .has(p)
- stc_virtual_typedef(fixed); // for fixed size; provides .npoints()
- stc_virtual_typedef(cnx); // for connected; provides, e.g., .nrows()
+ stc_virtual_typedef(bbox); // provides .bbox()
+ stc_virtual_typedef(is_random_accessible); // provides .has(p)
+ stc_virtual_typedef(has_known_size); // provides .npoints()
+ stc_virtual_typedef(is_connected); // provides, e.g., .nrows()
// derived from point:
stc_virtual_typedef(coord);
@@ -79,12 +79,12 @@
protected:
- pset()
+ point_set()
{}
- ~pset() { decl(); }
+ ~point_set() { decl(); }
- }; // end of class oln::abstract::pset<E>
+ }; // end of class oln::abstract::point_set<E>
@@ -94,8 +94,8 @@
-# include <oln/core/abstract/pset_hierarchies.hh>
+# include <oln/core/abstract/point_set_hierarchies.hh>
-#endif // ! OLENA_CORE_ABSTRACT_PSET_HH
+#endif // ! OLENA_CORE_ABSTRACT_POINT_SET_HH
Index: oln/core/abstract/point_set_having_bbox.hh
===================================================================
--- oln/core/abstract/point_set_having_bbox.hh (revision 547)
+++ oln/core/abstract/point_set_having_bbox.hh (working copy)
@@ -25,10 +25,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef OLENA_CORE_ABSTRACT_PSET_BBOXED_HH
-# define OLENA_CORE_ABSTRACT_PSET_BBOXED_HH
+#ifndef OLENA_CORE_ABSTRACT_POINT_SET_HAVING_BBOX_HH
+# define OLENA_CORE_ABSTRACT_POINT_SET_HAVING_BBOX_HH
-# include <oln/core/abstract/pset.hh>
+# include <oln/core/abstract/point_set.hh>
namespace oln
@@ -39,7 +39,7 @@
template <typename E>
- class bboxed_pset : public virtual pset<E>
+ class point_set_having_bbox : public virtual point_set<E>
{
typedef oln_type_of(E, point) point_t;
typedef oln_type_of(E, bbox) bbox_t;
@@ -87,7 +87,7 @@
protected:
- bboxed_pset()
+ point_set_having_bbox()
{}
point_t pmin_, pmax_;
@@ -98,14 +98,14 @@
template <typename E>
- struct case_ < pset_bboxed_hierarchy, E, 1 >
+ struct case_ < point_set_hierarchy_wrt_bbox, E, 1 >
: where_< mlc::neq_< oln_type_of(E, bbox), mlc::none > >
{
- typedef abstract::bboxed_pset<E> ret;
+ typedef abstract::point_set_having_bbox<E> ret;
};
} // end of namespace oln
-#endif // ! OLENA_CORE_ABSTRACT_PSET_BBOXED_HH
+#endif // ! OLENA_CORE_ABSTRACT_POINT_SET_HAVING_BBOX_HH
Index: oln/core/abstract/point_set_hierarchies.hh
===================================================================
--- oln/core/abstract/point_set_hierarchies.hh (revision 547)
+++ oln/core/abstract/point_set_hierarchies.hh (working copy)
@@ -25,29 +25,29 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef OLENA_CORE_ABSTRACT_PSET_HIERARCHIES_HH
-# define OLENA_CORE_ABSTRACT_PSET_HIERARCHIES_HH
+#ifndef OLENA_CORE_ABSTRACT_POINT_SET_HIERARCHIES_HH
+# define OLENA_CORE_ABSTRACT_POINT_SET_HIERARCHIES_HH
-# include <oln/core/abstract/pset.hh>
+# include <oln/core/abstract/point_set.hh>
namespace oln
{
- typedef hierarchy< abstract::pset, 1 > pset_fixed_hierarchy;
- typedef hierarchy< abstract::pset, 2 > pset_ra_hierarchy;
- typedef hierarchy< abstract::pset, 3 > pset_bboxed_hierarchy;
- typedef hierarchy< abstract::pset, 4 > pset_cnx_hierarchy;
+ typedef hierarchy< abstract::point_set, 1 > point_set_hierarchy_wrt_known_size;
+ typedef hierarchy< abstract::point_set, 2 > point_set_hierarchy_wrt_accessibility;
+ typedef hierarchy< abstract::point_set, 3 > point_set_hierarchy_wrt_bbox;
+ typedef hierarchy< abstract::point_set, 4 > point_set_hierarchy_wrt_connectivity;
} // end of namespace oln
-# include <oln/core/abstract/pset_fixed.hh>
-# include <oln/core/abstract/pset_ra.hh>
-# include <oln/core/abstract/pset_bboxed.hh>
-# include <oln/core/abstract/pset_cnx.hh>
+# include <oln/core/abstract/point_set_having_known_size.hh>
+# include <oln/core/abstract/point_set_being_random_accessible.hh>
+# include <oln/core/abstract/point_set_having_bbox.hh>
+# include <oln/core/abstract/point_set_being_connected.hh>
-#endif // ! OLENA_CORE_ABSTRACT_PSET_HIERARCHIES_HH
+#endif // ! OLENA_CORE_ABSTRACT_POINT_SET_HIERARCHIES_HH
Index: oln/core/abstract/pset.hh
===================================================================
--- oln/core/abstract/pset.hh (revision 548)
+++ oln/core/abstract/pset.hh (working copy)
@@ -1,101 +0,0 @@
-// Copyright (C) 2006 EPITA Research and Development Laboratory
-//
-// This file is part of the Olena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
-//
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-#ifndef OLENA_CORE_ABSTRACT_PSET_HH
-# define OLENA_CORE_ABSTRACT_PSET_HH
-
-# include <oln/core/typedefs.hh>
-
-
-namespace oln
-{
-
- namespace abstract
- {
-
-
- /// Abstract point class.
- template <typename E>
- class pset : public virtual stc::any__simple<E>,
- public virtual oln::type
- {
- public:
-
- bool is_valid() const
- {
- return this->exact().impl_is_valid();
- }
-
- struct decl
- {
- stc_virtual_typedef(point);
-
- stc_virtual_typedef(piter);
- stc_virtual_typedef(fwd_piter);
- stc_virtual_typedef(bkd_piter);
-
- stc_virtual_typedef(bbox); // for being bboxed; provides .bbox()
- stc_virtual_typedef(ra); // for random access; provides .has(p)
- stc_virtual_typedef(fixed); // for fixed size; provides .npoints()
- stc_virtual_typedef(cnx); // for connected; provides, e.g., .nrows()
-
- // derived from point:
- stc_virtual_typedef(coord);
- stc_virtual_typedef(grid);
- stc_virtual_typedef(dim);
-
- decl() {
- // coherence check:
- mlc::assert_equal_< oln_type_of(fwd_piter, grid),
- oln_type_of(point, grid) >::check();
- mlc::assert_equal_< oln_type_of(bkd_piter, grid),
- oln_type_of(point, grid) >::check();
- }
- };
-
- protected:
-
- pset()
- {}
-
- ~pset() { decl(); }
-
- }; // end of class oln::abstract::pset<E>
-
-
-
- } // end of namespace oln::abstract
-
-} // end of namespace oln
-
-
-
-# include <oln/core/abstract/pset_hierarchies.hh>
-
-
-
-#endif // ! OLENA_CORE_ABSTRACT_PSET_HH
Index: oln/core/abstract/iterator_on_points.hh
===================================================================
--- oln/core/abstract/iterator_on_points.hh (revision 547)
+++ oln/core/abstract/iterator_on_points.hh (working copy)
@@ -26,10 +26,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef OLENA_CORE_ABSTRACT_PITER_HH
-# define OLENA_CORE_ABSTRACT_PITER_HH
+#ifndef OLENA_CORE_ABSTRACT_ITERATOR_ON_POINTS_HH
+# define OLENA_CORE_ABSTRACT_ITERATOR_ON_POINTS_HH
-# include <oln/core/abstract/iter.hh>
+# include <oln/core/abstract/iterator.hh>
# include <oln/core/abstract/point.hh>
@@ -38,20 +38,20 @@
// Forward declaration.
- namespace abstract { template <typename E> class piter; }
+ namespace abstract { template <typename E> class iterator_on_points; }
// Super type declaration.
template <typename E>
- struct set_super_type< abstract::piter<E> >
+ struct set_super_type< abstract::iterator_on_points<E> >
{
- typedef abstract::iter<E> ret;
+ typedef abstract::iterator<E> ret;
};
- /// Virtual types associated to abstract::piter<E>.
+ /// Virtual types associated to abstract::iterator_on_points<E>.
template <typename E>
- struct vtypes< abstract::piter<E> >
+ struct vtypes< abstract::iterator_on_points<E> >
{
typedef mlc::undefined point_type;
};
@@ -62,7 +62,7 @@
/// Abstract point iterator class.
template <typename E>
- class piter : public abstract::iter<E>
+ class iterator_on_points : public abstract::iterator<E>
{
typedef oln_type_of(E, point) point_t;
@@ -84,17 +84,17 @@
point_t p_;
- piter()
+ iterator_on_points()
{
}
- ~piter()
+ ~iterator_on_points()
{
mlc::assert_defined_< point_t >::check();
mlc::assert_< mlc_is_a(point_t, abstract::point) >::check();
}
- }; // end of class oln::abstract::piter<E>
+ }; // end of class oln::abstract::iterator_on_points<E>
} // end of namespace oln::abstract
@@ -103,4 +103,4 @@
} // end of namespace oln
-#endif // ! OLENA_CORE_ABSTRACT_PITER_HH
+#endif // ! OLENA_CORE_ABSTRACT_ITERATOR_ON_POINTS_HH
Index: oln/core/abstract/pset_hierarchies.hh
===================================================================
--- oln/core/abstract/pset_hierarchies.hh (revision 548)
+++ oln/core/abstract/pset_hierarchies.hh (working copy)
@@ -1,53 +0,0 @@
-// Copyright (C) 2006 EPITA Research and Development Laboratory
-//
-// This file is part of the Olena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
-//
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-#ifndef OLENA_CORE_ABSTRACT_PSET_HIERARCHIES_HH
-# define OLENA_CORE_ABSTRACT_PSET_HIERARCHIES_HH
-
-# include <oln/core/abstract/pset.hh>
-
-
-namespace oln
-{
-
- typedef hierarchy< abstract::pset, 1 > pset_fixed_hierarchy;
- typedef hierarchy< abstract::pset, 2 > pset_ra_hierarchy;
- typedef hierarchy< abstract::pset, 3 > pset_bboxed_hierarchy;
- typedef hierarchy< abstract::pset, 4 > pset_cnx_hierarchy;
-
-} // end of namespace oln
-
-
-# include <oln/core/abstract/pset_fixed.hh>
-# include <oln/core/abstract/pset_ra.hh>
-# include <oln/core/abstract/pset_bboxed.hh>
-# include <oln/core/abstract/pset_cnx.hh>
-
-
-
-#endif // ! OLENA_CORE_ABSTRACT_PSET_HIERARCHIES_HH
-
Index: oln/core/abstract/pset_cnx.hh
===================================================================
--- oln/core/abstract/pset_cnx.hh (revision 548)
+++ oln/core/abstract/pset_cnx.hh (working copy)
@@ -1,83 +0,0 @@
-// Copyright (C) 2006 EPITA Research and Development Laboratory
-//
-// This file is part of the Olena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
-//
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-#ifndef OLENA_CORE_ABSTRACT_PSET_CNX_HH
-# define OLENA_CORE_ABSTRACT_PSET_CNX_HH
-
-# include <oln/core/abstract/pset.hh>
-
-
-namespace oln
-{
-
- namespace abstract
- {
-
-
- template <typename E>
- class cnx2d_pset : public virtual abstract::pset<E>
- {
- public:
-
- unsigned nrows() const
- {
- precondition(this->is_valid());
- return this->exact().len(0);
- }
-
- unsigned ncols() const
- {
- precondition(this->is_valid());
- return this->exact().len(1);
- }
-
- protected:
-
- cnx2d_pset()
- {}
- };
-
-
- } // end of namespace oln::abstract
-
-
-
- template <typename E>
- struct case_ < pset_cnx_hierarchy, E, 1 >
- : where_< mlc::and_list_< mlc::neq_< oln_type_of(E, bbox), mlc::none >,
- mlc::eq_< oln_type_of(E, cnx), mlc::true_ >,
- mlc::eq_< oln_type_of(E, grid), grid2d > > >
- {
- typedef abstract::cnx2d_pset<E> ret;
- };
-
-
-} // end of namespace oln
-
-
-#endif // ! OLENA_CORE_ABSTRACT_PSET_CNX_HH
-
Index: oln/core/abstract/piter.hh
===================================================================
--- oln/core/abstract/piter.hh (revision 548)
+++ oln/core/abstract/piter.hh (working copy)
@@ -1,106 +0,0 @@
-// Copyright (C) 2001, 2003, 2004, 2005, 2006 EPITA Research and
-// Development Laboratory
-//
-// This file is part of the Olena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
-//
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-#ifndef OLENA_CORE_ABSTRACT_PITER_HH
-# define OLENA_CORE_ABSTRACT_PITER_HH
-
-# include <oln/core/abstract/iter.hh>
-# include <oln/core/abstract/point.hh>
-
-
-namespace oln
-{
-
-
- // Forward declaration.
- namespace abstract { template <typename E> class piter; }
-
-
- // Super type declaration.
- template <typename E>
- struct set_super_type< abstract::piter<E> >
- {
- typedef abstract::iter<E> ret;
- };
-
-
- /// Virtual types associated to abstract::piter<E>.
- template <typename E>
- struct vtypes< abstract::piter<E> >
- {
- typedef mlc::undefined point_type;
- };
-
-
- namespace abstract
- {
-
- /// Abstract point iterator class.
- template <typename E>
- class piter : public abstract::iter<E>
- {
- typedef oln_type_of(E, point) point_t;
-
- public:
-
- operator point_t() const
- {
- precondition(this->is_valid());
- return p_;
- }
-
- point_t to_point() const
- {
- precondition(this->is_valid());
- return p_;
- }
-
- protected:
-
- point_t p_;
-
- piter()
- {
- }
-
- ~piter()
- {
- mlc::assert_defined_< point_t >::check();
- mlc::assert_< mlc_is_a(point_t, abstract::point) >::check();
- }
-
- }; // end of class oln::abstract::piter<E>
-
-
- } // end of namespace oln::abstract
-
-
-} // end of namespace oln
-
-
-#endif // ! OLENA_CORE_ABSTRACT_PITER_HH
Index: oln/core/abstract/iterator.hh
===================================================================
--- oln/core/abstract/iterator.hh (revision 547)
+++ oln/core/abstract/iterator.hh (working copy)
@@ -26,8 +26,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef OLENA_CORE_ABSTRACT_ITER_HH
-# define OLENA_CORE_ABSTRACT_ITER_HH
+#ifndef OLENA_CORE_ABSTRACT_ITERATOR_HH
+# define OLENA_CORE_ABSTRACT_ITERATOR_HH
# include <oln/core/typedefs.hh>
@@ -41,8 +41,8 @@
/// Abstract iterator class.
template <typename E>
- class iter : public stc::any__best_memory<E>,
- public oln::type
+ class iterator : public stc::any__best_memory<E>,
+ public oln::type
{
public:
@@ -69,11 +69,11 @@
protected:
- iter()
+ iterator()
{
}
- }; // end of class oln::abstract::iter<E>
+ }; // end of class oln::abstract::iterator<E>
} // end of namespace oln::abstract
@@ -85,4 +85,4 @@
#define for_all(i) for (i.start(); i.is_valid(); i.next())
-#endif // ! OLENA_CORE_ABSTRACT_ITER_HH
+#endif // ! OLENA_CORE_ABSTRACT_ITERATOR_HH
Index: oln/core/abstract/bbox.hh
===================================================================
--- oln/core/abstract/bbox.hh (revision 548)
+++ oln/core/abstract/bbox.hh (working copy)
@@ -29,7 +29,7 @@
#ifndef OLENA_CORE_ABSTRACT_BBOX_HH
# define OLENA_CORE_ABSTRACT_BBOX_HH
-# include <oln/core/pset_entry.hh>
+# include <oln/core/point_set_entry.hh>
namespace oln
@@ -43,7 +43,7 @@
template <typename E>
struct set_super_type< abstract::bbox<E> >
{
- typedef pset_entry<E> ret;
+ typedef point_set_entry<E> ret;
};
@@ -51,9 +51,9 @@
template <typename E>
struct vtypes< abstract::bbox<E> >
{
- typedef mlc::true_ ra_type;
- typedef mlc::true_ fixed_type;
- typedef mlc::true_ cnx_type;
+ typedef mlc::true_ is_random_accessible_type;
+ typedef mlc::true_ has_know_size_type;
+ typedef mlc::true_ is_connected_type;
typedef E bbox_type;
};
@@ -63,7 +63,7 @@
/// Abstract bbox (bounding box) class.
template <typename E>
- class bbox : public pset_entry<E>
+ class bbox : public point_set_entry<E>
{
typedef oln_type_of(E, point) point_t;
Index: oln/core/abstract/iter.hh
===================================================================
--- oln/core/abstract/iter.hh (revision 548)
+++ oln/core/abstract/iter.hh (working copy)
@@ -1,88 +0,0 @@
-// Copyright (C) 2001, 2003, 2004, 2005, 2006 EPITA Research and
-// Development Laboratory
-//
-// This file is part of the Olena Library. This library is free
-// software; you can redistribute it and/or modify it under the terms
-// of the GNU General Public License version 2 as published by the
-// Free Software Foundation.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this library; see the file COPYING. If not, write to
-// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02111-1307, USA.
-//
-// As a special exception, you may use this file as part of a free
-// software library without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to
-// produce an executable, this file does not by itself cause the
-// resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
-
-#ifndef OLENA_CORE_ABSTRACT_ITER_HH
-# define OLENA_CORE_ABSTRACT_ITER_HH
-
-# include <oln/core/typedefs.hh>
-
-
-namespace oln
-{
-
-
- namespace abstract
- {
-
- /// Abstract iterator class.
- template <typename E>
- class iter : public stc::any__best_memory<E>,
- public oln::type
- {
- public:
-
- void start()
- {
- this->exact().impl_start();
- }
-
- void next()
- {
- precondition(this->is_valid());
- this->exact().impl_next();
- }
-
- void invalidate()
- {
- this->exact().impl_invalidate();
- }
-
- bool is_valid() const
- {
- return this->exact().impl_is_valid();
- }
-
- protected:
-
- iter()
- {
- }
-
- }; // end of class oln::abstract::iter<E>
-
-
- } // end of namespace oln::abstract
-
-
-} // end of namespace oln
-
-
-#define for_all(i) for (i.start(); i.is_valid(); i.next())
-
-
-#endif // ! OLENA_CORE_ABSTRACT_ITER_HH
Index: oln/core/abstract/point_set_having_known_size.hh
===================================================================
--- oln/core/abstract/point_set_having_known_size.hh (revision 547)
+++ oln/core/abstract/point_set_having_known_size.hh (working copy)
@@ -25,10 +25,10 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef OLENA_CORE_ABSTRACT_PSET_FIXED_HH
-# define OLENA_CORE_ABSTRACT_PSET_FIXED_HH
+#ifndef OLENA_CORE_ABSTRACT_POINT_SET_HAVING_KNOWN_SIZE_HH
+# define OLENA_CORE_ABSTRACT_POINT_SET_HAVING_KNOWN_SIZE_HH
-# include <oln/core/abstract/pset.hh>
+# include <oln/core/abstract/point_set.hh>
@@ -40,7 +40,7 @@
template <typename E>
- class fixed_pset : public virtual pset<E>
+ class point_set_having_known_size : public virtual point_set<E>
{
public:
@@ -50,7 +50,7 @@
}
protected:
- fixed_pset()
+ point_set_having_known_size()
{}
};
@@ -59,15 +59,15 @@
template <typename E>
- struct case_ < pset_fixed_hierarchy, E, 1 >
- : where_< mlc::eq_< oln_type_of(E, fixed), mlc::true_ > >
+ struct case_ < point_set_hierarchy_wrt_known_size, E, 1 >
+ : where_< mlc::eq_< oln_type_of(E, has_known_size), mlc::true_ > >
{
- typedef abstract::fixed_pset<E> ret;
+ typedef abstract::point_set_having_known_size<E> ret;
};
} // end of namespace oln
-#endif // ! OLENA_CORE_ABSTRACT_PSET_FIXED_HH
+#endif // ! OLENA_CORE_ABSTRACT_POINT_SET_HAVING_KNOWN_SIZE_HH
Index: oln/core/gen/fwd_piter.hh
===================================================================
--- oln/core/gen/fwd_piter.hh (revision 548)
+++ oln/core/gen/fwd_piter.hh (working copy)
@@ -29,7 +29,7 @@
#ifndef OLENA_CORE_GEN_FWD_PITER_HH
# define OLENA_CORE_GEN_FWD_PITER_HH
-# include <oln/core/abstract/piter.hh>
+# include <oln/core/abstract/iterator_on_points.hh>
# include <oln/core/abstract/point.hh>
# include <oln/core/gen/bbox.hh>
@@ -47,7 +47,7 @@
struct set_super_type< fwd_piter_<point> >
{
typedef fwd_piter_<point> self_t;
- typedef abstract::piter<self_t> ret;
+ typedef abstract::iterator_on_points<self_t> ret;
};
@@ -63,11 +63,11 @@
/// Abstract forward point iterator class.
template <typename point>
- class fwd_piter_ : public abstract::piter< fwd_piter_<point> >,
+ class fwd_piter_ : public abstract::iterator_on_points< fwd_piter_<point> >,
private mlc::assert_< mlc_is_a(point, abstract::point) >
{
typedef fwd_piter_<point> self_t;
- typedef abstract::piter<self_t> super_t;
+ typedef abstract::iterator_on_points<self_t> super_t;
using super_t::p_;
Index: oln/core/gen/bkd_piter.hh
===================================================================
--- oln/core/gen/bkd_piter.hh (revision 548)
+++ oln/core/gen/bkd_piter.hh (working copy)
@@ -29,7 +29,7 @@
#ifndef OLENA_CORE_GEN_BKD_PITER_HH
# define OLENA_CORE_GEN_BKD_PITER_HH
-# include <oln/core/abstract/piter.hh>
+# include <oln/core/abstract/iterator_on_points.hh>
# include <oln/core/abstract/point.hh>
# include <oln/core/gen/bbox.hh>
@@ -47,7 +47,7 @@
struct set_super_type< bkd_piter_<point> >
{
typedef bkd_piter_<point> self_t;
- typedef abstract::piter<self_t> ret;
+ typedef abstract::iterator_on_points<self_t> ret;
};
@@ -63,11 +63,11 @@
/// Abstract forward point iterator class.
template <typename point>
- class bkd_piter_ : public abstract::piter< bkd_piter_<point> >,
+ class bkd_piter_ : public abstract::iterator_on_points< bkd_piter_<point> >,
private mlc::assert_< mlc_is_a(point, abstract::point) >
{
typedef bkd_piter_<point> self_t;
- typedef abstract::piter<self_t> super_t;
+ typedef abstract::iterator_on_points<self_t> super_t;
using super_t::p_;