Index: ChangeLog
from Nicolas Widynski <nicolas.widynski(a)lrde.epita.fr>
* oln/core/properties.hh: Change properties for neighborhood hierarchy.
* oln/core/abstract/image.hh: Add neigbh_type property.
* oln/core/abstract/image_neighbness.hh: New. Add neighborhood
hierarchy.
* oln/core/abstract/entry.hh: Add image_neighbness into hierarchy.
* oln/core/abstract/image_with_extension.hh: New. Add image with extension hierarchy.
* oln/core/gen/image_with_nbh.hh: New. Concrete image and neighborhood class.
abstract/entry.hh | 4 -
abstract/image.hh | 8 ++
abstract/image_neighbness.hh | 76 +++++++++++++++++++++++++
abstract/image_with_extension.hh | 118 +++++++++++++++++++++++++++++++++++++++
gen/image_with_nbh.hh | 110 ++++++++++++++++++++++++++++++++++++
properties.hh | 3
6 files changed, 318 insertions(+), 1 deletion(-)
Index: oln/core/properties.hh
--- oln/core/properties.hh (revision 123)
+++ oln/core/properties.hh (working copy)
@@ -55,9 +55,11 @@
{
struct data_type;
struct value_type;
+ struct neighb_type;
struct value_storage_type;
struct storage_type;
struct point_type;
+ struct image_type;
struct concrete_type;
struct dpoint_type;
struct piter_type;
@@ -70,6 +72,7 @@
struct se_type;
struct window_type;
+ struct image_neighbness_type;
struct image_constness_type;
struct image_dimension_type;
struct image_vectorialness_type;
Index: oln/core/abstract/image.hh
--- oln/core/abstract/image.hh (revision 123)
+++ oln/core/abstract/image.hh (working copy)
@@ -45,6 +45,7 @@
namespace abstract {
template <typename E> struct image;
template <typename E> struct readonly_image;
+ template <typename E> struct image_without_nbh;
}
// category
@@ -70,7 +71,10 @@
mlc_decl_prop_with_default(category::image, value_storage_type, mlc::no_type);
mlc_decl_prop_with_default(category::image, storage_type, mlc::no_type);
mlc_decl_prop_with_default(category::image, delegated_type, mlc::no_type);
+ mlc_decl_prop_with_default(category::image, neighb_type, mlc::no_type);
+
+ mlc_decl_prop_with_default(category::image, image_neighbness_type,
is_a<abstract::image_without_nbh>);
mlc_decl_prop_with_default(category::image, image_constness_type,
is_a<abstract::readonly_image>);
mlc_decl_prop(category::image, image_dimension_type);
mlc_decl_prop(category::image, image_vectorialness_type);
@@ -83,6 +87,7 @@
<< ", " << typeid(type).name() << ") = {"
<< " concrete_type = " << typeid(concrete_type).name()
<< " value_type = " << typeid(value_type).name()
+ << " neighb_type = " << typeid(neighb_type).name()
<< " point_type = " << typeid(point_type).name()
<< " size_type = " << typeid(size_type).name()
<< " fwd_piter_type = " << typeid(fwd_piter_type).name()
@@ -93,12 +98,14 @@
<< " image_constness_type = " <<
typeid(image_constness_type).name()
<< " image_dimension_type = " <<
typeid(image_dimension_type).name()
<< " image_vectorialness_type = " <<
typeid(image_vectorialness_type).name()
+ << " image_neighbness_type = " <<
typeid(image_neighbness_type).name()
<< " }" << std::endl;
}
};
+ mlc_register_prop(category::image, neighb_type);
mlc_register_prop(category::image, concrete_type);
mlc_register_prop(category::image, value_type);
mlc_register_prop(category::image, point_type);
@@ -113,6 +120,7 @@
mlc_register_prop(category::image, image_constness_type);
mlc_register_prop(category::image, image_dimension_type);
mlc_register_prop(category::image, image_vectorialness_type);
+ mlc_register_prop(category::image, image_neighbness_type);
Index: oln/core/abstract/image_neighbness.hh
--- oln/core/abstract/image_neighbness.hh (revision 0)
+++ oln/core/abstract/image_neighbness.hh (revision 0)
@@ -0,0 +1,76 @@
+// Copyright (C) 2005 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, 59 Temple Place - Suite 330, 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_NEIGHBNESS_HH
+# define OLENA_CORE_ABSTRACT_IMAGE_NEIGHBNESS_HH
+
+# include <mlc/bool.hh>
+
+# include <ntg/basics.hh>
+
+# include <oln/core/abstract/image.hh>
+
+/*! \namespace oln
+** \brief oln namespace.
+*/
+namespace oln {
+
+ /*! \namespace oln::abstract
+ ** \brief oln::abstract namespace.
+ */
+ namespace abstract {
+
+
+ template <typename E>
+ struct image_with_nbh : public virtual image<E>
+ {
+ public:
+
+ typedef oln_type_of(E, neighb) neighb_type;
+
+ const neighb_type& nbh_get() const
+ {
+ return this->exact().impl_nbh_get();
+ }
+
+ protected:
+ image_with_nbh() {}
+ };
+
+ template <typename E>
+ struct image_without_nbh : public virtual image<E>
+ {
+ protected:
+ image_without_nbh() {}
+ };
+
+
+ } // end of namespace oln::abstract
+
+} // end of namespace oln
+
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_NEIGHBNESS_HH
Index: oln/core/abstract/entry.hh
--- oln/core/abstract/entry.hh (revision 123)
+++ oln/core/abstract/entry.hh (working copy)
@@ -31,6 +31,7 @@
# include <oln/core/abstract/image_constness.hh>
# include <oln/core/abstract/image_dimension.hh>
# include <oln/core/abstract/image_vectorialness.hh>
+# include <oln/core/abstract/image_neighbness.hh>
// FIXME: this file should move to oln/core/abstract/
@@ -70,8 +71,9 @@
// intrusive:
public oln_type_of_(E, image_constness) ::template
instantiated_with<E>::ret,
public oln_type_of_(E, image_dimension) ::template
instantiated_with<E>::ret,
+ public oln_type_of_(E, image_neighbness) ::template
instantiated_with<E>::ret,
public oln_type_of_(E, image_vectorialness) ::template
instantiated_with<E>::ret
- // ...
+ // ...
{
protected:
image_entry() {}
Index: oln/core/abstract/image_with_extension.hh
--- oln/core/abstract/image_with_extension.hh (revision 0)
+++ oln/core/abstract/image_with_extension.hh (revision 0)
@@ -0,0 +1,118 @@
+// Copyright (C) 2005 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, 59 Temple Place - Suite 330, 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_WITH_EXTENSION__HH
+# define OLENA_CORE_ABSTRACT_IMAGE_WITH_EXTENSION__HH
+
+# include <oln/core/abstract/image_by_delegation.hh>
+
+
+namespace oln {
+
+
+ // fwd decl
+ namespace abstract {
+ template <typename I, typename E> struct image_with_extension_;
+ }
+
+ // category
+
+ template <typename I, typename E>
+ struct set_category< abstract::image_with_extension_<I, E> > {
+ typedef category::image ret;
+ };
+
+ // super type
+
+ template <typename I, typename E>
+ struct set_super_type < abstract::image_with_extension_<I, E> >
+ {
+ typedef abstract::image_by_delegation<I, E> ret;
+ };
+
+ // props
+
+ template <typename I, typename E>
+ struct set_props < category::image, abstract::image_with_extension_<I, E> >
: public props_of<category::image>
+ {
+ typedef oln_type_of(I, concrete) concrete_type;
+ };
+
+
+ namespace abstract {
+
+ /// Mutable version of image_with_extension_.
+
+ template <typename I, typename E>
+ struct image_with_extension_ : public image_by_delegation<I, E>
+ {
+ typedef image_by_delegation<I, E> super_type;
+
+ public:
+
+ image_with_extension_ ()
+ {
+ }
+
+ image_with_extension_(abstract::image<I>& image) :
+ super_type(image)
+ {
+ }
+
+ const I& real() const
+ {
+ return this->image_.unbox();
+ }
+
+ I& real()
+ {
+ return this->image_.unbox();
+ }
+
+ ~image_with_extension_ ()
+ {
+ // FIXME : This class must check all properties
+
+// mlc_or( mlc_eq(oln_type_of(I,neighb_type), mlc::no_type),
+// mlc_eq(oln_type_of(I,neighb_type), oln_type_of(E,neighb_type))
+// )::ensure();
+
+ // if (Prop(I) != no_type)
+ // Prop(E) = Prop(I)
+ }
+
+
+ };
+
+ } // end of namespace oln::abstract
+
+
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ABSTRACT_IMAGE_WITH_EXTENSION__HH
Index: oln/core/gen/image_with_nbh.hh
--- oln/core/gen/image_with_nbh.hh (revision 0)
+++ oln/core/gen/image_with_nbh.hh (revision 0)
@@ -0,0 +1,110 @@
+// Copyright (C) 2005 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, 59 Temple Place - Suite 330, 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_IMAGE_WITH_NBH_HH
+# define OLENA_CORE_GEN_IMAGE_WITH_NBH_HH
+
+# include <oln/core/abstract/image_with_extension.hh>
+# include <oln/core/abstract/image.hh>
+# include <oln/core/abstract/neighborhood.hh>
+# include <oln/core/properties.hh>
+
+namespace oln {
+
+ // fwd decls
+
+ namespace internal {
+ template <typename I, typename N> struct image_with_nbh;
+ }
+
+ // category
+
+ template <typename I, typename N>
+ struct set_category< internal::image_with_nbh<I, N> > {
+ typedef category::image ret;
+ };
+
+ // super type
+
+ template <typename I, typename N>
+ struct set_super_type < internal::image_with_nbh<I, N> >
+ {
+ typedef abstract::image_with_extension_ < I, internal::image_with_nbh<I, N>
> ret;
+ };
+
+ template <typename I, typename N>
+ struct set_props < category::image, internal::image_with_nbh<I, N> > :
public props_of<category::image>
+ {
+ typedef is_a<abstract::image_with_nbh> image_neighbness_type;
+ typedef N neighb_type;
+ };
+
+ namespace internal
+ {
+
+ template <typename I, typename N>
+ struct image_with_nbh : public oln::abstract::image_with_extension_ < I,
image_with_nbh<I, N> >
+ {
+ typedef image_with_nbh<I, N> self_type;
+ typedef oln::abstract::image_with_extension_ < I, self_type > super_type;
+
+ public:
+
+ image_with_nbh(abstract::image<I>& rhs,
+ abstract::neighborhood<N>& nbh) :
+ super_type(rhs), nbh_(nbh.exact())
+ {
+ }
+
+ const N& impl_nbh_get() const
+ {
+ return nbh_;
+ }
+
+ protected:
+ N& nbh_;
+ };
+
+ } // end of namespace oln::internal
+
+
+
+ /// the 'image_with_nbh' method for images
+
+ template <typename I, typename N>
+ internal::image_with_nbh<I, N>
+ join(abstract::image<I>& ima,
+ abstract::neighborhood<N>& nbh)
+ {
+ internal::image_with_nbh<I, N> tmp(ima, nbh);
+ return tmp;
+ }
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_GEN_IMAGE_WITH_NBH_HH