2006-09-26 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add mapimage type and update.
* oln/core/gen/mapimage.hh: New.
* oln/automatic/image_being_random_accessible.hh: New.
* oln/core/abstract/topology_having_bbox.hh
(bbox): New; mutable version.
* oln/core/abstract/image.hh (has): Remove; this method
is now specific to a sub-abstraction.
* oln/core/abstract/image/mutability/hierarchy.hh
(lvalue_t, psite_t): Update.
(~image_being_mutable): Fix typo.
(using): New; it allows disambiguation of overloading
thru inheritance.
* oln/core/abstract/image/accessibility/hierarchy.hh
(has, has_large): Update.
(include): Update.
* oln/core/abstract/image/bbox/hierarchy.hh
(bbox_t, point_t): Update.
(bbox): Change return signature.
(pmin, pmax): New.
* oln/core/gen/topo_bbox.hh (impl_bbox): New.
* oln/Makefile.am (nobase_oln_HEADERS): Update.
Index: oln/automatic/image_being_random_accessible.hh
===================================================================
--- oln/automatic/image_being_random_accessible.hh (revision 0)
+++ oln/automatic/image_being_random_accessible.hh (revision 0)
@@ -0,0 +1,104 @@
+// Copyright (C) 2006 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLENA_AUTOMATIC_IMAGE_BEING_RANDOM_ACCESSIBLE_HH
+# define OLENA_AUTOMATIC_IMAGE_BEING_RANDOM_ACCESSIBLE_HH
+
+# include <oln/core/typedefs.hh>
+# include <oln/morpher/tags.hh>
+
+
+namespace oln
+{
+
+ // Forward declaration.
+ namespace abstract
+ {
+ template <typename E> class image_being_random_accessible;
+
+ } // end of namespace oln::abstract
+
+
+ namespace automatic
+ {
+
+ /// Default implementation corresponding to the interface
+ /// oln::abstract::image_being_random_accessible.
+
+ template <typename E, typename M>
+ class impl< abstract::image_being_random_accessible, M, E> :
+ public virtual stc::any__simple<E>
+ {
+ private:
+
+ typedef oln_type_of(E, point) point_t;
+
+ public:
+
+ bool impl_has(const point_t& p) const
+ {
+ return this->exact().topo().has(p);
+ }
+
+ bool impl_has_large(const point_t& p) const
+ {
+ return this->exact().has(p);
+ }
+
+ };
+
+
+ /// Implementation corresponding to the interface
+ /// oln::abstract::image_being_random_accessible for an identity morpher.
+
+ template <typename E>
+ class impl< abstract::image_being_random_accessible, morpher::tag::identity, E> :
+ public virtual stc::any__simple<E>
+ {
+ private:
+
+ typedef oln_type_of(E, point) point_t;
+
+ public:
+
+ bool impl_has(const point_t& p) const
+ {
+ return this->exact().delegate().has(p);
+ }
+
+ bool impl_has_large(const point_t& p) const
+ {
+ return this->exact().delegate().has_large(p);
+ }
+
+ };
+
+ } // end of namespace oln::automatic
+
+} // end of namespace oln
+
+#endif // ! OLENA_AUTOMATIC_IMAGE_BEING_RANDOM_ACCESSIBLE_HH
Index: oln/core/abstract/topology_having_bbox.hh
===================================================================
--- oln/core/abstract/topology_having_bbox.hh (revision 574)
+++ oln/core/abstract/topology_having_bbox.hh (working copy)
@@ -56,6 +56,12 @@
return this->exact().impl_bbox();
}
+ // abstract
+ bbox_t& bbox()
+ {
+ return this->exact().impl_bbox();
+ }
+
// concrete
operator bbox_t() const
{
Index: oln/core/abstract/image.hh
===================================================================
--- oln/core/abstract/image.hh (revision 574)
+++ oln/core/abstract/image.hh (working copy)
@@ -123,23 +123,6 @@
return this->exact().impl_op_read(p);
}
-
- /*! \brief Test if the point \a p belongs to the current image.
- ** Please note that a point of the outer boundary of an image
- ** does NOT belong to the image.
- **
- ** \return True if p belongs to the current image, false otherwise.
- **
- ** \see hold_large
- */
-
- bool has(const psite_t& p) const
- {
- return this->exact().impl_has(p);
- }
-
- // FIXME: has should *not* be defined for all image classes.
-
protected:
/*! \brief Constructor (protected, empty).
Index: oln/core/abstract/image/mutability/hierarchy.hh
===================================================================
--- oln/core/abstract/image/mutability/hierarchy.hh (revision 574)
+++ oln/core/abstract/image/mutability/hierarchy.hh (working copy)
@@ -53,8 +53,8 @@
{
private:
- typedef oln_type_of(E, lvalue) lvalue_t;
- typedef oln_type_of(E, psite) psite_t;
+ typedef oln_check_type_of(E, lvalue) lvalue_t;
+ typedef oln_check_type_of(E, psite) psite_t;
public:
@@ -66,7 +66,9 @@
** the current image.
*/
- lvalue_t& operator()(const psite_t& p) const
+ using image<E>::operator();
+
+ lvalue_t& operator()(const psite_t& p)
{
return this->exact().impl_op_readwrite(p);
}
@@ -77,7 +79,7 @@
image_being_mutable() {}
/// Destructor (protected).
- image_being_mutable() { decl(); }
+ ~image_being_mutable() { decl(); }
};
Index: oln/core/abstract/image/accessibility/hierarchy.hh
===================================================================
--- oln/core/abstract/image/accessibility/hierarchy.hh (revision 574)
+++ oln/core/abstract/image/accessibility/hierarchy.hh (working copy)
@@ -29,6 +29,7 @@
# define OLENA_CORE_ABSTRACT_IMAGE_ACCESSIBILITY_HIERARCHY_HH
# include <oln/core/abstract/image.hh>
+# include <oln/automatic/image_being_random_accessible.hh>
@@ -52,16 +53,16 @@
public:
- // Concrete method.
+ // Abstract method.
bool has(const point_t& p) const
{
- return this->topo().has(p);
+ return this->exact().impl_has(p);
}
- // Concrete method.
+ // Abstract method.
bool has_large(const point_t& p) const
{
- return this->topo().has_large(p);
+ return this->exact().impl_has_large(p);
}
protected:
Index: oln/core/abstract/image/bbox/hierarchy.hh
===================================================================
--- oln/core/abstract/image/bbox/hierarchy.hh (revision 574)
+++ oln/core/abstract/image/bbox/hierarchy.hh (working copy)
@@ -48,8 +48,10 @@
public automatic::impl< image_having_bbox, oln_type_of(E, morpher), E >
{
private:
- typedef oln_type_of(E, bbox) bbox_t;
+ typedef oln_check_type_of(E, bbox) bbox_t;
+ typedef oln_check_type_of(E, point) point_t;
+
public:
struct decl {
@@ -57,11 +59,23 @@
};
// Concrete method.
- bbox_t bbox() const
+ const bbox_t& bbox() const
{
return this->topo().bbox();
}
+ // Concrete method.
+ const point_t& pmin() const
+ {
+ return this->topo().bbox().pmin();
+ }
+
+ // Concrete method.
+ const point_t& pmax() const
+ {
+ return this->topo().bbox().pmax();
+ }
+
protected:
/// Constructor (protected, empty).
Index: oln/core/gen/topo_bbox.hh
===================================================================
--- oln/core/gen/topo_bbox.hh (revision 574)
+++ oln/core/gen/topo_bbox.hh (working copy)
@@ -64,6 +64,8 @@
template <typename point>
class topo_bbox_ : public topology_entry< topo_bbox_<point> >
{
+ typedef topo_bbox_<point> self_t;
+ typedef topology_entry<self_t> super_t;
typedef bbox_<point> bbox_t;
public:
@@ -82,6 +84,11 @@
return bb_;
}
+ bbox_t& impl_bbox()
+ {
+ return bb_;
+ }
+
bool impl_has(const point& p) const
{
return bb_.has(p);
Index: oln/core/gen/mapimage.hh
===================================================================
--- oln/core/gen/mapimage.hh (revision 0)
+++ oln/core/gen/mapimage.hh (revision 0)
@@ -0,0 +1,123 @@
+// Copyright (C) 2001, 2002, 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_MAPIMAGE_HH
+# define OLENA_CORE_GEN_MAPIMAGE_HH
+
+# include <oln/core/image_entry.hh>
+# include <oln/core/gen/topo_bbox.hh>
+# include <map>
+
+
+namespace oln
+{
+
+ // Forward declaration.
+ template <typename point_t, typename value_t> class mapimage;
+
+
+ /// Virtual types associated to oln::mapimage<>.
+ template <typename point_t, typename value_t>
+ struct vtypes< mapimage<point_t, value_t> >
+ {
+ typedef topo_bbox_<point_t> topo_type;
+ typedef oln_type_of(point_t, grid) grid_type;
+
+ typedef point_t point_type;
+
+ typedef fwd_piter_bbox_<topo_type> fwd_piter_type;
+ typedef bkd_piter_bbox_<topo_type> bkd_piter_type;
+
+ typedef value_t value_type;
+
+ typedef mlc::true_ is_mutable_type;
+ typedef value_t lvalue_type;
+
+ typedef void real_type; // FIXME
+ };
+
+
+ /// Super type declaration.
+ template <typename point_t, typename value_t>
+ struct set_super_type< mapimage<point_t, value_t> >
+ {
+ typedef mapimage<point_t, value_t> self_t;
+ typedef image_entry<self_t> ret;
+ };
+
+
+ /// General 2D image class.
+ template <typename point_t, typename value_t>
+ class mapimage : public image_entry< mapimage<point_t, value_t> >
+ {
+ typedef mapimage<point_t, value_t> self_t;
+ typedef oln_type_of(self_t, topo) topo_t;
+
+ public:
+
+ /// Ctor.
+ mapimage(const value_t& val)
+ : val_(val)
+ {
+ }
+
+ const topo_t& impl_topo() const
+ {
+ return topo_;
+ }
+
+ value_t impl_op_read(const point_t& p) const
+ {
+ if (not has(p))
+ return val_;
+ return data_[p];
+ }
+
+ value_t& impl_op_readwrite(const point_t& p)
+ {
+ topo_.bbox().take(p);
+ return data_[p];
+ }
+
+ bool impl_has(const point_t& p) const
+ {
+ return data_.find(p) != data_.end();
+ }
+
+ private:
+
+ value_t val_;
+ mutable topo_t topo_;
+ mutable std::map<point_t, value_t> data_;
+ };
+
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_GEN_MAPIMAGE_HH
Index: oln/Makefile.am
===================================================================
--- oln/Makefile.am (revision 574)
+++ oln/Makefile.am (working copy)
@@ -5,7 +5,10 @@
nobase_oln_HEADERS = \
\
automatic/image.hh \
+ automatic/image_being_mutable.hh \
+ automatic/image_being_random_accessible.hh \
automatic/image_having_neighborhood.hh \
+ automatic/image_having_neighborhood.hh \
automatic/topology_being_random_accessible.hh \
automatic/topology_having_bbox.hh \
automatic/topology_having_neighborhood.hh \
@@ -30,11 +33,14 @@
core/abstract/entry.hh \
core/abstract/grid.hh \
core/abstract/image.hh \
+ core/abstract/image/accessibility/hierarchy.hh \
+ core/abstract/image/bbox/hierarchy.hh \
core/abstract/image/dimension/1d.hh \
core/abstract/image/dimension/2d.hh \
core/abstract/image/dimension/3d.hh \
core/abstract/image/dimension/hierarchy.hh \
core/abstract/image/hierarchies.hh \
+ core/abstract/image/mutability/hierarchy.hh \
core/abstract/image/neighborhood/hierarchy.hh \
core/abstract/image/type/binary.hh \
core/abstract/image/type/color.hh \
@@ -62,9 +68,13 @@
core/gen/bbox.hh \
core/gen/bbox_bkd_piter.hh \
core/gen/bbox_fwd_piter.hh \
+ core/gen/bkd_piter_bbox.hh \
+ core/gen/fwd_piter_bbox.hh \
+ core/gen/mapimage.hh \
core/gen/neighb.hh \
core/gen/topo_add_nbh.hh \
core/gen/topo_bbox.hh \
+ core/gen/topo_lbbox.hh \
\
core/internal/bbox_bkd_piter.hh \
core/internal/bbox_fwd_piter.hh \
2006-09-26 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add some abstract image sub-hierarchies.
* oln/automatic/image_being_mutable.hh: New.
* oln/core/abstract/image/mutability/hierarchy.hh: New.
* oln/core/abstract/image/accessibility/hierarchy.hh: New.
* oln/core/abstract/image/bbox/hierarchy.hh: New.
* oln/core/typedefs.hh (lvalue_type, is_mutable_type): New.
* oln/core/macros.hh (oln_deduce_type_of): New.
* oln/core/abstract/image.hh: Cosmetics.
* oln/core/abstract/image/hierarchies.hh
(image_hierarchy_wrt_bbox): New.
(image_hierarchy_wrt_accessibility): New.
(image_hierarchy_wrt_mutability): New.
(include): Update.
* oln/core/abstract/image/neighborhood/hierarchy.hh (decl): New.
(~image_having_neighborhood): New.
Index: oln/automatic/image_being_mutable.hh
===================================================================
--- oln/automatic/image_being_mutable.hh (revision 0)
+++ oln/automatic/image_being_mutable.hh (revision 0)
@@ -0,0 +1,69 @@
+// 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_BEING_MUTABLE_HH
+# define OLENA_AUTOMATIC_IMAGE_BEING_MUTABLE_HH
+
+# include <oln/core/typedefs.hh>
+# include <oln/morpher/tags.hh>
+
+
+namespace oln
+{
+ // Forward declaration.
+ namespace abstract
+ {
+ template <typename E> class image_being_mutable;
+
+ } // end of namespace oln::abstract
+
+
+ namespace automatic
+ {
+ /// Implementation corresponding to the interface
+ /// oln::abstract::image_being_mutable for an identity morpher.
+ template <typename E>
+ class impl< abstract::image_being_mutable, morpher::tag::identity, E> :
+ public virtual stc::any__simple<E>
+ {
+ private:
+ typedef oln_type_of(E, lvalue) lvalue_t;
+ typedef oln_type_of(E, psite) psite_t;
+
+ public:
+ /// Accessor delegation.
+ lvalue_t& impl_op_readwrite(const psite_t& p) const
+ {
+ return this->exact().delegate().operator()(p);
+ }
+ };
+
+ } // end of namespace oln::automatic
+
+} // end of namespace oln
+
+#endif // ! OLENA_AUTOMATIC_IMAGE_BEING_MUTABLE_HH
Index: oln/core/typedefs.hh
===================================================================
--- oln/core/typedefs.hh (revision 573)
+++ oln/core/typedefs.hh (working copy)
@@ -120,6 +120,8 @@
// --------------------------------------------------------------------
mlc_decl_typedef(value_type);
mlc_decl_typedef(rvalue_type);
+ mlc_decl_typedef(lvalue_type);
+ mlc_decl_typedef(is_mutable_type);
// --------------------------------------------------------------------
// FIXME: To be enabled later.
Index: oln/core/macros.hh
===================================================================
--- oln/core/macros.hh (revision 573)
+++ oln/core/macros.hh (working copy)
@@ -40,6 +40,14 @@
# define oln_type_of(OlnType, Alias) \
stc_type_of(oln, void, OlnType, Alias)
+
+/// FIXME: Temporary macro to be able to perform "oln_type_of(oln_type_of(A, B), C)".
+# define oln_deduce_type_of(OlnType, Alias1, Alias2) \
+typename oln::type_of_<void, \
+ typename oln::type_of_<void, OlnType, oln::typedef_::Alias1##_type >::ret, \
+ oln::typedef_::Alias2##_type >::ret
+
+
/// \def oln_type_of(OlnType, Alias)
///
/// Macro to retrieve an associated type \a Alias from the exact type of
Index: oln/core/abstract/image.hh
===================================================================
--- oln/core/abstract/image.hh (revision 573)
+++ oln/core/abstract/image.hh (working copy)
@@ -55,9 +55,7 @@
template <typename E>
struct image : public virtual stc::any__simple<E>,
public virtual oln::type,
- public automatic::impl< image,
- oln_type_of(E, morpher),
- E >
+ public automatic::impl< image, oln_type_of(E, morpher), E >
{
public:
Index: oln/core/abstract/image/mutability/hierarchy.hh
===================================================================
--- oln/core/abstract/image/mutability/hierarchy.hh (revision 0)
+++ oln/core/abstract/image/mutability/hierarchy.hh (revision 0)
@@ -0,0 +1,102 @@
+// 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_MUTABILITY_HIERARCHY_HH
+# define OLENA_CORE_ABSTRACT_IMAGE_MUTABILITY_HIERARCHY_HH
+
+# include <oln/core/abstract/image.hh>
+
+// Automatically-inherited implementations.
+# include <oln/automatic/image_being_mutable.hh>
+
+
+
+namespace oln
+{
+
+ /*-------------------------.
+ | Dimension abstractions. |
+ `-------------------------*/
+
+ namespace abstract
+ {
+
+ /// Image being mutable.
+ template <typename E>
+ struct image_being_mutable :
+ public virtual image<E>,
+ public automatic::impl< image_being_mutable, oln_type_of(E, morpher), E >
+ {
+ private:
+
+ typedef oln_type_of(E, lvalue) lvalue_t;
+ typedef oln_type_of(E, psite) psite_t;
+
+ public:
+
+ struct decl {
+ stc_virtual_typedef(lvalue);
+ };
+
+ /*! \brief Gives writable access to the value stored at \a p in
+ ** the current image.
+ */
+
+ lvalue_t& operator()(const psite_t& p) const
+ {
+ return this->exact().impl_op_readwrite(p);
+ }
+
+ protected:
+
+ /// Constructor (protected, empty).
+ image_being_mutable() {}
+
+ /// Destructor (protected).
+ image_being_mutable() { decl(); }
+
+ };
+
+ } // end of namespace oln::abstract
+
+
+ /*-------------------.
+ | Dimension switch. |
+ `-------------------*/
+
+ /// With mutability.
+ template <typename E>
+ struct case_< image_hierarchy_wrt_mutability, E, 1 > :
+ where_< mlc::eq_< oln_type_of(E, is_mutable), mlc::true_ > >
+ {
+ typedef abstract::image_being_mutable<E> ret;
+ };
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_MUTABILITY_HIERARCHY_HH
Index: oln/core/abstract/image/hierarchies.hh
===================================================================
--- oln/core/abstract/image/hierarchies.hh (revision 573)
+++ oln/core/abstract/image/hierarchies.hh (working copy)
@@ -37,11 +37,14 @@
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;
+ typedef hierarchy<abstract::image, 4> image_hierarchy_wrt_bbox;
+ typedef hierarchy<abstract::image, 5> image_hierarchy_wrt_accessibility;
+ typedef hierarchy<abstract::image, 6> image_hierarchy_wrt_mutability;
// FIXME: To be continued.
#if 0
- typedef hierarchy<abstract::image, 4> image_hierarchy_wrt_value;
- typedef hierarchy<abstract::image, 5> image_hierarchy_wrt_data_retrieval;
+ typedef hierarchy<abstract::image, 7> image_hierarchy_wrt_value;
+ typedef hierarchy<abstract::image, 8> image_hierarchy_wrt_data_retrieval;
// ...
#endif
@@ -57,5 +60,14 @@
// Hierarchy 3: topology w.r.t. neighborhood.
# include <oln/core/abstract/image/neighborhood/hierarchy.hh>
+// Hierarchy 4: topology w.r.t. bounding box.
+# include <oln/core/abstract/image/bbox/hierarchy.hh>
+// Hierarchy 5: topology w.r.t. accessibility.
+# include <oln/core/abstract/image/accessibility/hierarchy.hh>
+
+// // // Hierarchy 6: topology w.r.t. data mutability.
+# include <oln/core/abstract/image/mutability/hierarchy.hh>
+
+
#endif // ! OLENA_CORE_ABSTRACT_IMAGE_HIERARCHIES_HH
Index: oln/core/abstract/image/neighborhood/hierarchy.hh
===================================================================
--- oln/core/abstract/image/neighborhood/hierarchy.hh (revision 573)
+++ oln/core/abstract/image/neighborhood/hierarchy.hh (working copy)
@@ -67,14 +67,26 @@
typedef oln_type_of(E, neighborhood) neighborhood_t;
public:
+
+ struct decl {
+ // FIXME: Uncomment.
+ // stc_virtual_typedef(fwd_niter);
+ // stc_virtual_typedef(bkd_niter);
+ };
+
neighborhood_t neighborhood() const
{
return this->topo().neighborhood();
}
protected:
+
/// Constructor (protected, empty).
image_having_neighborhood() {}
+
+ /// Destructor (protected).
+ ~image_having_neighborhood() { decl(); }
+
};
} // end of namespace oln::abstract
Index: oln/core/abstract/image/accessibility/hierarchy.hh
===================================================================
--- oln/core/abstract/image/accessibility/hierarchy.hh (revision 0)
+++ oln/core/abstract/image/accessibility/hierarchy.hh (revision 0)
@@ -0,0 +1,91 @@
+// 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_ACCESSIBILITY_HIERARCHY_HH
+# define OLENA_CORE_ABSTRACT_IMAGE_ACCESSIBILITY_HIERARCHY_HH
+
+# include <oln/core/abstract/image.hh>
+
+
+
+namespace oln
+{
+
+ /*-------------------------.
+ | Dimension abstractions. |
+ `-------------------------*/
+
+ namespace abstract
+ {
+
+ /// Image having a accessibility.
+ template <typename E>
+ struct image_being_random_accessible :
+ public virtual image<E>,
+ public automatic::impl< image_being_random_accessible, oln_type_of(E, morpher), E >
+ {
+ typedef oln_type_of(E, point) point_t;
+
+ public:
+
+ // Concrete method.
+ bool has(const point_t& p) const
+ {
+ return this->topo().has(p);
+ }
+
+ // Concrete method.
+ bool has_large(const point_t& p) const
+ {
+ return this->topo().has_large(p);
+ }
+
+ protected:
+
+ /// Constructor (protected, empty).
+ image_being_random_accessible() {}
+ };
+
+ } // end of namespace oln::abstract
+
+
+ /*-------------------.
+ | Dimension switch. |
+ `-------------------*/
+
+ /// With accessibility.
+ template <typename E>
+ struct case_< image_hierarchy_wrt_accessibility, E, 1 > :
+ where_< mlc::eq_< oln_deduce_type_of(E, topo, is_random_accessible), mlc::true_ > >
+ {
+ typedef abstract::image_being_random_accessible<E> ret;
+ };
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_ACCESSIBILITY_HIERARCHY_HH
Index: oln/core/abstract/image/bbox/hierarchy.hh
===================================================================
--- oln/core/abstract/image/bbox/hierarchy.hh (revision 0)
+++ oln/core/abstract/image/bbox/hierarchy.hh (revision 0)
@@ -0,0 +1,105 @@
+// 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_BBOX_HIERARCHY_HH
+# define OLENA_CORE_ABSTRACT_IMAGE_BBOX_HIERARCHY_HH
+
+# include <oln/core/abstract/image.hh>
+
+
+namespace oln
+{
+
+ /*-------------------------.
+ | Dimension abstractions. |
+ `-------------------------*/
+
+ namespace abstract
+ {
+
+ /// Image having a bbox.
+ template <typename E>
+ struct image_having_bbox :
+ public virtual image<E>,
+ public automatic::impl< image_having_bbox, oln_type_of(E, morpher), E >
+ {
+ private:
+ typedef oln_type_of(E, bbox) bbox_t;
+
+ public:
+
+ struct decl {
+ stc_virtual_typedef(bbox);
+ };
+
+ // Concrete method.
+ bbox_t bbox() const
+ {
+ return this->topo().bbox();
+ }
+
+ protected:
+
+ /// Constructor (protected, empty).
+
+ image_having_bbox() {}
+ /// Destructor.
+ virtual ~image_having_bbox() { decl(); }
+ };
+
+ } // end of namespace oln::abstract
+
+
+ /*-------------------.
+ | Dimension switch. |
+ `-------------------*/
+
+ /// With bbox.
+ template <typename E>
+ struct case_< image_hierarchy_wrt_bbox, E, 1 > :
+ where_< mlc::neq_< oln_deduce_type_of(E, topo, bbox), mlc::not_found > >
+ {
+ typedef abstract::image_having_bbox<E> ret;
+ };
+
+
+ template <typename E> struct image_entry;
+
+
+ template <typename E>
+ struct single_vtype< image_entry<E>, typedef_::bbox_type >
+ {
+ private:
+ typedef oln_type_of(E, topo) topo_t;
+ public:
+ typedef oln_type_of(topo_t, bbox) ret;
+ };
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_BBOX_HIERARCHY_HH
2006-09-26 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Dispatch image abstract classes into subdirs and files.
* oln/core/abstract/image/type: New directory.
* oln/core/abstract/image/dimension: New directory.
* oln/core/abstract/image/neighborhood: New directory.
* oln/core/abstract/image_type.hh (internal): Remove.
Rename into...
* oln/core/abstract/image/type/hierarchy.hh: ...this file.
* oln/core/abstract/image_dimension.hh: Rename into...
* oln/core/abstract/image/dimension/hierarchy.hh: ...this file.
* oln/core/abstract/image_hierarchies.hh: Rename into...
* oln/core/abstract/image/hierarchies.hh: ...this file.
* oln/core/abstract/image_type_integre.hh: Rename into...
* oln/core/abstract/image/type/integre.hh: ...this file.
* oln/core/abstract/image_having_neighborhood.hh: Rename into...
* oln/core/abstract/image/neighborhood/hierarchy.hh: ...this file.
* oln/core/abstract/image.hh (include): Update.
* Makefile.am: Update.
Index: oln/core/abstract/image.hh
===================================================================
--- oln/core/abstract/image.hh (revision 569)
+++ oln/core/abstract/image.hh (working copy)
@@ -160,7 +160,7 @@
} // end of namespace oln
-# include <oln/core/abstract/image_hierarchies.hh>
+# include <oln/core/abstract/image/hierarchies.hh>
#endif // ! OLENA_CORE_ABSTRACT_IMAGE_HH
Index: oln/core/abstract/image_type.hh
===================================================================
--- oln/core/abstract/image_type.hh (revision 569)
+++ oln/core/abstract/image_type.hh (working copy)
@@ -1,275 +0,0 @@
-// Copyright (C) 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_IMAGE_TYPE_HH
-# define OLENA_CORE_ABSTRACT_IMAGE_TYPE_HH
-
-# include <oln/core/abstract/image.hh>
-
-
-/* Image ``type'' hierarchy (summary).
-
-
- /image<I>/
- ^
- |
- ,--------------+-------------+-------------+--------+---------.
- | | | | | |
- /grey_level_image/ /color_image/ /label_image/ /data_image/ ... /not_binary_
- ^ ^ ^ ^ ^ ^ image/
- | | | | | | ^
- | | | /binary_image/ | | |
- | | | ^ | | |
- | | | | | | |
- ,---------------------------------------------------------------------.
- | The selection of the super class(es) is made according to the value |
- | of type_of(I, value). |
- `---------------------------------------------------------------------'
- | | | | | | |
- o o o o o o o
-
- o
- |
- /switch_<image_dimension_type, I>::ret/
- (image type selector)
- ^
- |
- /entry<abstract::image, I>/
- ^
- |
- image_entry<I>
- ^
- |
- I
- (a concrete image)
-
-
- Default case: If no known value type is returned by `oln_type_of(I, value)',
- the entry is plugged to abstract::data_image<I>. */
-
-
-/*--------------------.
-| Type abstractions. |
-`--------------------*/
-
-namespace oln
-{
-
- namespace abstract
- {
-
- /// \brief Class of grey-level images.
- ///
- /// An image that contains values whose type is \c int or
- /// <tt>unsigned char</tt>, or ntg::int_u<8> (...) is <b>not</b> a
- /// grey-level image.
- ///
- /// FIXME: Say more.
- template <typename E>
- struct grey_level_image : public virtual image<E>
- {
- protected:
- /// Constructor (protected, empty).
- grey_level_image() {}
- };
-
- /// Class of color images.
- template <typename E>
- struct color_image : public virtual image<E>
- {
- protected:
- /// Constructor (protected, empty).
- color_image() {}
- };
-
- /// \brief Class of images whose data are NOT Boolean values.
- ///
- /// However such images can derive from abstract::label_image (we
- /// can have labels that are not binary ones).
- template <typename E>
- struct not_binary_image : public virtual image<E>
- {
- protected:
- /// Constructor (protected, empty).
- not_binary_image() {}
- };
-
- /// \brief Class of images whose data are labels.
- ///
- /// Such images do not support arithmetics.
- template <typename E>
- struct label_image : public virtual image<E>
- {
- protected:
- /// Constructor (protected, empty).
- label_image() {}
- };
-
- /// \brief Class of images whose data are Boolean values.
- ///
- /// Such images are also oln::abstract::label_image.
- template <typename E>
- struct binary_image : public label_image<E>
- {
- protected:
- /// Constructor (protected, empty).
- binary_image() {}
- };
-
- /// \brief Class of images whose data cannot be qualified of
- /// grey-levels, colors, or labels.
- template <typename E>
- struct data_image : public virtual image<E>
- {
- protected:
- /// Constructor (protected, empty).
- data_image() {}
- };
-
-
- // -------------------- //
- // Conjunctions types. //
- // -------------------- //
-
- namespace internal
- {
-
- /// \brief Conjunctions types
- ///
- /// These types are helpers to express the inheritance relation
- /// ``is a X and not_binary_image''. These abstractions are not
- /// to be used by client code (i.e., algorithms), they are only
- /// part of the inheritance machinery.
- //
- /// \{
-
- /// <em>Grey-level image</em> and <em>not binary image</em> abstraction.
- template <typename E>
- struct grey_level_image_ : public grey_level_image<E>,
- public not_binary_image<E>
- {
- protected:
- /// Constructor (protected, empty).
- grey_level_image_() {}
- };
-
- /// <em>Label image</em> and <em>not binary image</em> abstraction.
- template <typename E>
- struct label_image_ : public label_image<E>,
- public not_binary_image<E>
- {
- protected:
- /// Constructor (protected, empty).
- label_image_() {}
- };
-
- /// <em>Color image</em> and <em>not binary image</em> abstraction.
- template <typename E>
- struct color_image_ : public color_image<E>,
- public not_binary_image<E>
- {
- protected:
- /// Constructor (protected, empty).
- color_image_() {}
- };
-
- /// <em>Data image</em> and <em>not binary image</em> abstraction.
- template <typename E>
- struct data_image_ : public data_image<E>,
- public not_binary_image<E>
- {
- protected:
- /// Constructor (protected, empty).
- data_image_() {}
- };
-
- /// \}
-
- } // end of namespace oln::abstract::internal
-
- } // end of namespace oln::abstract
-
-} // end of namespace oln
-
-
-/*--------------.
-| Type switch. |
-`--------------*/
-
-namespace oln
-{
-
- /// Switch on on the grid dimension.
- /// \{
-
- // ----------------------------------------------- //
- // Cases where the value type is an builtin type. //
- // ----------------------------------------------- //
-
- /// Binary case.
- template <typename E>
- 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.
- typedef abstract::binary_image<E> ret;
- };
-
- /// Grey-level case.
- template <typename E>
- 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> > >
- {
- // Definition of the super class corresponding to this case
- // (abstract::grey_level_image_ is the conjunction of
- // abstract::grey_level_image and abstract::not_binary_image).
- typedef abstract::internal::grey_level_image_<E> ret;
- };
-
-
- // -------------- //
- // Default case. //
- // -------------- //
-
- /// Default case: image of ``data''.
- template <typename 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
- // abstract::data_image and abstract::not_binary_image).
- typedef abstract::internal::data_image_<E> ret;
- };
-
- /// \}
-
-} // end of namespace oln
-
-
-#endif // ! OLENA_CORE_ABSTRACT_IMAGE_TYPE_HH
Index: oln/core/abstract/image/type/binary.hh
===================================================================
--- oln/core/abstract/image/type/binary.hh (revision 0)
+++ oln/core/abstract/image/type/binary.hh (revision 0)
@@ -0,0 +1,56 @@
+// Copyright (C) 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_IMAGE_TYPE_BINARY_HH
+# define OLENA_CORE_ABSTRACT_IMAGE_TYPE_BINARY_HH
+
+# include <oln/core/abstract/image/type/label.hh>
+
+
+namespace oln
+{
+
+ namespace abstract
+ {
+
+ /// \brief Class of images whose data are Boolean values.
+ ///
+ /// Such images are also oln::abstract::label_image.
+ template <typename E>
+ struct binary_image : public label_image<E>
+ {
+ protected:
+ /// Constructor (protected, empty).
+ binary_image() {}
+ };
+
+ } // end of namespace oln::abstract
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_TYPE_BINARY_HH
Index: oln/core/abstract/image/type/data.hh
===================================================================
--- oln/core/abstract/image/type/data.hh (revision 0)
+++ oln/core/abstract/image/type/data.hh (revision 0)
@@ -0,0 +1,54 @@
+// Copyright (C) 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_IMAGE_TYPE_DATA_HH
+# define OLENA_CORE_ABSTRACT_IMAGE_TYPE_DATA_HH
+
+# include <oln/core/abstract/image.hh>
+
+namespace oln
+{
+
+ namespace abstract
+ {
+
+ /// \brief Class of images whose data cannot be qualified of
+ /// grey-levels, colors, or labels.
+ template <typename E>
+ struct data_image : public virtual image<E>
+ {
+ protected:
+ /// Constructor (protected, empty).
+ data_image() {}
+ };
+
+ } // end of namespace oln::abstract
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_TYPE_DATA_HH
Index: oln/core/abstract/image/type/integre.hh
===================================================================
--- oln/core/abstract/image/type/integre.hh (revision 0)
+++ oln/core/abstract/image/type/integre.hh (working copy)
@@ -32,7 +32,7 @@
#ifndef OLENA_CORE_ABSTRACT_IMAGE_TYPE_INTEGRE_HH
# define OLENA_CORE_ABSTRACT_IMAGE_TYPE_INTEGRE_HH
-# include <oln/core/abstract/image_type.hh>
+# include <oln/core/abstract/image/type/hierarchy.hh>
// Forward declarations.
Index: oln/core/abstract/image/type/grey_level.hh
===================================================================
--- oln/core/abstract/image/type/grey_level.hh (revision 0)
+++ oln/core/abstract/image/type/grey_level.hh (revision 0)
@@ -0,0 +1,60 @@
+// Copyright (C) 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_IMAGE_TYPE_GREY_LEVEL_HH
+# define OLENA_CORE_ABSTRACT_IMAGE_TYPE_GREY_LEVEL_HH
+
+# include <oln/core/abstract/image.hh>
+
+
+namespace oln
+{
+
+ namespace abstract
+ {
+
+ /// \brief Class of grey-level images.
+ ///
+ /// An image that contains values whose type is \c int or
+ /// <tt>unsigned char</tt>, or ntg::int_u<8> (...) is <b>not</b> a
+ /// grey-level image.
+ ///
+ /// FIXME: Say more.
+ template <typename E>
+ struct grey_level_image : public virtual image<E>
+ {
+ protected:
+ /// Constructor (protected, empty).
+ grey_level_image() {}
+ };
+
+ } // end of namespace oln::abstract
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_TYPE_GREY_LEVEL_HH
Index: oln/core/abstract/image/type/hierarchy.hh
===================================================================
--- oln/core/abstract/image/type/hierarchy.hh (revision 0)
+++ oln/core/abstract/image/type/hierarchy.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_IMAGE_TYPE_HH
-# define OLENA_CORE_ABSTRACT_IMAGE_TYPE_HH
+#ifndef OLENA_CORE_ABSTRACT_IMAGE_TYPE_HIERARCHY_HH
+# define OLENA_CORE_ABSTRACT_IMAGE_TYPE_HIERARCHY_HH
# include <oln/core/abstract/image.hh>
@@ -37,20 +37,20 @@
/image<I>/
^
|
- ,--------------+-------------+-------------+--------+---------.
- | | | | | |
- /grey_level_image/ /color_image/ /label_image/ /data_image/ ... /not_binary_
- ^ ^ ^ ^ ^ ^ image/
- | | | | | | ^
- | | | /binary_image/ | | |
- | | | ^ | | |
- | | | | | | |
- ,---------------------------------------------------------------------.
- | The selection of the super class(es) is made according to the value |
- | of type_of(I, value). |
- `---------------------------------------------------------------------'
- | | | | | | |
- o o o o o o o
+ ,--------------+-------------+-------------+--------+
+ | | | | |
+ /grey_level_image/ /color_image/ /label_image/ /data_image/ ...
+ ^ ^ ^ ^ ^ ^
+ | | | | | |
+ | | | /binary_image/ | |
+ | | | ^ | |
+ | | | | | |
+ ,----------------------------------------------------------.
+ | The selection of the super class(es) is made according |
+ | to the value of type_of(I, value). |
+ `----------------------------------------------------------'
+ | | | | | |
+ o o o o o o
o
|
@@ -72,150 +72,22 @@
the entry is plugged to abstract::data_image<I>. */
+
/*--------------------.
| Type abstractions. |
`--------------------*/
-namespace oln
-{
+# include <oln/core/abstract/image/type/binary.hh>
+# include <oln/core/abstract/image/type/color.hh>
+# include <oln/core/abstract/image/type/data.hh>
+# include <oln/core/abstract/image/type/grey_level.hh>
+# include <oln/core/abstract/image/type/label.hh>
- namespace abstract
- {
+// FIXME: do we really want this file?
+// # include <oln/core/abstract/image/type/integre.hh>
- /// \brief Class of grey-level images.
- ///
- /// An image that contains values whose type is \c int or
- /// <tt>unsigned char</tt>, or ntg::int_u<8> (...) is <b>not</b> a
- /// grey-level image.
- ///
- /// FIXME: Say more.
- template <typename E>
- struct grey_level_image : public virtual image<E>
- {
- protected:
- /// Constructor (protected, empty).
- grey_level_image() {}
- };
- /// Class of color images.
- template <typename E>
- struct color_image : public virtual image<E>
- {
- protected:
- /// Constructor (protected, empty).
- color_image() {}
- };
- /// \brief Class of images whose data are NOT Boolean values.
- ///
- /// However such images can derive from abstract::label_image (we
- /// can have labels that are not binary ones).
- template <typename E>
- struct not_binary_image : public virtual image<E>
- {
- protected:
- /// Constructor (protected, empty).
- not_binary_image() {}
- };
-
- /// \brief Class of images whose data are labels.
- ///
- /// Such images do not support arithmetics.
- template <typename E>
- struct label_image : public virtual image<E>
- {
- protected:
- /// Constructor (protected, empty).
- label_image() {}
- };
-
- /// \brief Class of images whose data are Boolean values.
- ///
- /// Such images are also oln::abstract::label_image.
- template <typename E>
- struct binary_image : public label_image<E>
- {
- protected:
- /// Constructor (protected, empty).
- binary_image() {}
- };
-
- /// \brief Class of images whose data cannot be qualified of
- /// grey-levels, colors, or labels.
- template <typename E>
- struct data_image : public virtual image<E>
- {
- protected:
- /// Constructor (protected, empty).
- data_image() {}
- };
-
-
- // -------------------- //
- // Conjunctions types. //
- // -------------------- //
-
- namespace internal
- {
-
- /// \brief Conjunctions types
- ///
- /// These types are helpers to express the inheritance relation
- /// ``is a X and not_binary_image''. These abstractions are not
- /// to be used by client code (i.e., algorithms), they are only
- /// part of the inheritance machinery.
- //
- /// \{
-
- /// <em>Grey-level image</em> and <em>not binary image</em> abstraction.
- template <typename E>
- struct grey_level_image_ : public grey_level_image<E>,
- public not_binary_image<E>
- {
- protected:
- /// Constructor (protected, empty).
- grey_level_image_() {}
- };
-
- /// <em>Label image</em> and <em>not binary image</em> abstraction.
- template <typename E>
- struct label_image_ : public label_image<E>,
- public not_binary_image<E>
- {
- protected:
- /// Constructor (protected, empty).
- label_image_() {}
- };
-
- /// <em>Color image</em> and <em>not binary image</em> abstraction.
- template <typename E>
- struct color_image_ : public color_image<E>,
- public not_binary_image<E>
- {
- protected:
- /// Constructor (protected, empty).
- color_image_() {}
- };
-
- /// <em>Data image</em> and <em>not binary image</em> abstraction.
- template <typename E>
- struct data_image_ : public data_image<E>,
- public not_binary_image<E>
- {
- protected:
- /// Constructor (protected, empty).
- data_image_() {}
- };
-
- /// \}
-
- } // end of namespace oln::abstract::internal
-
- } // end of namespace oln::abstract
-
-} // end of namespace oln
-
-
/*--------------.
| Type switch. |
`--------------*/
@@ -246,10 +118,8 @@
mlc::eq_<oln_type_of(E, value), signed char>,
mlc::eq_<oln_type_of(E, value), unsigned char> > >
{
- // Definition of the super class corresponding to this case
- // (abstract::grey_level_image_ is the conjunction of
- // abstract::grey_level_image and abstract::not_binary_image).
- typedef abstract::internal::grey_level_image_<E> ret;
+ // Definition of the super class corresponding to this case.
+ typedef abstract::grey_level_image<E> ret;
};
@@ -261,10 +131,8 @@
template <typename 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
- // abstract::data_image and abstract::not_binary_image).
- typedef abstract::internal::data_image_<E> ret;
+ // Definition of the super class corresponding to this case.
+ typedef abstract::data_image<E> ret;
};
/// \}
@@ -272,4 +140,4 @@
} // end of namespace oln
-#endif // ! OLENA_CORE_ABSTRACT_IMAGE_TYPE_HH
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_TYPE_HIERARCHY_HH
Index: oln/core/abstract/image/type/color.hh
===================================================================
--- oln/core/abstract/image/type/color.hh (revision 0)
+++ oln/core/abstract/image/type/color.hh (revision 0)
@@ -0,0 +1,55 @@
+// Copyright (C) 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_IMAGE_TYPE_COLOR_HH
+# define OLENA_CORE_ABSTRACT_IMAGE_TYPE_COLOR_HH
+
+# include <oln/core/abstract/image.hh>
+
+
+namespace oln
+{
+
+ namespace abstract
+ {
+
+ /// Class of color images.
+ template <typename E>
+ struct color_image : public virtual image<E>
+ {
+ protected:
+ /// Constructor (protected, empty).
+ color_image() {}
+ };
+
+ } // end of namespace oln::abstract
+
+} // end of namespace oln
+
+
+
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_TYPE_COLOR_HH
Index: oln/core/abstract/image/type/label.hh
===================================================================
--- oln/core/abstract/image/type/label.hh (revision 0)
+++ oln/core/abstract/image/type/label.hh (revision 0)
@@ -0,0 +1,56 @@
+// Copyright (C) 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_IMAGE_TYPE_LABEL_HH
+# define OLENA_CORE_ABSTRACT_IMAGE_TYPE_LABEL_HH
+
+# include <oln/core/abstract/image.hh>
+
+
+namespace oln
+{
+
+ namespace abstract
+ {
+
+ /// \brief Class of images whose data are labels.
+ ///
+ /// Such images do not support arithmetics.
+ template <typename E>
+ struct label_image : public virtual image<E>
+ {
+ protected:
+ /// Constructor (protected, empty).
+ label_image() {}
+ };
+
+ } // end of namespace oln::abstract
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_TYPE_LABEL_HH
Index: oln/core/abstract/image/hierarchies.hh
===================================================================
--- oln/core/abstract/image/hierarchies.hh (revision 0)
+++ oln/core/abstract/image/hierarchies.hh (working copy)
@@ -49,13 +49,13 @@
// Hierarchy 1: topology w.r.t. dimension.
-# include <oln/core/abstract/image_dimension.hh>
+# include <oln/core/abstract/image/dimension/hierarchy.hh>
// Hierarchy 2: topology w.r.t. type of data.
-# include <oln/core/abstract/image_type.hh>
+# include <oln/core/abstract/image/type/hierarchy.hh>
// Hierarchy 3: topology w.r.t. neighborhood.
-# include <oln/core/abstract/image_having_neighborhood.hh>
+# include <oln/core/abstract/image/neighborhood/hierarchy.hh>
#endif // ! OLENA_CORE_ABSTRACT_IMAGE_HIERARCHIES_HH
Index: oln/core/abstract/image/dimension/1d.hh
===================================================================
--- oln/core/abstract/image/dimension/1d.hh (revision 0)
+++ oln/core/abstract/image/dimension/1d.hh (revision 0)
@@ -0,0 +1,55 @@
+// Copyright (C) 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_IMAGE_DIMENSION_1D_HH
+# define OLENA_CORE_ABSTRACT_IMAGE_DIMENSION_1D_HH
+
+# include <oln/core/abstract/image.hh>
+
+namespace oln
+{
+
+ namespace abstract
+ {
+
+ /// Class of 1-D images.
+ template <typename E>
+ struct image1d :
+ public virtual image<E>,
+ public automatic::impl< image1d, oln_type_of(E, morpher), E>
+ {
+ protected:
+ /// Constructor (protected, empty).
+ image1d() {}
+ };
+
+ } // end of namespace oln::abstract
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_DIMENSION_1D_HH
Index: oln/core/abstract/image/dimension/2d.hh
===================================================================
--- oln/core/abstract/image/dimension/2d.hh (revision 0)
+++ oln/core/abstract/image/dimension/2d.hh (revision 0)
@@ -0,0 +1,56 @@
+// Copyright (C) 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_IMAGE_DIMENSION_2D_HH
+# define OLENA_CORE_ABSTRACT_IMAGE_DIMENSION_2D_HH
+
+# include <oln/core/abstract/image.hh>
+
+
+namespace oln
+{
+
+ namespace abstract
+ {
+
+ /// Class of 2-D images.
+ template <typename E>
+ struct image2d :
+ public virtual image<E>,
+ public automatic::impl< image2d, oln_type_of(E, morpher), E>
+ {
+ protected:
+ /// Constructor (protected, empty).
+ image2d() {}
+ };
+
+ } // end of namespace oln::abstract
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_DIMENSION_2D_HH
Index: oln/core/abstract/image/dimension/3d.hh
===================================================================
--- oln/core/abstract/image/dimension/3d.hh (revision 0)
+++ oln/core/abstract/image/dimension/3d.hh (revision 0)
@@ -0,0 +1,56 @@
+// Copyright (C) 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_IMAGE_DIMENSION_3D_HH
+# define OLENA_CORE_ABSTRACT_IMAGE_DIMENSION_3D_HH
+
+# include <oln/core/abstract/image.hh>
+
+
+namespace oln
+{
+
+ namespace abstract
+ {
+
+ /// Class of 3-D images.
+ template <typename E>
+ struct image3d :
+ public virtual image<E>,
+ public automatic::impl< image3d, oln_type_of(E, morpher), E>
+ {
+ protected:
+ /// Constructor (protected, empty).
+ image3d() {}
+ };
+
+ } // end of namespace oln::abstract
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_DIMENSION_3D_HH
Index: oln/core/abstract/image/dimension/hierarchy.hh
===================================================================
--- oln/core/abstract/image/dimension/hierarchy.hh (revision 0)
+++ oln/core/abstract/image/dimension/hierarchy.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_IMAGE_DIMENSION_HH
-# define OLENA_CORE_ABSTRACT_IMAGE_DIMENSION_HH
+#ifndef OLENA_CORE_ABSTRACT_IMAGE_DIMENSION_HIERARCHY_HH
+# define OLENA_CORE_ABSTRACT_IMAGE_DIMENSION_HIERARCHY_HH
# include <oln/core/abstract/image.hh>
@@ -73,50 +73,11 @@
| Dimension abstractions. |
`-------------------------*/
-namespace oln
-{
-
- namespace abstract
- {
+# include <oln/core/abstract/image/dimension/1d.hh>
+# include <oln/core/abstract/image/dimension/2d.hh>
+# include <oln/core/abstract/image/dimension/3d.hh>
- /// Class of 1-D images.
- template <typename E>
- struct image1d :
- public virtual image<E>,
- public automatic::impl< image1d, oln_type_of(E, morpher), E>
- {
- protected:
- /// Constructor (protected, empty).
- image1d() {}
- };
- /// Class of 2-D images.
- template <typename E>
- struct image2d :
- public virtual image<E>,
- public automatic::impl< image2d, oln_type_of(E, morpher), E>
- {
- protected:
- /// Constructor (protected, empty).
- image2d() {}
- };
-
- /// Class of 3-D images.
- template <typename E>
- struct image3d :
- public virtual image<E>,
- public automatic::impl< image3d, oln_type_of(E, morpher), E>
- {
- protected:
- /// Constructor (protected, empty).
- image3d() {}
- };
-
- } // end of namespace oln::abstract
-
-} // end of namespace oln
-
-
/*-------------------.
| Dimension switch. |
`-------------------*/
@@ -156,4 +117,4 @@
}
-#endif // ! OLENA_CORE_ABSTRACT_IMAGE_DIMENSION_HH
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_DIMENSION_HIERARCHY_HH
Index: oln/core/abstract/image/neighborhood/hierarchy.hh
===================================================================
--- oln/core/abstract/image/neighborhood/hierarchy.hh (revision 0)
+++ oln/core/abstract/image/neighborhood/hierarchy.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_IMAGE_HAVING_NEIGHBORHOOD_HH
-# define OLENA_CORE_ABSTRACT_IMAGE_HAVING_NEIGHBORHOOD_HH
+#ifndef OLENA_CORE_ABSTRACT_IMAGE_NEIGHBORHOOD_HIERARCHY_HH
+# define OLENA_CORE_ABSTRACT_IMAGE_NEIGHBORHOOD_HIERARCHY_HH
# include <oln/core/abstract/image.hh>
@@ -95,4 +95,4 @@
} // end of namespace oln
-#endif // ! OLENA_CORE_ABSTRACT_IMAGE_HAVING_NEIGHBORHOOD_HH
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_NEIGHBORHOOD_HIERARCHY_HH
Index: oln/core/abstract/image_dimension.hh
===================================================================
--- oln/core/abstract/image_dimension.hh (revision 569)
+++ oln/core/abstract/image_dimension.hh (working copy)
@@ -1,159 +0,0 @@
-// Copyright (C) 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_IMAGE_DIMENSION_HH
-# define OLENA_CORE_ABSTRACT_IMAGE_DIMENSION_HH
-
-# include <oln/core/abstract/image.hh>
-
-
-/* Image dimension hierarchy (summary).
-
-
- /image<I>/
- ^
- |
- ,------------------------+------------------------.
- | | |
- /image1d<I>/ /image2d<I>/ /image3d<I>/
- ^ ^ ^
- | | |
- ,---------------------. ,---------------------. ,---------------------.
- | if type_of(I, grid) | | if type_of(I, grid) | | if type_of(I, grid) |
- | == grid1d | | == grid2d | | == grid3d |
- `---------------------' `---------------------' `---------------------'
- | | |
- o o o
-
- o
- |
- /switch_<image_hierarchy_wrt_dimension, I>::ret/
- (image dimension selector)
- ^
- |
- /entry<abstract::image, I>/
- ^
- |
- image_entry<I>
- ^
- |
- I
- (a concrete image)
-
-
- Default case: If no known grid type is returned by `oln_type_of(I, grid)',
- the entry is directly plugged to abstract::image<I>. */
-
-
-/*-------------------------.
-| Dimension abstractions. |
-`-------------------------*/
-
-namespace oln
-{
-
- namespace abstract
- {
-
- /// Class of 1-D images.
- template <typename E>
- struct image1d :
- public virtual image<E>,
- public automatic::impl< image1d, oln_type_of(E, morpher), E>
- {
- protected:
- /// Constructor (protected, empty).
- image1d() {}
- };
-
- /// Class of 2-D images.
- template <typename E>
- struct image2d :
- public virtual image<E>,
- public automatic::impl< image2d, oln_type_of(E, morpher), E>
- {
- protected:
- /// Constructor (protected, empty).
- image2d() {}
- };
-
- /// Class of 3-D images.
- template <typename E>
- struct image3d :
- public virtual image<E>,
- public automatic::impl< image3d, oln_type_of(E, morpher), E>
- {
- protected:
- /// Constructor (protected, empty).
- image3d() {}
- };
-
- } // end of namespace oln::abstract
-
-} // end of namespace oln
-
-
-/*-------------------.
-| Dimension switch. |
-`-------------------*/
-
-namespace oln
-{
-
- // Forward declarations.
- class grid1d;
- class grid2d;
- class grid3d;
-
- /// 1-D case.
- template <typename E>
- struct case_< image_hierarchy_wrt_dimension, E, 1 > :
- where_< mlc::eq_< oln_type_of(E, grid), oln::grid1d > >
- {
- typedef abstract::image1d<E> ret;
- };
-
- /// 2-D case.
- template <typename E>
- struct case_< image_hierarchy_wrt_dimension, E, 2 > :
- where_< mlc::eq_< oln_type_of(E, grid), oln::grid2d > >
- {
- typedef abstract::image2d<E> ret;
- };
-
- /// 3-D case.
- template <typename E>
- struct case_< image_hierarchy_wrt_dimension, E, 3 > :
- where_< mlc::eq_< oln_type_of(E, grid), oln::grid3d > >
- {
- typedef abstract::image3d<E> ret;
- };
-
-}
-
-
-#endif // ! OLENA_CORE_ABSTRACT_IMAGE_DIMENSION_HH
Index: oln/core/abstract/image_hierarchies.hh
===================================================================
--- oln/core/abstract/image_hierarchies.hh (revision 569)
+++ oln/core/abstract/image_hierarchies.hh (working copy)
@@ -1,61 +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_IMAGE_HIERARCHIES_HH
-# define OLENA_CORE_ABSTRACT_IMAGE_HIERARCHIES_HH
-
-# include <oln/core/abstract/image.hh>
-
-
-namespace oln
-{
-
- 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, 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 569)
+++ oln/core/abstract/image_type_integre.hh (working copy)
@@ -1,145 +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.
-
-
-// FIXME: Move this file into Integre? Or in a another project,
-// serving as a glue between Integre and Olena?
-
-#ifndef OLENA_CORE_ABSTRACT_IMAGE_TYPE_INTEGRE_HH
-# define OLENA_CORE_ABSTRACT_IMAGE_TYPE_INTEGRE_HH
-
-# include <oln/core/abstract/image_type.hh>
-
-
-// Forward declarations.
-/* FIXME: These are Integre values; should'nt we let Integre add the
- necessary cases itself? */
-namespace ntg
-{
- class bin;
- template <unsigned nbits, typename behavior> class int_u;
- template <unsigned nbits, typename behavior> class int_s;
- template <typename E> class color_value;
- template <typename E> class enum_value;
- template <typename E> class real_value;
-
- /** \brief ``eq'' operator dedicated to ntg::int_u<nbits, behavior> and
- ntg::int_s<nbits, behavior>, with nbits a known unsigned (e.g.,
- int_u<1, behavior>).
-
- Checking whether value_type is a ntg::int_u<1, behavior>
- (behavior being a template parameter) is a bit tricky: we
- can't use mlc_eq() since ntg::int_u<1, B> is not a (complete)
- type, nor mlc_is_a(), since it is a partially-valued template.
- Hence this dedicated approach, used for ntg::int_u and
- ntg::int_s.
-
- (Olena proto-1.0 used to mimic mlc_is_a with its own
- machinery, for all kind of value type, which is redundant with
- mlc_is_a).
- \{ */
- template< template <unsigned, class> class T, unsigned nbits, typename U >
- struct eq_ : public mlc::bexpr_<false>
- {
- };
-
- template< template <unsigned, class> class T, unsigned nbits,
- typename behavior >
- struct eq_< T, nbits, T<nbits, behavior> > : public mlc::bexpr_<true>
- {
- };
- /** \} */
-
-} // end of namespace ntg
-
-
-/*----------------------.
-| Type switch (cont.). |
-`----------------------*/
-
-namespace oln {
-
-
- /// Switch on on the value type.
- /// \{
-
- // ----------------------------------------------- //
- // Cases where the value type is an Integre type. //
- // ----------------------------------------------- //
-
- // (The first cases are located in oln/core/abstract/image_type.hh).
-
-
- /// Binary case.
- template <typename E>
- 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)> > >
- {
- // Definition of the super class corresponding to this case.
- typedef abstract::binary_image<E> ret;
- };
-
- /// Grey-level case.
- template <typename E>
- 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
- // (abstract::grey_level_image_ is the conjunction of
- // abstract::grey_level_image and abstract::not_binary_image).
- typedef abstract::internal::grey_level_image_<E> ret;
- };
-
- /// Label case.
- template <typename E>
- 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
- // (abstract::label_image_ is the conjunction of
- // abstract::label_image and abstract::not_binary_image).
- typedef abstract::internal::label_image_<E> ret;
- };
-
- /// Color case.
- template <typename E>
- 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
- // (abstract::color_image_ is the conjunction of
- // abstract::color_image and abstract::not_binary_image).
- typedef abstract::internal::color_image_<E> ret;
- };
-
- /// \}
-
-} // end of namespace oln
-
-#endif // ! OLENA_CORE_ABSTRACT_IMAGE_TYPE_INTEGRE_HH
Index: oln/core/abstract/image_having_neighborhood.hh
===================================================================
--- oln/core/abstract/image_having_neighborhood.hh (revision 569)
+++ oln/core/abstract/image_having_neighborhood.hh (working copy)
@@ -1,98 +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_IMAGE_HAVING_NEIGHBORHOOD_HH
-# define OLENA_CORE_ABSTRACT_IMAGE_HAVING_NEIGHBORHOOD_HH
-
-# include <oln/core/abstract/image.hh>
-
-// Automatically-inherited implementations.
-# include <oln/automatic/image_having_neighborhood.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
- {
-
- /// Image having a neighborhood.
- template <typename E>
- struct image_having_neighborhood :
- public virtual image<E>,
- public automatic::impl< image_having_neighborhood,
- oln_type_of(E, morpher),
- E >
- {
- private:
- typedef oln_type_of(E, neighborhood) neighborhood_t;
-
- public:
- neighborhood_t neighborhood() const
- {
- return this->topo().neighborhood();
- }
-
- protected:
- /// Constructor (protected, empty).
- image_having_neighborhood() {}
- };
-
- } // end of namespace oln::abstract
-
-
- /*-------------------.
- | Dimension switch. |
- `-------------------*/
-
- /// With neighborhood.
- template <typename E>
- struct case_< image_hierarchy_wrt_neighborhood, E, 1 > :
- where_< mlc::neq_< oln_type_of(E, neighborhood), mlc::not_found > >
- {
- typedef abstract::image_having_neighborhood<E> ret;
- };
-
-} // end of namespace oln
-
-
-#endif // ! OLENA_CORE_ABSTRACT_IMAGE_HAVING_NEIGHBORHOOD_HH
Index: oln/Makefile.am
===================================================================
--- oln/Makefile.am (revision 569)
+++ oln/Makefile.am (working copy)
@@ -30,11 +30,19 @@
core/abstract/entry.hh \
core/abstract/grid.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/image/dimension/1d.hh \
+ core/abstract/image/dimension/2d.hh \
+ core/abstract/image/dimension/3d.hh \
+ core/abstract/image/dimension/hierarchy.hh \
+ core/abstract/image/hierarchies.hh \
+ core/abstract/image/neighborhood/hierarchy.hh \
+ core/abstract/image/type/binary.hh \
+ core/abstract/image/type/color.hh \
+ core/abstract/image/type/data.hh \
+ core/abstract/image/type/grey_level.hh \
+ core/abstract/image/type/hierarchy.hh \
+ core/abstract/image/type/integre.hh \
+ core/abstract/image/type/label.hh \
core/abstract/iterator.hh \
core/abstract/iterator_on_points.hh \
core/abstract/neighborhood.hh \