https://svn.lrde.epita.fr/svn/oln/trunk
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Remove virtual type `is_value_wise_mutable'.
* oln/core/typedefs.hh (is_value_wise_mutable): Remove virtual
type declaration.
* oln/core/abstract/image/value_wise_accessibility/hierarchy.hh:
(case_<image_hierarchy_wrt_value_wise_accessibility, E, 1>): No
longer use the virtual type `is_value_wise_mutable' in the
static switch condition; query `mutable_value_proxy' instead.
* olena/oln/morpher/with_lut.hh
(vtypes< morpher::with_lut<Image, Lut> >::is_value_wise_mutable_type):
Remove typedef.
core/abstract/image/value_wise_accessibility/hierarchy.hh | 8 +-------
core/typedefs.hh | 2 --
morpher/with_lut.hh | 11 +++--------
3 files changed, 4 insertions(+), 17 deletions(-)
Index: olena/oln/core/typedefs.hh
--- olena/oln/core/typedefs.hh (revision 701)
+++ olena/oln/core/typedefs.hh (working copy)
@@ -129,8 +129,6 @@
mlc_decl_typedef(topo_type);
mlc_decl_typedef(bbox_type);
- mlc_decl_typedef(is_value_wise_mutable_type);
-
/*-------.
| Grid. |
Index: olena/oln/core/abstract/image/value_wise_accessibility/hierarchy.hh
--- olena/oln/core/abstract/image/value_wise_accessibility/hierarchy.hh (revision 701)
+++ olena/oln/core/abstract/image/value_wise_accessibility/hierarchy.hh (working copy)
@@ -130,17 +130,11 @@
| Value-wise accessibility switch. |
`----------------------------------*/
- /* FIXME: Handle mutability. This is not easy, as, for instance an
- image with LUT has no lvalue type, but can be perfectly const or
- mutable. How can we deal with this? By adding a specific
- vtype? */
-
/// With mutable value-wise random accessibility.
template <typename E>
struct case_< image_hierarchy_wrt_value_wise_accessibility, E, 1 > :
where_< mlc_and( mlc_is_ok(oln_type_of(E, fwd_viter)),
- mlc_eq( oln_type_of(E, is_value_wise_mutable),
- mlc::true_) ) >
+ mlc_is_ok(oln_type_of(E, mutable_value_proxy)) ) >
{
typedef abstract::mutable_image_being_value_wise_random_accessible<E> ret;
};
Index: olena/oln/morpher/with_lut.hh
--- olena/oln/morpher/with_lut.hh (revision 701)
+++ olena/oln/morpher/with_lut.hh (working copy)
@@ -71,17 +71,12 @@
/* lvalue_type: undefined
(see oln/morpher/internal/image_value_morpher.hh). */
- /* FIXME: This virtual type (``is_value_wise_mutable'') is
- useless, since the presence of mutable_value_proxy_type
- suffices to state that the image is value-wise mutable. */
-
+ typedef value::lut_value_proxy<Lut> value_proxy_type;
/* Mutability.
As the virtual type `lvalue' is undefined in with_lut<>, it is
not point-wise mutable. However, it is value-wise mutable,
- i.e., the values of the look-up table can be modified. */
- typedef mlc::true_ is_value_wise_mutable_type;
-
- typedef value::lut_value_proxy<Lut> value_proxy_type;
+ i.e., the values of the look-up table can be modified through
+ a mutable value proxy. */
typedef value::mutable_lut_value_proxy<Lut> mutable_value_proxy_type;
// fwd_viter_type: see below.
2006-11-07 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Add point-set types based on std containers.
* oln/core/gen/piter_on_std_based_pset.hh: New.
* oln/core/gen/pset_list.hh: New.
* oln/core/gen/pset_vec.hh: New.
* oln/core/gen/pset_.hh: New.
* oln/Makefile.am: Update.
2006-11-06 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
Index: oln/core/gen/piter_on_std_based_pset.hh
===================================================================
--- oln/core/gen/piter_on_std_based_pset.hh (revision 0)
+++ oln/core/gen/piter_on_std_based_pset.hh (revision 0)
@@ -0,0 +1,278 @@
+// Copyright (C) 2006 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLN_CORE_GEN_PITER_ON_STD_BASED_PSET_HH
+# define OLN_CORE_GEN_PITER_ON_STD_BASED_PSET_HH
+
+# include <oln/core/abstract/point.hh>
+# include <oln/core/abstract/iterator_on_points.hh>
+
+
+namespace oln
+{
+
+
+ // Fwd_piter version.
+ // ------------------
+
+
+ // Forward declaration.
+ template <typename C> class fwd_piter_on_std_based_pset;
+
+
+ // Super.
+ template <typename C>
+ struct set_super_type< fwd_piter_on_std_based_pset<C> >
+ {
+ typedef abstract::iterator_on_points< fwd_piter_on_std_based_pset<C> > ret;
+ };
+
+
+ // Vtypes.
+ template <typename C>
+ struct vtypes< fwd_piter_on_std_based_pset<C> >
+ {
+ typedef typename C::value_type point_type;
+ };
+
+
+ // Class.
+ template <typename C>
+ class fwd_piter_on_std_based_pset :
+
+ public abstract::iterator_on_points< fwd_piter_on_std_based_pset<C> >,
+ private mlc::assert_< mlc_is_a(typename C::value_type, abstract::point) >
+ {
+ public:
+ fwd_piter_on_std_based_pset(const C& container);
+
+ template <typename point_set>
+ fwd_piter_on_std_based_pset(const point_set& ps);
+
+ void impl_start();
+ void impl_next();
+ void impl_invalidate();
+ bool impl_is_valid() const;
+ typename C::value_type impl_to_point() const;
+ const typename C::value_type* impl_point_adr() const;
+
+ private:
+
+ const C& container_;
+ typename C::const_iterator it_;
+
+ }; // end of class fwd_piter_on_std_based_pset<C>
+
+
+
+ // Bkd_piter version.
+ // ------------------
+
+
+ // Forward declaration.
+ template <typename C> class bkd_piter_on_std_based_pset;
+
+
+ // Super.
+ template <typename C>
+ struct set_super_type< bkd_piter_on_std_based_pset<C> >
+ {
+ typedef abstract::iterator_on_points< bkd_piter_on_std_based_pset<C> > ret;
+ };
+
+
+ // Vtypes.
+ template <typename C>
+ struct vtypes< bkd_piter_on_std_based_pset<C> >
+ {
+ typedef typename C::value_type point_type;
+ };
+
+
+ // Class.
+ template <typename C>
+ class bkd_piter_on_std_based_pset :
+
+ public abstract::iterator_on_points< bkd_piter_on_std_based_pset<C> >,
+ private mlc::assert_< mlc_is_a(typename C::value_type, abstract::point) >
+ {
+ public:
+ bkd_piter_on_std_based_pset(const C& container);
+
+ template <typename point_set>
+ bkd_piter_on_std_based_pset(const point_set& ps);
+
+ void impl_start();
+ void impl_next();
+ void impl_invalidate();
+ bool impl_is_valid() const;
+ typename C::value_type impl_to_point() const;
+ const typename C::value_type* impl_point_adr() const;
+
+ private:
+
+ const C& container_;
+ typename C::const_reverse_iterator it_;
+
+ }; // end of class bkd_piter_on_std_based_pset<C>
+
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+
+ // fwd_piter_on_std_based_pset<C>
+
+
+ template <typename C>
+ fwd_piter_on_std_based_pset<C>::fwd_piter_on_std_based_pset(const C& container)
+ : container_(container)
+ {
+ this->invalidate();
+ }
+
+ template <typename C>
+ template <typename point_set>
+ fwd_piter_on_std_based_pset<C>::fwd_piter_on_std_based_pset(const point_set& ps)
+ : container_(ps.exact().container())
+ {
+ this->invalidate();
+ }
+
+ template <typename C>
+ void fwd_piter_on_std_based_pset<C>::impl_start()
+ {
+ it_ = container_.begin();
+ }
+
+ template <typename C>
+ void fwd_piter_on_std_based_pset<C>::impl_next()
+ {
+ ++it_;
+ }
+
+ template <typename C>
+ void fwd_piter_on_std_based_pset<C>::impl_invalidate()
+ {
+ it_ = container_.end();
+ }
+
+ template <typename C>
+ bool fwd_piter_on_std_based_pset<C>::impl_is_valid() const
+ {
+ return it_ != container_.end();
+ }
+
+ template <typename C>
+ typename C::value_type
+ fwd_piter_on_std_based_pset<C>::impl_to_point() const
+ {
+ return *it_;
+ }
+
+ template <typename C>
+ const typename C::value_type*
+ fwd_piter_on_std_based_pset<C>::impl_point_adr() const
+ {
+ return 0;
+ // FIXME: Read below.
+ // "&(*it_)" is not correct because the std does not ensure that
+ // "*it_" is dereferenceable (Cf. std trivial iterator concept).
+ // However, "::point_adr()" is only required so that an iterator
+ // based on another iterator (e.g., a niter constructed from a
+ // piter) can stick to the point location of the latter. This
+ // is not required for iterators on point set so this method should
+ // be optional.
+ }
+
+
+ // bkd_piter_on_std_based_pset<C>
+
+
+ template <typename C>
+ bkd_piter_on_std_based_pset<C>::bkd_piter_on_std_based_pset(const C& container)
+ : container_(container)
+ {
+ this->invalidate();
+ }
+
+ template <typename C>
+ template <typename point_set>
+ bkd_piter_on_std_based_pset<C>::bkd_piter_on_std_based_pset(const point_set& ps)
+ : container_(ps.exact().container())
+ {
+ this->invalidate();
+ }
+
+ template <typename C>
+ void bkd_piter_on_std_based_pset<C>::impl_start()
+ {
+ it_ = container_.rbegin();
+ }
+
+ template <typename C>
+ void bkd_piter_on_std_based_pset<C>::impl_next()
+ {
+ ++it_;
+ }
+
+ template <typename C>
+ void bkd_piter_on_std_based_pset<C>::impl_invalidate()
+ {
+ it_ = container_.rend();
+ }
+
+ template <typename C>
+ bool bkd_piter_on_std_based_pset<C>::impl_is_valid() const
+ {
+ return it_ != container_.rend();
+ }
+
+ template <typename C>
+ typename C::value_type
+ bkd_piter_on_std_based_pset<C>::impl_to_point() const
+ {
+ return *it_;
+ }
+
+ template <typename C>
+ const typename C::value_type*
+ bkd_piter_on_std_based_pset<C>::impl_point_adr() const
+ {
+ return 0;
+ // FIXME: Read comments in the fwd version of this method.
+ }
+
+
+# endif
+
+
+} // end of namespace oln
+
+
+#endif // ! OLN_CORE_GEN_PITER_ON_STD_BASED_PSET_HH
Index: oln/core/gen/pset_list.hh
===================================================================
--- oln/core/gen/pset_list.hh (revision 0)
+++ oln/core/gen/pset_list.hh (revision 0)
@@ -0,0 +1,181 @@
+// Copyright (C) 2006 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLN_CORE_GEN_PSET_LIST_HH
+# define OLN_CORE_GEN_PSET_LIST_HH
+
+# include <list>
+
+# include <oln/core/point_set_entry.hh>
+# include <oln/core/abstract/point.hh>
+
+
+namespace oln
+{
+
+ // Forward declarations.
+ template <typename point_t> class pset_list;
+ template <typename C> class fwd_piter_on_std_based_pset;
+ template <typename C> class bkd_piter_on_std_based_pset;
+
+
+ // Super type declaration.
+ template <typename point_t>
+ struct set_super_type< pset_list<point_t> >
+ {
+ typedef pset_list<point_t> self_t;
+ typedef point_set_entry<self_t> ret;
+ };
+
+
+ /// Virtual types associated to oln::pset_list<point_t>.
+ template <typename point_t>
+ struct vtypes< pset_list<point_t> >
+ {
+ typedef point_t point_type;
+ typedef fwd_piter_on_std_based_pset< std::list<point_t> > fwd_piter_type;
+ typedef bkd_piter_on_std_based_pset< std::list<point_t> > bkd_piter_type;
+
+ typedef mlc::false_ is_random_accessible_type;
+ typedef mlc::true_ has_know_size_type;
+ typedef mlc::false_ is_connected_type;
+ };
+
+
+ /// Bounding box class based on a point class.
+ template <typename point_t>
+ class pset_list : public point_set_entry< pset_list<point_t> >,
+ private mlc::assert_< mlc_is_a(point_t, abstract::point) >
+ {
+ typedef pset_list<point_t> self_type;
+ typedef point_set_entry<self_type> super_t;
+
+ public:
+
+ pset_list();
+ pset_list(const pset_list<point_t>& rhs);
+ pset_list<point_t>& operator=(const pset_list<point_t>& rhs);
+
+ unsigned impl_npoints() const;
+ bool impl_is_valid() const;
+ void impl_print(std::ostream& ostr) const;
+
+ pset_list<point_t>& append(const point_t& p);
+ pset_list<point_t>& prepend(const point_t& p);
+
+ const std::list<point_t>& container() const;
+ std::list<point_t>& container();
+
+ protected:
+
+ std::list<point_t> lp_;
+
+ }; // end of class oln::pset_list<point_t>
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename point_t>
+ pset_list<point_t>::pset_list()
+ {
+ }
+
+ template <typename point_t>
+ pset_list<point_t>::pset_list(const pset_list<point_t>& rhs)
+ {
+ lp_ = rhs.lp_;
+ }
+
+ template <typename point_t>
+ pset_list<point_t>& pset_list<point_t>::operator=(const pset_list<point_t>& rhs)
+ {
+ lp_ = rhs.lp_;
+ return *this;
+ }
+
+ template <typename point_t>
+ unsigned pset_list<point_t>::impl_npoints() const
+ {
+ return lp_.size();
+ }
+
+ template <typename point_t>
+ bool pset_list<point_t>::impl_is_valid() const
+ {
+ return true;
+ }
+
+ template <typename point_t>
+ void pset_list<point_t>::impl_print(std::ostream& ostr) const
+ {
+ typename std::list<point_t>::const_iterator it;
+ ostr << "{ ";
+ for (it = lp_.begin(); it != lp_.end(); ++it)
+ ostr << *it << ' ';
+ ostr << "}";
+ }
+
+ template <typename point_t>
+ pset_list<point_t>& pset_list<point_t>::append(const point_t& p)
+ {
+ precondition(std::find(lp_.begin(), lp_.end(), p)
+ == lp_.end());
+ lp_.push_back(p);
+ return *this;
+ }
+
+ template <typename point_t>
+ pset_list<point_t>& pset_list<point_t>::prepend(const point_t& p)
+ {
+ precondition(std::find(lp_.begin(), lp_.end(), p)
+ == lp_.end());
+ lp_.push_front(p);
+ return *this;
+ }
+
+ template <typename point_t>
+ const std::list<point_t>& pset_list<point_t>::container() const
+ {
+ return lp_;
+ }
+
+ template <typename point_t>
+ std::list<point_t>& pset_list<point_t>::container()
+ {
+ return lp_;
+ }
+
+# endif
+
+} // end of namespace oln
+
+
+# include <oln/core/gen/piter_on_std_based_pset.hh>
+
+
+#endif // ! OLN_CORE_GEN_PSET_LIST_HH
Index: oln/core/gen/pset_vec.hh
===================================================================
--- oln/core/gen/pset_vec.hh (revision 0)
+++ oln/core/gen/pset_vec.hh (revision 0)
@@ -0,0 +1,171 @@
+// Copyright (C) 2006 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLN_CORE_GEN_PSET_VEC_HH
+# define OLN_CORE_GEN_PSET_VEC_HH
+
+# include <vector>
+
+# include <oln/core/point_set_entry.hh>
+# include <oln/core/abstract/point.hh>
+
+
+namespace oln
+{
+
+ // Forward declarations.
+ template <typename point_t> class pset_vec;
+ template <typename C> class fwd_piter_on_std_based_pset;
+ template <typename C> class bkd_piter_on_std_based_pset;
+
+
+ // Super type declaration.
+ template <typename point_t>
+ struct set_super_type< pset_vec<point_t> >
+ {
+ typedef pset_vec<point_t> self_t;
+ typedef point_set_entry<self_t> ret;
+ };
+
+
+ /// Virtual types associated to oln::pset_vec<point_t>.
+ template <typename point_t>
+ struct vtypes< pset_vec<point_t> >
+ {
+ typedef point_t point_type;
+ typedef fwd_piter_on_std_based_pset< std::vector<point_t> > fwd_piter_type;
+ typedef bkd_piter_on_std_based_pset< std::vector<point_t> > bkd_piter_type;
+
+ typedef mlc::false_ is_random_accessible_type;
+ typedef mlc::true_ has_know_size_type;
+ typedef mlc::false_ is_connected_type;
+ };
+
+
+ /// Bounding box class based on a point class.
+ template <typename point_t>
+ class pset_vec : public point_set_entry< pset_vec<point_t> >,
+ private mlc::assert_< mlc_is_a(point_t, abstract::point) >
+ {
+ typedef pset_vec<point_t> self_type;
+ typedef point_set_entry<self_type> super_t;
+
+ public:
+
+ pset_vec();
+ pset_vec(const pset_vec<point_t>& rhs);
+ pset_vec<point_t>& operator=(const pset_vec<point_t>& rhs);
+
+ unsigned impl_npoints() const;
+ bool impl_is_valid() const;
+ void impl_print(std::ostream& ostr) const;
+
+ pset_vec<point_t>& append(const point_t& p);
+
+ const std::vector<point_t>& container() const;
+ std::vector<point_t>& container();
+
+ protected:
+
+ std::vector<point_t> vp_;
+
+ }; // end of class oln::pset_vec<point_t>
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename point_t>
+ pset_vec<point_t>::pset_vec()
+ {
+ }
+
+ template <typename point_t>
+ pset_vec<point_t>::pset_vec(const pset_vec<point_t>& rhs)
+ {
+ vp_ = rhs.vp_;
+ }
+
+ template <typename point_t>
+ pset_vec<point_t>& pset_vec<point_t>::operator=(const pset_vec<point_t>& rhs)
+ {
+ vp_ = rhs.vp_;
+ return *this;
+ }
+
+ template <typename point_t>
+ unsigned pset_vec<point_t>::impl_npoints() const
+ {
+ return vp_.size();
+ }
+
+ template <typename point_t>
+ bool pset_vec<point_t>::impl_is_valid() const
+ {
+ return true;
+ }
+
+ template <typename point_t>
+ void pset_vec<point_t>::impl_print(std::ostream& ostr) const
+ {
+ typename std::vector<point_t>::const_iterator it;
+ ostr << "{ ";
+ for (it = vp_.begin(); it != vp_.end(); ++it)
+ ostr << *it << ' ';
+ ostr << "}";
+ }
+
+ template <typename point_t>
+ pset_vec<point_t>& pset_vec<point_t>::append(const point_t& p)
+ {
+ precondition(std::find(vp_.begin(), vp_.end(), p)
+ == vp_.end());
+ vp_.push_back(p);
+ return *this;
+ }
+
+ template <typename point_t>
+ const std::vector<point_t>& pset_vec<point_t>::container() const
+ {
+ return vp_;
+ }
+
+ template <typename point_t>
+ std::vector<point_t>& pset_vec<point_t>::container()
+ {
+ return vp_;
+ }
+
+# endif
+
+} // end of namespace oln
+
+
+# include <oln/core/gen/piter_on_std_based_pset.hh>
+
+
+#endif // ! OLN_CORE_GEN_PSET_VEC_HH
Index: oln/core/gen/pset_.hh
===================================================================
--- oln/core/gen/pset_.hh (revision 0)
+++ oln/core/gen/pset_.hh (revision 0)
@@ -0,0 +1,170 @@
+// Copyright (C) 2006 EPITA Research and Development Laboratory
+//
+// This file is part of the Olena Library. This library is free
+// software; you can redistribute it and/or modify it under the terms
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef OLN_CORE_GEN_PSET_HH
+# define OLN_CORE_GEN_PSET_HH
+
+# include <set>
+
+# include <oln/core/point_set_entry.hh>
+# include <oln/core/abstract/point.hh>
+
+
+namespace oln
+{
+
+ // Forward declarations.
+ template <typename point_t> class pset_;
+ template <typename C> class fwd_piter_on_std_based_pset;
+ template <typename C> class bkd_piter_on_std_based_pset;
+
+
+ // Super type declaration.
+ template <typename point_t>
+ struct set_super_type< pset_<point_t> >
+ {
+ typedef pset_<point_t> self_t;
+ typedef point_set_entry<self_t> ret;
+ };
+
+
+ /// Virtual types associated to oln::pset_<point_t>.
+ template <typename point_t>
+ struct vtypes< pset_<point_t> >
+ {
+ typedef point_t point_type;
+ typedef fwd_piter_on_std_based_pset< std::set<point_t> > fwd_piter_type;
+ typedef bkd_piter_on_std_based_pset< std::set<point_t> > bkd_piter_type;
+
+ typedef mlc::false_ is_random_accessible_type;
+ typedef mlc::true_ has_know_size_type;
+ typedef mlc::false_ is_connected_type;
+ };
+
+
+ /// Bounding box class based on a point class.
+ template <typename point_t>
+ class pset_ : public point_set_entry< pset_<point_t> >,
+ private mlc::assert_< mlc_is_a(point_t, abstract::point) >
+ {
+ typedef pset_<point_t> self_type;
+ typedef point_set_entry<self_type> super_t;
+
+ public:
+
+ pset_();
+ pset_(const pset_<point_t>& rhs);
+ pset_<point_t>& operator=(const pset_<point_t>& rhs);
+
+ unsigned impl_npoints() const;
+ bool impl_is_valid() const;
+ void impl_print(std::ostream& ostr) const;
+
+ pset_<point_t>& insert(const point_t& p);
+
+ const std::set<point_t>& container() const;
+ std::set<point_t>& container();
+
+ protected:
+
+ std::set<point_t> sp_;
+
+ }; // end of class oln::pset_<point_t>
+
+
+
+# ifndef OLN_INCLUDE_ONLY
+
+ template <typename point_t>
+ pset_<point_t>::pset_()
+ {
+ }
+
+ template <typename point_t>
+ pset_<point_t>::pset_(const pset_<point_t>& rhs)
+ {
+ sp_ = rhs.sp_;
+ }
+
+ template <typename point_t>
+ pset_<point_t>& pset_<point_t>::operator=(const pset_<point_t>& rhs)
+ {
+ sp_ = rhs.sp_;
+ return *this;
+ }
+
+ template <typename point_t>
+ unsigned pset_<point_t>::impl_npoints() const
+ {
+ return sp_.size();
+ }
+
+ template <typename point_t>
+ bool pset_<point_t>::impl_is_valid() const
+ {
+ return true;
+ }
+
+ template <typename point_t>
+ void pset_<point_t>::impl_print(std::ostream& ostr) const
+ {
+ typename std::set<point_t>::const_iterator it;
+ ostr << "{ ";
+ for (it = sp_.begin(); it != sp_.end(); ++it)
+ ostr << *it << ' ';
+ ostr << "}";
+ }
+
+ template <typename point_t>
+ pset_<point_t>& pset_<point_t>::insert(const point_t& p)
+ {
+ precondition(sp_.find(p) == sp_.end());
+ sp_.insert(p);
+ return *this;
+ }
+
+ template <typename point_t>
+ const std::set<point_t>& pset_<point_t>::container() const
+ {
+ return sp_;
+ }
+
+ template <typename point_t>
+ std::set<point_t>& pset_<point_t>::container()
+ {
+ return sp_;
+ }
+
+# endif
+
+} // end of namespace oln
+
+
+# include <oln/core/gen/piter_on_std_based_pset.hh>
+
+
+#endif // ! OLN_CORE_GEN_PSET_HH
Index: oln/Makefile.am
===================================================================
--- oln/Makefile.am (revision 696)
+++ oln/Makefile.am (working copy)
@@ -128,9 +128,14 @@
core/gen/fwd_qiter_win.hh \
core/gen/fwd_viter_lut.hh \
core/gen/piter_isubset.hh \
+ core/gen/piter_isubset.hh \
+ core/gen/pset_.hh \
+ core/gen/pset_list.hh \
+ core/gen/pset_vec.hh \
core/gen/grid.hh \
core/gen/mapimage.hh \
core/gen/neighb.hh \
+ core/gen/piter_on_std_based_pset.hh \
core/gen/pw_value.hh \
core/gen/topo_add_isubset.hh \
core/gen/topo_add_nbh.hh \
2006-11-07 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
* TODO: Add description of primary image types.
Index: TODO
===================================================================
--- TODO (revision 696)
+++ TODO (working copy)
@@ -17,6 +17,237 @@
+* Primary image types
+
+
+** contents
+
+type Q
+
+image2d<T> 0
+slow::image_bbmap<P, T> 0
+
+rle_image<P, T> 1
+sparse_image<P, T> 1
+image_vec<P, T> 1
+image_map<P, T> 1
+
+one_value_image<S, T> 2
+image_p2v<S, F> 2
+
+igraph<T> 3
+image_2dhex<T> 3
+
+image2d_without_border<T> 1
+
+
+** image2d<T>
+
+*** parameter
+
+T: value type
+
+*** main features
+
+has a virtual border (same thickness for every axis)
+point-wise accessible and mutable
+not value-wise accessible
+
+*** data storage
+
+relies on array2d<T>
+
+*** to-do
+
+should rely on array2d< T::storage >
+
+*** related types
+
+image1d<T> and image3d<T> are similarly constructed
+
+
+** image_2dhex<T>
+
+on a 2D triangular grid (hexagonal pixels)
+FIXME: ...
+
+
+** igraph<T>
+
+FIXME: ...
+
+
+** image2d_without_border<T>
+
+*** status
+
+to-do
+
+*** main features
+
+same as image2d<T> but without virtual border
+
+*** data storage
+
+relies on array2d<T>
+
+
+** one_value_image<S, T>
+
+*** parameters
+
+S: point set type
+T: type of the value
+
+*** main features
+
+point-wise accessible but not mutable
+value-wise accessible and mutable
+
+*** data storage
+
+a single attribute: the unique value
+
+
+** image_p2v<S, F>
+
+*** parameters
+
+S: point set type
+F: function point-site -> value
+
+*** main features
+
+point-wise accessible but not mutable
+not value-wise accessible
+
+*** data storage
+
+combines the point set and the function to produce values
+on the fly
+
+
+** rle_image<P, T>
+
+*** parameter
+
+P: point type
+T: value type
+
+*** main features
+
+not point-wise accessible
+not value-wise accessible
+
+*** data storage
+
+std::vector of triplets (p_start, length, value)
+
+*** related type
+
+sparse_image<T>
+
+
+** sparse_image<P, T>
+
+*** parameter
+
+P: point type
+T: value type
+
+*** main features
+
+not point-wise accessible
+not value-wise accessible
+
+*** data storage
+
+std::vector of couples (p_start, std::vector<T>)
+
+*** related type
+
+rle_image<P, T>
+
+
+** image_vec<P, T>
+
+*** parameters
+
+P: point type
+T: value type
+
+*** main features
+
+not point-wise accessible
+not value-wise accessible
+
+*** data storage
+
+std::vector< std::pair<P, T> >
+
+
+** image_map<P, T>
+
+*** parameters
+
+P: point type
+T: value type
+
+*** main features
+
+not point-wise accessible
+not value-wise accessible
+
+*** data storage
+
+using std::map<P, T>
+
+*** related type
+
+slow::image_map<P, T>
+
+
+** slow::image_bbmap<P, T>
+
+*** parameters
+
+P: point type
+T: value type
+
+*** main features
+
+point-wise accessible and mutable
+not value-wise accessible
+bounding-boxed
+
+*** data storage
+
+some values are set in a std::map<P, T>
+when not set, a default value is provided by an attribute
+
+*** related type
+
+image_map<P, T>
+
+
+
+* Morpher types
+
+** FIXME
+
+do (really!) nothing when writing at p when outside the image domain
+error when reading at p when outside the image domain
+
+** FIXME
+
+add a default value when p is outside the image domain
+
+** sequence<I>
+
+FIXME: ...
+
+
+
Local Variables:
mode: outline
ispell-local-dictionary: "american"
On 2006-11-03, Roland Levillain <roland(a)lrde.epita.fr> wrote:
> Roland Levillain <roland(a)lrde.epita.fr> writes:
>
>> https://svn.lrde.epita.fr/svn/oln/trunk/metalic
>>
>>
>> Index: ChangeLog
>> from Roland Levillain <roland(a)lrde.epita.fr>
>>
>> Add spaces in macros to please icpc.
>> * mlc/is_a.hh, mlc/case.hh: Add spaces in macros to please icpc.
>>
>> 0 files changed
>>
>> Index: mlc/is_a.hh
>> Index: mlc/case.hh
>
> Sorry for this ``blank'' patch, but Vcs removes any white space in altered
> lines in diffs.
>
> BTW, is there an option to disable this behavior in Vcs? If not, I
> suggest adding an option like `--show-space-change' (i.e., the
> opposite from diff's --ignore-space-change).
>
Or simply when the diff is empty, diff it again without removing white spaces
and stuff.
>
> Here is a more readable diff:
>
LOL.
>
> Index: mlc/is_a.hh
>===================================================================
> --- mlc/is_a.hh (révision 693)
> +++ mlc/is_a.hh (révision 694)
> @@ -240,11 +240,11 @@
>
> # define mlc_is_a(T, U) \
> mlc::wrap_< \
> - typename mlc::is_a_< sizeof(mlc::form::of< U >()) >::template ret< typename mlc::basic_<T>::ret, U > \
> + typename mlc::is_a_< sizeof(mlc::form::of< U >()) >::template ret< typename mlc::basic_< T >::ret, U > \
> >
>
> # define mlc_is_a_(T, U) \
> -mlc::is_a_< sizeof(mlc::form::of< U >()) >::ret< mlc::basic_<T>::ret, U >
> +mlc::is_a_< sizeof(mlc::form::of< U >()) >::ret< mlc::basic_< T >::ret, U >
>
> [SNIP]
What's the problem with icpc? Why does it actually *need* whitespaces there?
--
SIGOURE Benoit aka Tsuna (SUSv3 compliant)
_____ "On a long enough timeline, the survival rate
/EPITA\ Promo 2008.CSI/ACU for everyone drops to zero" -- Jack.
Roland Levillain <roland(a)lrde.epita.fr> writes:
> /* Icpc chokes when expanding this macro when T is a template type:
> T is substituted with no additional surrounding space, generating
> a token `>>'.
>
> G++ has no such problem, but I haven't checked which is the right
> behavior, required by the ISO standard.
>
> Note that this will no longer be a problem with C++ 0x, since
> expressions like `Foo<Foo<int>>' will be valid. */
Dans le code de CPP on trouve la fonction suivante :
/* Returns nonzero if a space should be inserted to avoid an
accidental token paste for output. For simplicity, it is
conservative, and occasionally advises a space where one is not
needed, e.g. "." and ".2". */
int
cpp_avoid_paste (cpp_reader *pfile, const cpp_token *token1,
const cpp_token *token2)
--
Utilisée dans l'outputing ici. avoid_paste est de gestion interne.
/* Subtle logic to output a space if and only if necessary. */
if (avoid_paste)
{
if (print.source == NULL)
print.source = token;
if (print.source->flags & PREV_WHITE
|| (print.prev
&& cpp_avoid_paste (pfile, print.prev, token))
|| (print.prev == NULL && token->type == CPP_HASH))
putc (' ', print.outf);
}
else if (token->flags & PREV_WHITE)
putc (' ', print.outf);
Il n'y a pas de commentaire sur le standard dans le code. Je n'ai
d'ailleurs rien trouvé dans les standards. Il y en a un pour CPP ?
--
/!\ My mail address changed, please update your files accordingly.
| In a World without Walls and Fences, Michaël `Micha' Cadilhac |
| who needs Windows and Gates? cadilh_m - Epita 2007 - CSI |
| -- Dino Esposito JID: micha(a)amessage.be |
`-- - - - - --'