2005-04-02 Thierry GERAUD <theo(a)tegucigalpa.lrde.epita.fr>
* oln/core/pw/times.hh: New file.
* oln/core/pw/image.hh: New file.
* oln/core/pw/div.hh: New file.
* oln/core/pw/plus.hh: New file.
* oln/core/pw/abstract/function.hh: New file.
* oln/core/pw/all.hh: New file.
* oln/core/pw/minus.hh: New file.
* oln/core/pw/literal.hh: New file.
* oln/core/pw/cmp.hh: New file.
* oln/core/any/all.hh: New file.
* oln/core/any/point.hh: New file.
* oln/core/any/size.hh: New file.
* oln/core/any/dpoint.hh: New file.
* oln/core/abstract/point.hh (operator any_point): New.
* oln/core/abstract/size.hh: Cosmetic changes.
* oln/core/1d/size1d.hh (impl_eq(any_size)): New.
* oln/core/2d/size2d.hh (impl_eq(any_size)): New.
* oln/core/3d/size3d.hh (impl_eq(any_size)): New.
* oln/basics2d.hh: Include core/2d/fwd_piter2d and
core/2d/bkd_piter2d.
* oln/basics.hh: Include core/any/all.hh and core/pw/all.hh.
* oln/makefile.src (OLN_DEP): Add new files.
Index: oln/core/pw/times.hh
===================================================================
--- oln/core/pw/times.hh (revision 0)
+++ oln/core/pw/times.hh (revision 0)
@@ -0,0 +1,112 @@
+// 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_PW_TIMES_HH
+# define OLENA_CORE_PW_TIMES_HH
+
+# include <oln/core/pw/abstract/function.hh>
+# include <ntg/all.hh>
+
+
+namespace oln {
+
+
+ namespace pw { // means "point-wise"
+
+ // fwd decl
+ template <typename L, typename R> struct times;
+
+ template <typename L, typename R>
+ struct traits < times<L, R> >
+ {
+ typedef oln_pw_point_type(L) point_type;
+ typedef ntg_return_type(times, oln_pw_value_type(L), oln_pw_value_type(R))
value_type;
+ typedef oln_pw_size_type(L) size_type;
+ };
+
+ template <typename L, typename R>
+ struct times : public abstract::function < times<L, R> >
+ {
+ typedef times<L, R> self_type;
+
+ typedef oln_pw_point_type(self_type) point_type;
+ typedef oln_pw_value_type(self_type) value_type;
+ typedef oln_pw_size_type(self_type) size_type;
+
+ L left;
+ R right;
+
+ times(const abstract::function<L>& left,
+ const abstract::function<R>& right) :
+ left(left.exact()),
+ right(right.exact())
+ {
+ }
+
+ const size_type& impl_size() const
+ {
+ return this->left.size();
+ }
+
+ const value_type impl_get(const point_type& p) const
+ {
+ return this->left(p) * this->right(p);
+ }
+
+ bool impl_hold(const point_type& p) const
+ {
+ return this->left.hold(p);
+ }
+
+ bool impl_hold_large(const point_type& p) const
+ {
+ return this->left.hold_large(p);
+ }
+ };
+
+ } // end of namespace oln::pw
+
+} // end of namespace oln
+
+
+/// Operator * on pwf
+
+template <typename L, typename R>
+oln::pw::times<L, R> operator * (const oln::pw::abstract::function<L>&
lhs,
+ const oln::pw::abstract::function<R>& rhs)
+{
+ precondition(lhs.size() == rhs.size());
+ oln::pw::times<L, R> tmp(lhs, rhs);
+ return tmp;
+}
+
+oln_pw_operator(times, *, int)
+oln_pw_operator(times, *, float)
+oln_pw_operator(times, *, double)
+
+
+#endif // ! OLENA_CORE_PW_TIMES_HH
Index: oln/core/pw/image.hh
===================================================================
--- oln/core/pw/image.hh (revision 0)
+++ oln/core/pw/image.hh (revision 0)
@@ -0,0 +1,262 @@
+// 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_PW_IMAGE_HH
+# define OLENA_CORE_PW_IMAGE_HH
+
+# include <mlc/any.hh>
+# include <mlc/cmp.hh>
+# include <oln/core/box.hh>
+# include <oln/core/abstract/entry.hh>
+# include <oln/core/pw/abstract/function.hh>
+
+// FIXME: remove
+# include <oln/core/2d/fwd_piter2d.hh>
+# include <oln/core/2d/bkd_piter2d.hh>
+
+
+namespace oln {
+
+
+ namespace pw { // means "point-wise"
+
+ // fwd decl
+ template <typename I> struct image;
+
+ template <typename I>
+ struct traits < image<I> >
+ {
+ typedef oln_type_of(I, point) point_type;
+ typedef oln_type_of(I, value) value_type;
+ typedef oln_type_of(I, size) size_type;
+ };
+
+ template <typename I>
+ struct image : public abstract::function < image<I> >
+ {
+ oln::box<const I> ima;
+
+ image(const oln::abstract::image<I>& ima) :
+ ima(ima)
+ {
+ }
+
+ typedef oln_type_of(I, point) point_type;
+ typedef oln_type_of(I, value) value_type;
+ typedef oln_type_of(I, size) size_type;
+
+ const size_type& impl_size() const
+ {
+ return this->ima.size();
+ }
+
+ const value_type impl_get(const point_type& p) const
+ {
+ return this->ima.get(p);
+ }
+
+ bool impl_hold(const point_type& p) const
+ {
+ return this->ima.hold(p);
+ }
+
+ bool impl_hold_large(const point_type& p) const
+ {
+ return this->ima.hold_large(p);
+ }
+
+ };
+
+ } // end of namespace oln::pw
+
+
+ /// Routine that takes an image and outputs a "point value" object
+
+ template <typename I>
+ pw::image<I> p_value(const abstract::image<I>& ima)
+ {
+ pw::image<I> tmp(ima);
+ return tmp;
+ }
+
+
+ // fwd decl
+ template <typename F> class image_from_pw;
+
+ // category
+ template <typename F>
+ struct set_category< image_from_pw<F> > { typedef category::image ret; };
+
+ // super
+ template <typename F>
+ struct set_super_type < image_from_pw<F> >
+ {
+ typedef abstract::image_entry< image_from_pw<F> > ret;
+ };
+
+ // props
+ template <typename F>
+ struct set_props < category::image, image_from_pw<F> > : public props_of
<category::image>
+ {
+ typedef oln_pw_point_type(F) point_type;
+ typedef oln_pw_value_type(F) value_type;
+ typedef oln_pw_size_type(F) size_type;
+
+ typedef mlc::no_type delegated_type;
+
+ // FIXME: we do not know if it is 2d...
+ typedef is_a<abstract::image2d> image_dimension_type;
+ typedef vectorialness_from_valuetype(value_type) image_vectorialness_type;
+
+ typedef fwd_piter2d piter_type;
+ typedef fwd_piter2d fwd_piter_type;
+ typedef bkd_piter2d bkd_piter_type;
+ };
+
+
+ /// Class image_from_pw<F>.
+
+ template <typename F>
+ struct image_from_pw : public abstract::image_entry< image_from_pw<F> >
+ {
+ typedef image_from_pw<F> self_type;
+
+ F fun;
+
+ image_from_pw(const pw::abstract::function<F>& fun) :
+ fun(fun.exact())
+ {
+ this->exact_ptr = this;
+ }
+
+ image_from_pw(const self_type& rhs) :
+ fun(rhs.fun)
+ {
+ this->exact_ptr = this;
+ }
+
+ /// typedefs
+
+ typedef image_from_pw<F> self_type;
+
+ typedef oln_type_of(self_type, size) size_type;
+ typedef oln_type_of(self_type, value) value_type;
+ typedef oln_type_of(self_type, point) point_type;
+
+ const size_type& impl_size() const
+ {
+ return this->fun.size();
+ }
+
+ bool impl_hold(const point_type& p) const
+ {
+ return this->fun.hold(p);
+ }
+
+ bool impl_hold_large(const point_type& p) const
+ {
+ return this->fun.hold_large(p);
+ }
+
+ const value_type impl_get(const point_type& p) const
+ {
+ return this->fun(p);
+ }
+
+ // FIXME: remove below
+ unsigned long impl_npoints() const
+ {
+ return 1;
+ }
+ void impl_resize_border(size_t new_border, bool copy_border) const
+ {
+ }
+
+ };
+
+
+ /// Routine
+
+ template <typename F>
+ image_from_pw<F> for_all_p(const pw::abstract::function<F>& fun)
+ {
+ image_from_pw<F> tmp(fun);
+ return tmp;
+ }
+
+
+ /// Specialization of p_value (so that "p_value(for_all_p(fun)) == fun").
+
+ template <typename F>
+ F p_value(const image_from_pw<F>& ima)
+ {
+ return ima.fun;
+ }
+
+
+
+
+ /// Routine check.
+ // FIXME: this should be an algorithm (pred = binary_image)
+
+ template <typename I>
+ bool check(const abstract::image<I>& pred)
+ {
+ // FIXME: input should be binary
+ oln_type_of(I, fwd_piter) p(pred.size());
+ for_all (p)
+ if (! pred[p])
+ return false;
+ return true;
+ }
+
+
+
+ namespace pw {
+
+ /// Routine oln::pw::check.
+
+ template <typename F>
+ bool check(const pw::abstract::function<F>& pred)
+ {
+ // FIXME: ugly syntax
+ // FIXME: bool or bin or...
+ mlc::is_true<
+ mlc::type::eq< oln_pw_value_type(F), bool >::ret
+ >::ensure();
+
+ return oln::check(for_all_p(pred));
+ }
+
+ } // end of namespace oln::pw
+
+
+} // end of namespace oln
+
+
+
+#endif // ! OLENA_CORE_PW_IMAGE_HH
Index: oln/core/pw/div.hh
===================================================================
--- oln/core/pw/div.hh (revision 0)
+++ oln/core/pw/div.hh (revision 0)
@@ -0,0 +1,109 @@
+// 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_PW_DIV_HH
+# define OLENA_CORE_PW_DIV_HH
+
+# include <oln/core/pw/abstract/function.hh>
+# include <ntg/all.hh>
+
+
+namespace oln {
+
+
+ namespace pw { // means "point-wise"
+
+ // fwd decl
+ template <typename L, typename R> struct div;
+
+ template <typename L, typename R>
+ struct traits < div<L, R> >
+ {
+ typedef oln_pw_point_type(L) point_type;
+ typedef ntg_return_type(div, oln_pw_value_type(L), oln_pw_value_type(R))
value_type;
+ typedef oln_pw_size_type(L) size_type;
+ };
+
+ template <typename L, typename R>
+ struct div : public abstract::function < div<L, R> >
+ {
+ typedef div<L, R> self_type;
+
+ typedef oln_pw_point_type(self_type) point_type;
+ typedef oln_pw_value_type(self_type) value_type;
+ typedef oln_pw_size_type(self_type) size_type;
+
+ L left;
+ R right;
+
+ div(const abstract::function<L>& left,
+ const abstract::function<R>& right) :
+ left(left.exact()),
+ right(right.exact())
+ {
+ }
+
+ const size_type& impl_size() const
+ {
+ return this->left.size();
+ }
+
+ const value_type impl_get(const point_type& p) const
+ {
+ precondition(this->right(p) != 0);
+ return this->left(p) / this->right(p);
+ }
+
+ bool impl_hold(const point_type& p) const
+ {
+ return this->left.hold(p);
+ }
+
+ bool impl_hold_large(const point_type& p) const
+ {
+ return this->left.hold_large(p);
+ }
+ };
+
+ } // end of namespace oln::pw
+
+} // end of namespace oln
+
+
+/// Operator / on pwf
+
+template <typename L, typename R>
+oln::pw::div<L, R> operator / (const oln::pw::abstract::function<L>&
lhs,
+ const oln::pw::abstract::function<R>& rhs)
+{
+ precondition(lhs.size() == rhs.size());
+ oln::pw::div<L, R> tmp(lhs, rhs);
+ return tmp;
+}
+
+
+#endif // ! OLENA_CORE_PW_DIV_HH
Index: oln/core/pw/plus.hh
===================================================================
--- oln/core/pw/plus.hh (revision 0)
+++ oln/core/pw/plus.hh (revision 0)
@@ -0,0 +1,127 @@
+// 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_PW_PLUS_HH
+# define OLENA_CORE_PW_PLUS_HH
+
+# include <oln/core/pw/abstract/function.hh>
+# include <ntg/all.hh>
+
+
+namespace oln {
+
+
+ namespace pw { // means "point-wise"
+
+ // fwd decl
+ template <typename L, typename R> struct plus;
+
+ template <typename L, typename R>
+ struct traits < plus<L, R> >
+ {
+ typedef oln_pw_point_type(L) point_type;
+ typedef ntg_return_type(plus, oln_pw_value_type(L), oln_pw_value_type(R))
value_type;
+ typedef oln_pw_size_type(L) size_type;
+ };
+
+ template <typename L, typename R>
+ struct plus : public abstract::function < plus<L, R> >
+ {
+ typedef plus<L, R> self_type;
+
+ typedef oln_pw_point_type(self_type) point_type;
+ typedef oln_pw_value_type(self_type) value_type;
+ typedef oln_pw_size_type(self_type) size_type;
+
+ L left;
+ R right;
+
+ plus(const abstract::function<L>& left,
+ const abstract::function<R>& right) :
+ left(left.exact()),
+ right(right.exact())
+ {
+ }
+
+ const size_type& impl_size() const
+ {
+ return this->left.size();
+ }
+
+ const value_type impl_get(const point_type& p) const
+ {
+ return this->left(p) + this->right(p);
+ }
+
+ bool impl_hold(const point_type& p) const
+ {
+ return this->left.hold(p);
+ }
+
+ bool impl_hold_large(const point_type& p) const
+ {
+ return this->left.hold_large(p);
+ }
+ };
+
+ } // end of namespace oln::pw
+
+} // end of namespace oln
+
+
+/// Operator + on pwf
+
+template <typename L, typename R>
+oln::pw::plus<L, R> operator + (const oln::pw::abstract::function<L>&
lhs,
+ const oln::pw::abstract::function<R>& rhs)
+{
+ precondition(lhs.size() == rhs.size());
+ oln::pw::plus<L, R> tmp(lhs, rhs);
+ return tmp;
+}
+
+oln_pw_operator(plus, +, int)
+oln_pw_operator(plus, +, float)
+oln_pw_operator(plus, +, double)
+
+// template <typename L>
+// oln::pw::plus<L, oln::pw::literal<int> >
+// operator + (const oln::pw::abstract::function<L>& lhs,
+// int value)
+// {
+// return lhs + oln::pw::literal<int>(value);
+// }
+// template <typename R>
+// oln::pw::plus<oln::pw::literal<int>, R>
+// operator + (int value,
+// const oln::pw::abstract::function<R>& rhs)
+// {
+// return oln::pw::literal<int>(value) + rhs;
+// }
+
+
+#endif // ! OLENA_CORE_PW_PLUS_HH
Index: oln/core/pw/abstract/function.hh
===================================================================
--- oln/core/pw/abstract/function.hh (revision 0)
+++ oln/core/pw/abstract/function.hh (revision 0)
@@ -0,0 +1,133 @@
+// 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_PW_ABSTRACT_FUNCTION_HH
+# define OLENA_CORE_PW_ABSTRACT_FUNCTION_HH
+
+# include <mlc/any.hh>
+# include <oln/core/properties.hh>
+
+
+# define oln_pw_point_type(T) typename oln::pw::traits<T>::point_type
+# define oln_pw_value_type(T) typename oln::pw::traits<T>::value_type
+# define oln_pw_size_type(T) typename oln::pw::traits<T>::size_type
+
+
+namespace oln {
+
+
+ namespace pw { // means "point-wise"
+
+ template <typename T> struct traits;
+
+
+ // fwd decls
+ namespace abstract {
+ template <typename E> struct function;
+ }
+ template <typename L, typename R> struct minus;
+ template <typename T> struct literal;
+
+
+
+ template <typename E>
+ struct traits < abstract::function<E> >
+ {
+ typedef oln_pw_point_type(E) point_type;
+ typedef oln_pw_value_type(E) value_type;
+ typedef oln_pw_size_type(E) size_type;
+ };
+
+ namespace abstract {
+
+ template <typename E>
+ struct function : public mlc::any<E>
+ {
+ typedef oln_pw_point_type(E) point_type;
+ typedef oln_pw_value_type(E) value_type;
+ typedef oln_pw_size_type(E) size_type;
+
+ const size_type& size() const
+ {
+ return this->exact().impl_size();
+ }
+
+ const value_type operator()(const point_type& p) const
+ {
+ return this->exact().impl_get(p);
+ }
+
+ bool hold(const point_type& p) const
+ {
+ return this->exact().impl_hold(p);
+ }
+
+ bool hold_large(const point_type& p) const
+ {
+ return this->exact().impl_hold_large(p);
+ }
+
+// minus< literal<value_type>, E> operator-() const;
+
+ protected:
+ function() {}
+
+ ~function()
+ {
+ { // impl_size
+ typedef const size_type& (E::*meth)() const;
+ meth adr = &E::impl_size;
+ adr = 0;
+ }
+ { // impl_get
+ typedef const value_type (E::*meth)(const point_type&) const;
+ meth adr = &E::impl_get;
+ adr = 0;
+ }
+ { // impl_hold
+ typedef bool (E::*meth)(const point_type&) const;
+ meth adr = &E::impl_hold;
+ adr = 0;
+ }
+ { // impl_hold_large
+ typedef bool (E::*meth)(const point_type&) const;
+ meth adr = &E::impl_hold_large;
+ adr = 0;
+ }
+
+ }
+ };
+
+ } // end of namespace oln::pw::abstract
+
+ } // end of namespace oln::pw
+
+} // end of namespace oln
+
+
+
+#endif // ! OLENA_CORE_PW_ABSTRACT_FUNCTION_HH
Index: oln/core/pw/all.hh
===================================================================
--- oln/core/pw/all.hh (revision 0)
+++ oln/core/pw/all.hh (revision 0)
@@ -0,0 +1,46 @@
+// 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_PW_ALL_HH
+# define OLENA_CORE_PW_ALL_HH
+
+
+# include <oln/core/pw/abstract/function.hh>
+# include <oln/core/pw/image.hh>
+# include <oln/core/pw/literal.hh>
+
+# include <oln/core/pw/cmp.hh>
+
+# include <oln/core/pw/plus.hh>
+# include <oln/core/pw/minus.hh>
+# include <oln/core/pw/times.hh>
+# include <oln/core/pw/div.hh>
+
+// FIXME: not xor mod...
+
+
+#endif // ! OLENA_CORE_PW_ALL_HH
Index: oln/core/pw/minus.hh
===================================================================
--- oln/core/pw/minus.hh (revision 0)
+++ oln/core/pw/minus.hh (revision 0)
@@ -0,0 +1,126 @@
+// 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_PW_MINUS_HH
+# define OLENA_CORE_PW_MINUS_HH
+
+# include <oln/core/pw/abstract/function.hh>
+# include <ntg/all.hh>
+
+
+namespace oln {
+
+
+ namespace pw { // means "point-wise"
+
+ // fwd decl
+ template <typename L, typename R> struct minus;
+
+ template <typename L, typename R>
+ struct traits < minus<L, R> >
+ {
+ typedef oln_pw_point_type(L) point_type;
+ typedef ntg_return_type(minus, oln_pw_value_type(L), oln_pw_value_type(R))
value_type;
+ typedef oln_pw_size_type(L) size_type;
+ };
+
+ template <typename L, typename R>
+ struct minus : public abstract::function < minus<L, R> >
+ {
+ typedef minus<L, R> self_type;
+
+ typedef oln_pw_point_type(self_type) point_type;
+ typedef oln_pw_value_type(self_type) value_type;
+ typedef oln_pw_size_type(self_type) size_type;
+
+ L left;
+ R right;
+
+ minus(const abstract::function<L>& left,
+ const abstract::function<R>& right) :
+ left(left.exact()),
+ right(right.exact())
+ {
+ }
+
+ const size_type& impl_size() const
+ {
+ return this->left.size();
+ }
+
+ const value_type impl_get(const point_type& p) const
+ {
+ return this->left(p) - this->right(p);
+ }
+
+ bool impl_hold(const point_type& p) const
+ {
+ return this->left.hold(p);
+ }
+
+ bool impl_hold_large(const point_type& p) const
+ {
+ return this->left.hold_large(p);
+ }
+
+ };
+
+
+ // FIXME: uncomment?
+
+// namespace abstract {
+
+// template <typename E>
+// minus< literal<oln_pw_value_type(E)>, E>
+// function<E>::operator-() const
+// {
+// literal<oln_pw_value_type(E)> lhs(0);
+// return lhs - *this;
+// }
+
+// }
+
+
+ } // end of namespace oln::pw
+
+} // end of namespace oln
+
+
+/// Operator - on pwf
+
+template <typename L, typename R>
+oln::pw::minus<L, R> operator - (const oln::pw::abstract::function<L>&
lhs,
+ const oln::pw::abstract::function<R>& rhs)
+{
+ precondition(lhs.size() == rhs.size());
+ oln::pw::minus<L, R> tmp(lhs, rhs);
+ return tmp;
+}
+
+
+
+#endif // ! OLENA_CORE_PW_MINUS_HH
Index: oln/core/pw/literal.hh
===================================================================
--- oln/core/pw/literal.hh (revision 0)
+++ oln/core/pw/literal.hh (revision 0)
@@ -0,0 +1,120 @@
+// 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_PW_LITERAL_HH
+# define OLENA_CORE_PW_LITERAL_HH
+
+# include <oln/core/pw/abstract/function.hh>
+# include <oln/core/any/all.hh>
+
+
+
+namespace oln {
+
+
+ namespace pw { // means "point-wise"
+
+ // fwd decl
+ template <typename T> struct literal;
+
+ template <typename T>
+ struct traits < literal<T> >
+ {
+ typedef any_point point_type;
+ typedef T value_type;
+ typedef any_size size_type;
+ };
+
+ template <typename T>
+ struct literal : public abstract::function < literal<T> >
+ {
+ typedef literal<T> self_type;
+
+ T value;
+
+ literal(T value) :
+ value(value)
+ {
+ }
+
+ const any_size& impl_size() const
+ {
+ static const any_size the;
+ return the;
+ }
+
+ const T impl_get(const any_point& p) const
+ {
+ return value;
+ }
+
+ bool impl_hold(const any_point& p) const
+ {
+ return true;
+ }
+
+ bool impl_hold_large(const any_point& p) const
+ {
+ return true;
+ }
+ };
+
+ } // end of namespace oln::pw
+
+
+ /// Routine that takes a literal and outputs a "point-wise literal" object
+
+ template <typename T>
+ pw::literal<T> p_lit(const T& value)
+ {
+ pw::literal<T> tmp(value);
+ return tmp;
+ }
+
+
+} // end of namespace oln
+
+
+# define oln_pw_operator(NAME, SYMBOL, TYPE) \
+template <typename L> \
+oln::pw::NAME<L, oln::pw::literal<TYPE> > \
+operator SYMBOL (const oln::pw::abstract::function<L>& lhs, \
+ TYPE value) \
+{ \
+ return lhs SYMBOL oln::pw::literal<TYPE>(value); \
+} \
+template <typename R> \
+oln::pw::NAME<oln::pw::literal<TYPE>, R> \
+operator SYMBOL (TYPE value, \
+ const oln::pw::abstract::function<R>& rhs) \
+{ \
+ return oln::pw::literal<TYPE>(value) SYMBOL rhs; \
+}
+
+
+
+#endif // ! OLENA_CORE_PW_LITERAL_HH
Index: oln/core/pw/cmp.hh
===================================================================
--- oln/core/pw/cmp.hh (revision 0)
+++ oln/core/pw/cmp.hh (revision 0)
@@ -0,0 +1,205 @@
+// 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_PW_CMP_HH
+# define OLENA_CORE_PW_CMP_HH
+
+# include <oln/core/pw/abstract/function.hh>
+
+
+namespace oln {
+
+
+ namespace pw { // means "point-wise"
+
+
+ // FIXME: move somewhere else
+ namespace internal
+ {
+ struct eq {
+ template <typename L, typename R>
+ bool operator()(const L& lhs, const R& rhs) const {
+ return lhs == rhs;
+ }
+ };
+ struct neq {
+ template <typename L, typename R>
+ bool operator()(const L& lhs, const R& rhs) const {
+ return lhs != rhs;
+ }
+ };
+ struct geq {
+ template <typename L, typename R>
+ bool operator()(const L& lhs, const R& rhs) const {
+ return lhs >= rhs;
+ }
+ };
+ struct leq {
+ template <typename L, typename R>
+ bool operator()(const L& lhs, const R& rhs) const {
+ return lhs <= rhs;
+ }
+ };
+ struct g {
+ template <typename L, typename R>
+ bool operator()(const L& lhs, const R& rhs) const {
+ return lhs > rhs;
+ }
+ };
+ struct l {
+ template <typename L, typename R>
+ bool operator()(const L& lhs, const R& rhs) const {
+ return lhs < rhs;
+ }
+ };
+ }
+
+
+ // fwd decl
+ template <typename L, typename R, typename C> struct cmp;
+
+ template <typename L, typename R, typename C>
+ struct traits < cmp<L, R, C> >
+ {
+ typedef oln_pw_point_type(L) point_type;
+ typedef bool value_type;
+ typedef oln_pw_size_type(L) size_type;
+ };
+
+ template <typename L, typename R, typename C>
+ struct cmp : public abstract::function < cmp<L, R, C> >
+ {
+ typedef cmp<L, R, C> self_type;
+
+ typedef oln_pw_point_type(self_type) point_type;
+ typedef oln_pw_size_type(self_type) size_type;
+
+ L left;
+ R right;
+
+ cmp(const abstract::function<L>& left,
+ const abstract::function<R>& right) :
+ left(left.exact()),
+ right(right.exact())
+ {
+ }
+
+ const size_type& impl_size() const
+ {
+ return this->left.size();
+ }
+
+ const bool impl_get(const point_type& p) const
+ {
+ static const C cmpfun = C();
+ return cmpfun(this->left(p), this->right(p));
+ }
+
+ bool impl_hold(const point_type& p) const
+ {
+ return this->left.hold(p);
+ }
+
+ bool impl_hold_large(const point_type& p) const
+ {
+ return this->left.hold_large(p);
+ }
+
+ };
+
+ } // end of namespace oln::pw
+
+
+} // end of namespace oln
+
+
+
+/// Op+ on pwf
+
+template <typename L, typename R>
+oln::pw::cmp<L, R, oln::pw::internal::eq>
+operator == (const oln::pw::abstract::function<L>& lhs,
+ const oln::pw::abstract::function<R>& rhs)
+{
+ precondition(lhs.size() == rhs.size());
+ oln::pw::cmp<L, R, oln::pw::internal::eq> tmp(lhs, rhs);
+ return tmp;
+}
+
+template <typename L, typename R>
+oln::pw::cmp<L, R, oln::pw::internal::neq>
+operator != (const oln::pw::abstract::function<L>& lhs,
+ const oln::pw::abstract::function<R>& rhs)
+{
+ precondition(lhs.size() == rhs.size());
+ oln::pw::cmp<L, R, oln::pw::internal::neq> tmp(lhs, rhs);
+ return tmp;
+}
+
+template <typename L, typename R>
+oln::pw::cmp<L, R, oln::pw::internal::geq>
+operator >= (const oln::pw::abstract::function<L>& lhs,
+ const oln::pw::abstract::function<R>& rhs)
+{
+ precondition(lhs.size() == rhs.size());
+ oln::pw::cmp<L, R, oln::pw::internal::geq> tmp(lhs, rhs);
+ return tmp;
+}
+
+template <typename L, typename R>
+oln::pw::cmp<L, R, oln::pw::internal::leq>
+operator <= (const oln::pw::abstract::function<L>& lhs,
+ const oln::pw::abstract::function<R>& rhs)
+{
+ precondition(lhs.size() == rhs.size());
+ oln::pw::cmp<L, R, oln::pw::internal::leq> tmp(lhs, rhs);
+ return tmp;
+}
+
+template <typename L, typename R>
+oln::pw::cmp<L, R, oln::pw::internal::g>
+operator > (const oln::pw::abstract::function<L>& lhs,
+ const oln::pw::abstract::function<R>& rhs)
+{
+ precondition(lhs.size() == rhs.size());
+ oln::pw::cmp<L, R, oln::pw::internal::g> tmp(lhs, rhs);
+ return tmp;
+}
+
+template <typename L, typename R>
+oln::pw::cmp<L, R, oln::pw::internal::l>
+operator < (const oln::pw::abstract::function<L>& lhs,
+ const oln::pw::abstract::function<R>& rhs)
+{
+ precondition(lhs.size() == rhs.size());
+ oln::pw::cmp<L, R, oln::pw::internal::l> tmp(lhs, rhs);
+ return tmp;
+}
+
+
+
+#endif // ! OLENA_CORE_PW_CMP_HH
Index: oln/core/any/all.hh
===================================================================
--- oln/core/any/all.hh (revision 0)
+++ oln/core/any/all.hh (revision 0)
@@ -0,0 +1,36 @@
+// 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_ANY_ALL_HH
+# define OLENA_CORE_ANY_ALL_HH
+
+
+# include <oln/core/any/point.hh>
+# include <oln/core/any/size.hh>
+
+
+#endif // ! OLENA_CORE_ANY_ALL_HH
Index: oln/core/any/point.hh
===================================================================
--- oln/core/any/point.hh (revision 0)
+++ oln/core/any/point.hh (revision 0)
@@ -0,0 +1,106 @@
+// 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_ANY_POINT_HH
+# define OLENA_CORE_ANY_POINT_HH
+
+# include <oln/core/abstract/point.hh>
+# include <oln/core/abstract/dpoint.hh>
+
+
+namespace oln {
+
+ // fwd decls
+ struct any_point;
+ struct any_dpoint;
+
+ // category
+ struct set_category< any_point > { typedef category::point ret; };
+
+ // props
+ template <>
+ struct set_props < category::point, any_point > : public
props_of<category::point>
+ {
+ typedef any_dpoint dpoint_type;
+ };
+
+
+ struct any_point : public abstract::point < any_point >
+ {
+
+ bool impl_eq(const exact_type& rhs) const
+ {
+ return this->exact().impl_eq(rhs.exact());
+ }
+
+ template <typename D>
+ const any_point impl_plus(const abstract::dpoint<D>& rhs) const
+ {
+ return any_point();
+ }
+
+ template <typename P>
+ const any_dpoint impl_minus(const abstract::point<P>& rhs) const;
+
+ };
+
+
+ namespace abstract {
+
+ template <typename E>
+ point<E>::operator any_point() const
+ {
+ return any_point();
+ }
+
+ } // end of namespace oln::abstract
+
+
+} // end of namespace oln
+
+
+std::ostream& operator<<(std::ostream& ostr, const oln::any_point& p)
+{
+ return ostr << "any";
+}
+
+
+# include <oln/core/any/dpoint.hh>
+
+
+namespace oln {
+
+ template <typename P>
+ const any_dpoint any_point::impl_minus(const abstract::point<P>& rhs) const
+ {
+ return any_dpoint();
+ }
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ANY_POINT_HH
Index: oln/core/any/size.hh
===================================================================
--- oln/core/any/size.hh (revision 0)
+++ oln/core/any/size.hh (revision 0)
@@ -0,0 +1,54 @@
+// 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_ANY_SIZE_HH
+# define OLENA_CORE_ANY_SIZE_HH
+
+# include <oln/core/abstract/size.hh>
+
+namespace oln {
+
+ struct any_size : public abstract::size< any_size >
+ {
+
+ template <typename S>
+ bool impl_eq(const abstract::size<S>& rhs) const
+ {
+ return true;
+ }
+
+ // FIXME: remove below
+ unsigned long impl_npoints() const
+ {
+ return 1;
+ }
+ };
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_CORE_ANY_SIZE_HH
Index: oln/core/any/dpoint.hh
===================================================================
--- oln/core/any/dpoint.hh (revision 0)
+++ oln/core/any/dpoint.hh (revision 0)
@@ -0,0 +1,90 @@
+// 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_ANY_DPOINT_HH
+# define OLENA_CORE_ANY_DPOINT_HH
+
+# include <oln/core/abstract/dpoint.hh>
+
+
+namespace oln {
+
+
+ struct any_dpoint : public abstract::dpoint < any_dpoint >
+ {
+
+ template <typename D>
+ bool operator==(const abstract::dpoint<D>& rhs) const
+ {
+ return true;
+ }
+
+ template <typename D>
+ bool operator!=(const abstract::dpoint<D>& rhs) const
+ {
+ return false;
+ }
+
+ template <typename D>
+ const any_dpoint operator+(const abstract::dpoint<D>& rhs) const
+ {
+ return any_dpoint();
+ }
+
+ template <typename P>
+ const any_point operator+(const abstract::point<P>& rhs) const;
+
+ const any_dpoint operator-() const
+ {
+ return any_dpoint();
+ }
+
+ };
+
+} // end of namespace oln
+
+
+std::ostream& operator<<(std::ostream& ostr, const oln::any_dpoint&
dp)
+{
+ return ostr << "any";
+}
+
+
+# include <oln/core/any/point.hh>
+
+
+namespace oln {
+
+ template <typename P>
+ const any_point any_dpoint::operator+(const abstract::point<P>& rhs) const
+ {
+ return any_point();
+ }
+
+}
+
+#endif // ! OLENA_CORE_ANY_DPOINT_HH
Index: oln/core/abstract/point.hh
===================================================================
--- oln/core/abstract/point.hh (revision 102)
+++ oln/core/abstract/point.hh (working copy)
@@ -40,7 +40,10 @@
namespace oln {
- // fwd decl
+ // fwd decls
+
+ struct any_point;
+
namespace abstract {
template <typename E> struct point;
}
@@ -89,6 +92,13 @@
typedef E exact_type;
+
+
+ /// Conversion to any_point (implemented in oln/core/any/point.hh).
+
+ operator any_point() const;
+
+
/*! \brief Test equality of two points. Nota bene: this method
** is abstract-like.
**
@@ -99,6 +109,12 @@
return this->exact().impl_eq(rhs.exact());
}
+// // FIXME: compiler error (cannot be overloaded)
+// bool operator==(const any_point& rhs) const
+// {
+// return true;
+// }
+
/*! \brief Test difference of two points. Nota bene: this method
** is concrete (and based on abstract::point::operator==).
**
Index: oln/core/abstract/size.hh
===================================================================
--- oln/core/abstract/size.hh (revision 102)
+++ oln/core/abstract/size.hh (working copy)
@@ -34,23 +34,27 @@
namespace abstract {
+
+ /// Abstract class for size classes.
+
template <typename E>
struct size : public mlc::any__best_memory<E>
{
+ // FIXME: remove?
unsigned long npoints() const
{
return this->exact().impl_npoints();
}
- template <typename Ep>
- bool operator==(const size<Ep>& rhs) const
+ template <typename S>
+ bool operator==(const size<S>& rhs) const
{
return this->exact().impl_eq(rhs.exact());
}
- template <typename Ep>
- bool operator!=(const size<Ep>& rhs) const
+ template <typename S>
+ bool operator!=(const size<S>& rhs) const
{
return ! this->operator==(rhs);
}
@@ -59,9 +63,15 @@
size() {}
};
+
} // end of namespace abstract
} // end of namespace oln
+
+# include <oln/core/any/size.hh>
+
+
+
#endif // ! OLENA_CORE_ABSTRACT_SIZE_HH
Index: oln/core/1d/size1d.hh
===================================================================
--- oln/core/1d/size1d.hh (revision 102)
+++ oln/core/1d/size1d.hh (working copy)
@@ -69,6 +69,11 @@
return (unsigned long)nindices_;
}
+ bool impl_eq(const any_size& rhs) const
+ {
+ return true;
+ }
+
bool impl_eq(const size1d& rhs) const
{
return this->nindices_ == rhs.nindices_;
Index: oln/core/2d/size2d.hh
===================================================================
--- oln/core/2d/size2d.hh (revision 102)
+++ oln/core/2d/size2d.hh (working copy)
@@ -73,6 +73,11 @@
return (unsigned long)nrows_ * (unsigned long)ncols_;
}
+ bool impl_eq(const any_size& rhs) const
+ {
+ return true;
+ }
+
bool impl_eq(const size2d& rhs) const
{
return this->nrows_ == rhs.nrows_ &&
Index: oln/core/3d/size3d.hh
===================================================================
--- oln/core/3d/size3d.hh (revision 102)
+++ oln/core/3d/size3d.hh (working copy)
@@ -80,6 +80,11 @@
(unsigned long)ncols_;
}
+ bool impl_eq(const any_size& rhs) const
+ {
+ return true;
+ }
+
bool impl_eq(const size3d& rhs) const
{
return this->nslices_ == rhs.nslices_ &&
Index: oln/basics2d.hh
===================================================================
--- oln/basics2d.hh (revision 102)
+++ oln/basics2d.hh (working copy)
@@ -35,6 +35,8 @@
# include <oln/core/2d/size2d.hh>
# include <oln/core/2d/point2d.hh>
# include <oln/core/2d/image2d.hh>
+# include <oln/core/2d/fwd_piter2d.hh>
+# include <oln/core/2d/bkd_piter2d.hh>
# include <oln/core/2d/fwd_witer2d.hh>
# include <oln/core/2d/window2d.hh>
# include <oln/core/2d/neighborhood2d.hh>
Index: oln/basics.hh
===================================================================
--- oln/basics.hh (revision 102)
+++ oln/basics.hh (working copy)
@@ -56,10 +56,13 @@
# include <oln/core/abstract/size.hh>
# include <oln/core/abstract/point.hh>
+# include <oln/core/any/all.hh>
# include <oln/core/abstract/images.hh>
# include <oln/core/abstract/entry.hh>
# include <oln/core/abstract/image_operator.hh>
+# include <oln/core/pw/all.hh>
+
# include <oln/core/abstract/piter.hh>
# include <oln/core/abstract/witer.hh>
// # include <oln/core/abstract/niter.hh>
@@ -68,4 +71,6 @@
# include <oln/core/abstract/neighborhood.hh>
+
+
#endif // ! OLENA_BASICS_HH
Index: oln/makefile.src
===================================================================
--- oln/makefile.src (revision 102)
+++ oln/makefile.src (working copy)
@@ -57,12 +57,25 @@
core/abstract/struct_elt.hh \
core/abstract/witer.hh \
core/accum.hh \
+ core/any/all.hh \
+ core/any/dpoint.hh \
+ core/any/point.hh \
+ core/any/size.hh \
core/apply.hh \
core/ch_value_type.hh \
core/compose.hh \
core/coord.hh \
core/gen/identity.hh \
core/properties.hh \
+ core/pw/abstract/function.hh \
+ core/pw/all.hh \
+ core/pw/cmp.hh \
+ core/pw/div.hh \
+ core/pw/image.hh \
+ core/pw/literal.hh \
+ core/pw/minus.hh \
+ core/pw/plus.hh \
+ core/pw/times.hh \
core/value_box.hh \
fancy/iota.hh \
fancy/print.hh \