2005-05-01 Thierry Geraud <theo@shuttle>
* oln/arith/min.hh: Remove (obsolete).
* oln/arith/max.hh: Likewise.
* oln/arith/ops.hh: Move to...
* oln/ops/arith.hh: ...this new file.
* oln/arith/logic.hh: Move to...
* oln/ops/logic.hh: ...this new file.
* oln/arith/cmp.hh: Move to...
* oln/ops/cmp.hh: ...this new file.
* oln/morpho/geodesic_dilation.hh: Update.
* oln/morpho/geodesic_erosion.hh: Likewise.
* oln/funobj/abstract/binary.hh (binary_meta_result): Rename as...
(mbinary_result): ...this.
* oln/core/pw/binary_op.hh: Update.
* oln/funobj/abstract/unary.hh (unary_meta_result): Rename as...
(munary_result): ...this.
* oln/core/pw/unary_op.hh: Update.
* oln/core/abstract/image.hh: Include piter.hh.
* oln/utils/clone.hh: Update. Do not use image_operator any more.
* oln/core/apply.hh: Likewise.
(apply, apply2): New routines to accept oln/funobj/*.
* oln/core/ch_value_type.hh (oln_ch_concrete_type): New macro.
* oln/level/arith.hh: New file.
* oln/level/logic.hh: New file.
Index: oln/funobj/abstract/binary.hh
===================================================================
--- oln/funobj/abstract/binary.hh (revision 179)
+++ oln/funobj/abstract/binary.hh (working copy)
@@ -31,6 +31,7 @@
# include <mlc/any.hh>
# include <mlc/contract.hh>
# include <mlc/types.hh>
+
# include <ntg/all.hh>
# include <oln/core/abstract/image.hh>
@@ -96,7 +97,7 @@
template <typename F, typename L, typename R>
- struct binary_meta_result
+ struct mbinary_result
{
typedef mlc::no_type ret;
};
@@ -143,12 +144,21 @@
struct mbinary : public mlc::any<E>
{
template <typename L, typename R>
- const typename binary_meta_result<E,L,R>::ret
+ const typename mbinary_result<E,L,R>::ret
operator()(const L& left, const R& right) const
{
return this->exact().impl_binop(left, right);
}
+ template <typename Il, typename Ir>
+ const typename mbinary_result<E,
+ oln_type_of(Il, value),
+ oln_type_of(Ir, value)>::ret
+ operator()(const value_box<Il>& left, const value_box<Ir>& right)
const
+ {
+ return this->exact().impl_binop(left, right);
+ }
+
protected:
mbinary() {}
@@ -159,12 +169,14 @@
struct mbinary1 : public mlc::any<E>
{
template <typename T>
- const typename binary_meta_result<E,T,T>::ret
+ const typename mbinary_result<E,T,T>::ret
operator()(const T& left, const T& right) const
{
return this->exact().impl_binop(left, right);
}
+ // FIXME: handle value_box like above...
+
protected:
mbinary1() {}
@@ -182,14 +194,24 @@
// result
template <template <typename, typename> class F, typename L, typename R>
- struct binary_meta_result < binary_meta<F>, L, R >
+ struct mbinary_result < binary_meta<F>, L, R >
{
- typedef oln_fun2_type_2_of(F<L,R>, res) ret;
+ typedef F<L,R> fun_type;
+ typedef oln_fun2_type_of(fun_type, res) ret;
};
+// template <template <typename, typename> class F, typename Il, typename
Ir>
+// struct mbinary_result < binary_meta<F>, value_box<Il>,
value_box<Ir> >
+// {
+// typedef oln_type_of(Il, value) L;
+// typedef oln_type_of(Ir, value) R;
+// typedef F<L,R> fun_type;
+// typedef oln_fun2_type_of(fun_type, res) ret;
+// };
template <template <typename> class F, typename T>
- struct binary_meta_result < binary1_meta<F>, T, T >
+ struct mbinary_result < binary1_meta<F>, T, T >
{
- typedef oln_fun2_type_of(F<T>, res) ret;
+ typedef F<T> fun_type;
+ typedef oln_fun2_type_of(fun_type, res) ret;
};
// class
Index: oln/funobj/abstract/unary.hh
===================================================================
--- oln/funobj/abstract/unary.hh (revision 179)
+++ oln/funobj/abstract/unary.hh (working copy)
@@ -84,7 +84,7 @@
{
template <typename F, typename T>
- struct unary_meta_result
+ struct munary_result
{
typedef mlc::no_type ret;
};
@@ -118,7 +118,7 @@
struct munary : public mlc::any<E>
{
template <typename T>
- const typename unary_meta_result<E,T>::ret
+ const typename munary_result<E,T>::ret
operator()(const T& arg) const
{
return this->exact().impl_unop(arg);
@@ -141,7 +141,7 @@
// result
template <template <typename> class F, typename T>
- struct unary_meta_result < unary_meta<F>, T >
+ struct munary_result < unary_meta<F>, T >
{
typedef oln_fun1_type_of(F<T>, res) ret;
};
Index: oln/core/abstract/image.hh
===================================================================
--- oln/core/abstract/image.hh (revision 179)
+++ oln/core/abstract/image.hh (working copy)
@@ -486,6 +486,9 @@
} // end of namespace oln
+# include <oln/core/abstract/piter.hh>
+// this allows for browsing points in file
+// where oln/core/abstract/image.hh is included
#endif // ! OLENA_CORE_ABSTRACT_IMAGE_HH
Index: oln/core/apply.hh
===================================================================
--- oln/core/apply.hh (revision 179)
+++ oln/core/apply.hh (working copy)
@@ -28,80 +28,67 @@
#ifndef OLENA_CORE_APPLY_HH
# define OLENA_CORE_APPLY_HH
+# include <mlc/cmp.hh>
# include <mlc/fun.hh>
-# include <oln/basics.hh>
-# include <oln/core/abstract/image_operator.hh>
+# include <oln/core/abstract/image.hh>
+# include <oln/funobj/abstract/unary.hh>
+# include <oln/funobj/abstract/binary.hh>
# include <oln/core/ch_value_type.hh>
+
namespace oln {
+
/*--------.
| Unary. |
`--------*/
- // Fwd decl.
- namespace impl {
- template <typename F, typename I>
- struct apply1_type;
- }
-
- // Super type.
+ /*! \brief Standard unary \a apply procedure.
+ **
+ ** Apply a function \a f to each element of \a input, the function
+ ** is passed as a type and is instantiated.
+ */
template <typename F, typename I>
- struct set_super_type< impl::apply1_type<F, I> >
+ typename ch_value_type<I, typename F::result_type>::ret
+ apply(const mlc::abstract::unary_function<F>& f,
+ const abstract::image<I>& input)
{
- typedef typename ch_value_type<I,
- typename F::result_type>::ret output_type;
- typedef typename abstract::image_operator<output_type, impl::apply1_type<F,
I> > ret;
- };
+ entering("apply");
+ registering(input, "input");
- namespace impl {
+ typedef typename ch_value_type<I, typename F::result_type>::ret
+ output_type;
+ output_type output(input.size(), "output");
- template <typename F, typename I>
- struct apply1_type :
- public abstract::image_operator<
- typename ch_value_type<I, typename F::result_type>::ret,
- apply1_type<F, I> >
- {
- typedef typename ch_value_type<I, typename F::result_type>::ret
- output_type;
+ oln_type_of(I, fwd_piter) p(input.size());
+ for_all_p (p)
+ output[p] = f(input[p]);
- F f_;
- box<const I> input_;
+ exiting("apply");
+ return output;
+ }
- apply1_type(const mlc::abstract::unary_function<F>& f,
- const abstract::image<I>& input) :
- f_(f.exact ()),
- input_(input.exact())
- {
- }
+ // version with oln::f_::abstract::unary<F>
- void impl_run()
- {
- output_type tmp(input_.size());
- oln_type_of(I, fwd_piter) p(input_.size());
- for_all_p (p)
- tmp[p] = f_(input_[p]);
- this->output = tmp;
- }
- };
+ template <typename F, typename I>
+ typename ch_value_type<I, oln_fun1_type_of(F, res)>::ret
+ apply(const oln::f_::abstract::unary<F>& f,
+ const abstract::image<I>& input)
+ {
+ entering("apply");
+ registering(input, "input");
- } // end of namespace impl
+ typedef typename ch_value_type<I, oln_fun1_type_of(F, res)>::ret
+ output_type;
+ output_type output(input.size(), "output");
+ oln_type_of(I, fwd_piter) p(input.size());
+ for_all_p (p)
+ output[p] = f(input[p]);
- /*! \brief Standard unary \a apply procedure.
- **
- ** Apply a function \a f to each element of \a input, the function
- ** is passed as a type and is instantiated.
- */
- template <typename F, typename I>
- impl::apply1_type<F, I>
- apply(const mlc::abstract::unary_function<F>& f,
- const abstract::image<I>& input)
- {
- impl::apply1_type<F, I> tmp(f, input);
- tmp.run();
- return tmp;
+ exiting("apply");
+ return output;
}
@@ -109,77 +96,102 @@
| Binary. |
`---------*/
- // Fwd decl.
- namespace impl {
- template <typename F, typename I1, typename I2>
- struct apply2_type;
+ /*! \brief Standard binary \a apply procedure.
+ **
+ ** Apply a function \a f to each pair of elements of
+ ** \a input1 x \a input2.
+ */
+ template <typename F, typename I1, typename I2>
+ typename ch_value_type<I1, typename F::result_type>::ret
+ apply2(const mlc::abstract::binary_function<F>& f,
+ const abstract::image<I1>& input1,
+ const abstract::image<I2>& input2)
+ {
+ mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
+
+ entering("apply2");
+ registering(input1, "input1");
+ registering(input2, "input2");
+
+ precondition(input1.size() == input2.size());
+
+ typedef typename ch_value_type<I1, typename F::result_type>::ret
+ output_type;
+ output_type output(input1.size(), "output");
+
+ oln_type_of(I1, fwd_piter) p(input1.size());
+ for_all_p (p)
+ output[p] = f(input1[p], input2[p]);
+
+ exiting("apply2");
+ return output;
}
- // Super type.
+
+ // version with oln::f_::abstract::binary<F>
+
template <typename F, typename I1, typename I2>
- struct set_super_type< impl::apply2_type<F, I1, I2> >
+ typename ch_value_type<I1, oln_fun2_type_of(F, res)>::ret
+ apply2(const oln::f_::abstract::binary<F>& f,
+ const abstract::image<I1>& input1,
+ const abstract::image<I2>& input2)
{
- typedef typename ch_value_type<I1,
- typename F::result_type>::ret output_type;
- typedef typename abstract::image_operator<output_type,
- impl::apply2_type<F, I1, I2> > ret;
- };
+ mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
- namespace impl {
+ entering("apply2");
+ registering(input1, "input1");
+ registering(input2, "input2");
- template <typename F, typename I1, typename I2>
- struct apply2_type :
- public abstract::image_operator<
- typename ch_value_type<I1, typename F::result_type>::ret,
- apply2_type<F, I1, I2> >
- {
- typedef typename ch_value_type<I1, typename F::result_type>::ret
- output_type;
+ precondition(input1.size() == input2.size());
- F f_;
- box<const I1> input1_;
- box<const I2> input2_;
+ typedef typename ch_value_type<I1, oln_fun2_type_of(F, res)>::ret
+ output_type;
+ output_type output(input1.size(), "output");
- apply2_type(const mlc::abstract::binary_function<F>& f,
- const abstract::image<I1>& input1,
- const abstract::image<I2>& input2) :
- f_(f.exact ()),
- input1_(input1.exact()),
- input2_(input2.exact())
- {
- assertion (input1_.size() == input2_.size());
- }
+ oln_type_of(I1, fwd_piter) p(input1.size());
+ for_all_p (p)
+ output[p] = f(input1[p], input2[p]);
- void impl_run()
- {
- output_type tmp(input1_.size());
- oln_type_of(I1, fwd_piter) p(input1_.size());
- for_all_p (p)
- tmp[p] = f_(input1_[p], input2_[p]);
- this->output = tmp;
- }
- };
+ exiting("apply2");
+ return output;
+ }
- } // end of namespace impl
+ // version with oln::f_::abstract::mbinary<F>
- /*! \brief Standard binary \a apply procedure.
- **
- ** Apply a function \a f to each pair of elements of
- ** \a input1 x \a input2.
- */
template <typename F, typename I1, typename I2>
- impl::apply2_type<F, I1, I2>
- apply(const mlc::abstract::binary_function<F>& f,
- const abstract::image<I1>& input1,
- const abstract::image<I2>& input2)
+ typename ch_value_type<I1, typename f_::mbinary_result<F,
+ oln_type_of(I1, value),
+ oln_type_of(I2, value)>::ret
+ >::ret
+ apply2(const oln::f_::abstract::mbinary<F>& f,
+ const abstract::image<I1>& input1,
+ const abstract::image<I2>& input2)
{
- assertion (input1.size() == input2.size());
- impl::apply2_type<F, I1, I2> tmp(f, input1, input2);
- tmp.run();
- return tmp;
+ mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
+
+ entering("apply2");
+ registering(input1, "input1");
+ registering(input2, "input2");
+
+ precondition(input1.size() == input2.size());
+
+ typedef
+ typename ch_value_type<I1, typename f_::mbinary_result<F,
+ oln_type_of(I1, value),
+ oln_type_of(I2, value)>::ret
+ >::ret output_type;
+ output_type output(input1.size(), "output");
+
+ oln_type_of(I1, fwd_piter) p(input1.size());
+ for_all_p (p)
+ output[p] = f(input1[p], input2[p]);
+
+ exiting("apply2");
+ return output;
}
+
} // end of namespace oln
#endif // ! OLENA_CORE_APPLY_HH
Index: oln/core/ch_value_type.hh
===================================================================
--- oln/core/ch_value_type.hh (revision 179)
+++ oln/core/ch_value_type.hh (working copy)
@@ -30,6 +30,16 @@
# include <oln/core/abstract/image.hh>
+
+# define oln_ch_value_type(I, T) \
+ typename ch_value_type< I, T >::ret
+
+
+// FIXME: bad name...
+# define oln_ch_concrete_type(I, T) \
+ typename ch_value_type< oln_type_of(I, concrete), T >::ret
+
+
namespace oln {
template<class I, class T = oln_type_of(I, value)>
Index: oln/core/pw/binary_op.hh
===================================================================
--- oln/core/pw/binary_op.hh (revision 179)
+++ oln/core/pw/binary_op.hh (working copy)
@@ -50,9 +50,9 @@
struct set_props < category::pw, pw::binary_op<F,L,R> >
{
typedef
- typename f_::binary_meta_result< F,
- oln_pw_type_of(L, value),
- oln_pw_type_of(R, value) >::ret
+ typename f_::mbinary_result< F,
+ oln_pw_type_of(L, value),
+ oln_pw_type_of(R, value) >::ret
value_type;
};
Index: oln/core/pw/unary_op.hh
===================================================================
--- oln/core/pw/unary_op.hh (revision 179)
+++ oln/core/pw/unary_op.hh (working copy)
@@ -50,7 +50,7 @@
template <typename F, typename A>
struct set_props < category::pw, pw::unary_op<F,A> >
{
- typedef typename f_::unary_meta_result<F,A>::ret value_type;
+ typedef typename f_::munary_result<F,A>::ret value_type;
};
Index: oln/utils/clone.hh
===================================================================
--- oln/utils/clone.hh (revision 179)
+++ oln/utils/clone.hh (working copy)
@@ -28,74 +28,59 @@
#ifndef OLN_UTILS_CLONE_HH
# define OLN_UTILS_CLONE_HH
-# include <oln/basics.hh>
-# include <oln/core/abstract/image_operator.hh>
+# include <oln/core/abstract/image.hh>
+# include <oln/utils/record.hh>
-namespace oln {
- // fwd decl
- namespace utils {
- namespace impl {
- template <typename I> struct clone_type;
- }
- }
+namespace oln
+{
- // category
- template <typename I>
- struct set_category < utils::impl::clone_type<I> >
- {
- typedef category::image ret;
- };
+ // Fwd decl of erosion's facade.
- // super_type
template <typename I>
- struct set_super_type < utils::impl::clone_type<I> >
- {
- typedef abstract::image_unary_operator<I, I, utils::impl::clone_type<I> >
ret;
- };
+ oln_type_of(I, concrete) clone(const abstract::image<I>& input);
+ namespace impl {
- namespace utils {
+ // generic
- namespace impl {
+ template <typename I>
+ oln_type_of(I, concrete) clone_(const abstract::image<I>& input)
+ {
+ entering("->generic");
+ registering(input, "input");
- template <typename I>
- struct clone_type
- : public abstract::image_unary_operator<oln_type_of(I, concrete), I,
clone_type<I> >
- // FIXME: use concrete_type; Cf. erosion.hh
- {
- typedef abstract::image_unary_operator<oln_type_of(I, concrete), I,
clone_type<I> > super_type;
+ oln_type_of(I, concrete) output(input.size(), "output");
+ oln_type_of(I, fwd_piter) p(input.size());
+ for_all_p (p)
+ output[p] = input[p];
- clone_type(const abstract::image<I>& input) :
- super_type(input)
- {
- }
+ exiting("->generic");
+ return output;
+ }
- void impl_run()
- {
- oln_type_of(I, concrete) tmp(this->input.size()); // FIXME: trick
- this->output = tmp;
+ // add some other impls here...
- oln_type_of(I, fwd_piter) p(this->input.size());
- for_all_p (p)
- this->output[p] = this->input[p];
- }
- };
+ } // end of namespace oln::morpho::impl
- } // end of namespace oln::utils::impl
+ /// Generic clone (facade).
- template <typename I>
- impl::clone_type<I> clone(const abstract::image<I>& ima)
- {
- impl::clone_type<I> tmp(ima.exact());
- tmp.run();
- return tmp;
- }
+ template <typename I>
+ oln_type_of(I, concrete) clone(const abstract::image<I>& input)
+ {
+ entering("clone");
+ registering(input, "input");
- } // end of namespace oln::utils
+ oln_type_of(I, concrete) output("output");
+ output = impl::clone_(input.exact());
+ exiting("clone");
+ return output;
+ }
+
+
} // end of namespace oln
Index: oln/ops/arith.hh
===================================================================
--- oln/ops/arith.hh (revision 0)
+++ oln/ops/arith.hh (working copy)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef OLENA_ARITH_OPS_HH
-# define OLENA_ARITH_OPS_HH
+#ifndef OLENA_OPS_ARITH_HH
+# define OLENA_OPS_ARITH_HH
# include <oln/core/abstract/image.hh>
# include <oln/core/pw/image.hh>
@@ -157,4 +157,4 @@
// FIXME: to be continued...
-#endif // ! OLENA_ARITH_OPS_HH
+#endif // ! OLENA_OPS_ARITH_HH
Index: oln/ops/logic.hh
===================================================================
--- oln/ops/logic.hh (revision 0)
+++ oln/ops/logic.hh (working copy)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef OLENA_ARITH_LOGIC_HH
-# define OLENA_ARITH_LOGIC_HH
+#ifndef OLENA_OPS_LOGIC_HH
+# define OLENA_OPS_LOGIC_HH
# include <oln/core/abstract/image.hh>
# include <oln/core/pw/image.hh>
@@ -85,4 +85,4 @@
-#endif // ! OLENA_ARITH_LOGIC_HH
+#endif // ! OLENA_OPS_LOGIC_HH
Index: oln/ops/cmp.hh
===================================================================
--- oln/ops/cmp.hh (revision 0)
+++ oln/ops/cmp.hh (working copy)
@@ -25,8 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef OLENA_ARITH_CMP_HH
-# define OLENA_ARITH_CMP_HH
+#ifndef OLENA_OPS_CMP_HH
+# define OLENA_OPS_CMP_HH
# include <oln/core/abstract/image.hh>
# include <oln/core/pw/cmp.hh>
@@ -93,4 +93,4 @@
}
-#endif // ! OLENA_ARITH_CMP_HH
+#endif // ! OLENA_OPS_CMP_HH
Index: oln/morpho/geodesic_dilation.hh
===================================================================
--- oln/morpho/geodesic_dilation.hh (revision 179)
+++ oln/morpho/geodesic_dilation.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003, 2004, 2005 EPITA Research and Development Laboratory
+// Copyright (C) 2001-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
@@ -32,7 +32,7 @@
# include <mlc/contract.hh>
# include <oln/utils/record.hh>
-# include <oln/arith/cmp.hh>
+# include <oln/ops/cmp.hh>
# include <oln/core/gen/image_with_nbh.hh> // FIXME: should be in core/abstract/
(?)
# include <oln/morpho/elementary_dilation.hh>
Index: oln/morpho/geodesic_erosion.hh
===================================================================
--- oln/morpho/geodesic_erosion.hh (revision 179)
+++ oln/morpho/geodesic_erosion.hh (working copy)
@@ -1,4 +1,4 @@
-// Copyright (C) 2005 EPITA Research and Development Laboratory
+// Copyright (C) 2001-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
@@ -32,7 +32,7 @@
# include <mlc/contract.hh>
# include <oln/utils/record.hh>
-# include <oln/arith/cmp.hh>
+# include <oln/ops/cmp.hh>
# include <oln/core/gen/image_with_nbh.hh>
# include <oln/morpho/elementary_erosion.hh>
Index: oln/arith/ops.hh
===================================================================
--- oln/arith/ops.hh (revision 179)
+++ oln/arith/ops.hh (working copy)
@@ -1,160 +0,0 @@
-// 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_ARITH_OPS_HH
-# define OLENA_ARITH_OPS_HH
-
-# include <oln/core/abstract/image.hh>
-# include <oln/core/pw/image.hh>
-# include <oln/core/pw/value.hh>
-# include <oln/core/pw/arith.hh>
-
-
-namespace oln
-{
-
- /// Operator-like "min" and "max" between 2 images.
-
- template <typename L, typename R>
- image_from_pwf< pw::binary_op< f_min_type,
- pw::value<L>,
- pw::value<R> > >
- min (const abstract::image<L>& lhs,
- const abstract::image<R>& rhs)
- {
- return image_for_all_p( min(pw_value(lhs), pw_value(rhs)) );
- }
-
- template <typename L, typename R>
- image_from_pwf< pw::binary_op< f_max_type,
- pw::value<L>,
- pw::value<R> > >
- max (const abstract::image<L>& lhs,
- const abstract::image<R>& rhs)
- {
- return image_for_all_p( max(pw_value(lhs), pw_value(rhs)) );
- }
-
-} // end of namespace oln
-
-
-/// Operator '+' between 2 images.
-
-template <typename L, typename R>
-oln::image_from_pwf< oln::pw::binary_op< oln::f_plus_type,
- oln::pw::value<L>,
- oln::pw::value<R> > >
-operator + (const oln::abstract::image<L>& lhs,
- const oln::abstract::image<R>& rhs)
-{
- return oln::image_for_all_p(oln::pw_value(lhs) + oln::pw_value(rhs));
-}
-
-
-/// Operator '-' between 2 images.
-
-template <typename L, typename R>
-oln::image_from_pwf< oln::pw::binary_op< oln::f_minus_type,
- oln::pw::value<L>,
- oln::pw::value<R> > >
-operator - (const oln::abstract::image<L>& lhs,
- const oln::abstract::image<R>& rhs)
-{
- return oln::image_for_all_p(oln::pw_value(lhs) - oln::pw_value(rhs));
-}
-
-
-/// Operator '*' between 2 images.
-
-template <typename L, typename R>
-oln::image_from_pwf< oln::pw::binary_op< oln::f_times_type,
- oln::pw::value<L>,
- oln::pw::value<R> > >
-operator * (const oln::abstract::image<L>& lhs,
- const oln::abstract::image<R>& rhs)
-{
- return oln::image_for_all_p(oln::pw_value(lhs) * oln::pw_value(rhs));
-}
-
-
-/// Operator '/' between 2 images.
-
-template <typename L, typename R>
-oln::image_from_pwf< oln::pw::binary_op< oln::f_div_type,
- oln::pw::value<L>,
- oln::pw::value<R> > >
-operator / (const oln::abstract::image<L>& lhs,
- const oln::abstract::image<R>& rhs)
-{
- return oln::image_for_all_p(oln::pw_value(lhs) / oln::pw_value(rhs));
-}
-
-
-/// Operator '%' between 2 images.
-
-template <typename L, typename R>
-oln::image_from_pwf< oln::pw::binary_op< oln::f_mod_type,
- oln::pw::value<L>,
- oln::pw::value<R> > >
-operator % (const oln::abstract::image<L>& lhs,
- const oln::abstract::image<R>& rhs)
-{
- return oln::image_for_all_p(oln::pw_value(lhs) % oln::pw_value(rhs));
-}
-
-
-
-
-// FIXME...
-
-// /// Operator - (unary) on image.
-
-// template <typename R>
-// oln::image_from_pw< oln::pw::minus< oln::pw::literal< oln_pw_type_of(R,
value) >,
-// oln::pw::image<R> > >
-// operator - (const oln::abstract::image<R>& rhs)
-// {
-// return oln::image_for_all_p( - oln::p_value(rhs));
-// }
-
-
-// template <typename I, typename F>
-// void operator + (const oln::abstract::image<I>&,
-// const oln::pw::abstract::function<F>&)
-// {
-// struct OLENA_ERROR__args_are_not_compatible();
-// }
-// template <typename F, typename I>
-// void operator + (const oln::pw::abstract::function<F>&,
-// const oln::abstract::image<I>&)
-// {
-// struct OLENA_ERROR__args_are_not_compatible();
-// }
-// FIXME: to be continued...
-
-
-#endif // ! OLENA_ARITH_OPS_HH
Index: oln/arith/min.hh
===================================================================
--- oln/arith/min.hh (revision 179)
+++ oln/arith/min.hh (working copy)
@@ -1,105 +0,0 @@
-// 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_ARITH_MIN_HH
-# define OLENA_ARITH_MIN_HH
-
-# include <oln/basics.hh>
-# include <oln/core/abstract/image_operator.hh>
-
-# include <ntg/all.hh>
-
-namespace oln {
-
- namespace arith {
- // fwd decl
- namespace impl {
- template <typename I1, typename I2> struct min_type;
- }
-
- }
-
- // super_type
- template <typename I1, typename I2>
- struct set_super_type< arith::impl::min_type<I1, I2> >
- {
- typedef oln_type_of(I1, concrete) output_type;
- typedef arith::impl::min_type<I1, I2> self_type;
- typedef abstract::image_binary_operator<output_type, I1, I2, self_type> ret;
- };
-
- namespace arith {
-
- namespace impl {
-
- template <typename I1, typename I2>
- struct min_type :
- // FIXME: oln_super_of_
- public oln::internal::get_super_type< min_type<I1,I2> >::ret
- {
- typedef typename oln::internal::get_super_type< min_type<I1,I2> >::ret
- super_type;
- typedef oln_type_of(I1, concrete) output_type;
-
- min_type(const abstract::image<I1>& input1,
- const abstract::image<I2>& input2) :
- super_type(input1.exact(), input2.exact())
- {}
-
- void impl_run()
- {
- precondition(this->input1.size() == this->input2.size());
- output_type output(this->input1.size());
-
- oln_type_of(I1, fwd_piter) p(this->input1.size());
-
- for_all_p (p)
- output[p] = ntg::min(this->input1[p].value(), this->input2[p].value());
-
- this->output = output;
- }
-
- };
-
- }
-
- template <typename I1, typename I2>
- impl::min_type<I1, I2> min(const abstract::image<I1>& input1,
- const abstract::image<I2>& input2)
- {
- mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
- impl::min_type<I1, I2> tmp(input1, input2);
- tmp.run();
- return tmp;
- }
-
- }
-
-} // end of namespace oln
-
-
-#endif // ! OLENA_ARITH_MIN_HH
Index: oln/arith/max.hh
===================================================================
--- oln/arith/max.hh (revision 179)
+++ oln/arith/max.hh (working copy)
@@ -1,105 +0,0 @@
-// 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_ARITH_MAX_HH
-# define OLENA_ARITH_MAX_HH
-
-# include <oln/basics.hh>
-# include <oln/core/abstract/image_operator.hh>
-
-# include <ntg/all.hh>
-
-namespace oln {
-
- namespace arith {
- // fwd decl
- namespace impl {
- template <typename I1, typename I2> struct max_type;
- }
-
- }
-
- // super_type
- template <typename I1, typename I2>
- struct set_super_type< arith::impl::max_type<I1, I2> >
- {
- typedef oln_type_of(I1, concrete) output_type;
- typedef arith::impl::max_type<I1, I2> self_type;
- typedef abstract::image_binary_operator<output_type, I1, I2, self_type> ret;
- };
-
- namespace arith {
-
- namespace impl {
-
- template <typename I1, typename I2>
- struct max_type :
- // FIXME: oln_super_of_
- public oln::internal::get_super_type< max_type<I1,I2> >::ret
- {
- typedef typename oln::internal::get_super_type< max_type<I1,I2> >::ret
- super_type;
- typedef oln_type_of(I1, concrete) output_type;
-
- max_type(const abstract::image<I1>& input1,
- const abstract::image<I2>& input2) :
- super_type(input1.exact(), input2.exact())
- {}
-
- void impl_run()
- {
- precondition(this->input1.size() == this->input2.size());
- output_type output(this->input1.size());
-
- oln_type_of(I1, fwd_piter) p(this->input1.size());
-
- for_all_p (p)
- output[p] = ntg::max(this->input1[p].value(), this->input2[p].value());
-
- this->output = output;
- }
-
- };
-
- }
-
- template <typename I1, typename I2>
- impl::max_type<I1, I2> max(const abstract::image<I1>& input1,
- const abstract::image<I2>& input2)
- {
- mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
- impl::max_type<I1, I2> tmp(input1, input2);
- tmp.run();
- return tmp;
- }
-
- }
-
-} // end of namespace oln
-
-
-#endif // ! OLENA_ARITH_MAX_HH
Index: oln/arith/logic.hh
===================================================================
--- oln/arith/logic.hh (revision 179)
+++ oln/arith/logic.hh (working copy)
@@ -1,88 +0,0 @@
-// 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_ARITH_LOGIC_HH
-# define OLENA_ARITH_LOGIC_HH
-
-# include <oln/core/abstract/image.hh>
-# include <oln/core/pw/image.hh>
-# include <oln/core/pw/value.hh>
-# include <oln/core/pw/logic.hh>
-
-
-/// Operator 'and' between 2 binary images.
-
-template <typename L, typename R>
-const oln::image_from_pwf< oln::pw::binary_op< oln::f_and_type,
- oln::pw::value<L>,
- oln::pw::value<R> > >
-operator and (const oln::abstract::binary_image<L>& lhs,
- const oln::abstract::binary_image<R>& rhs)
-{
- return oln::image_for_all_p(oln::pw_value(lhs) and oln::pw_value(rhs));
-}
-
-
-/// Operator 'or' between 2 binary images.
-
-template <typename L, typename R>
-const oln::image_from_pwf< oln::pw::binary_op< oln::f_or_type,
- oln::pw::value<L>,
- oln::pw::value<R> > >
-operator or (const oln::abstract::binary_image<L>& lhs,
- const oln::abstract::binary_image<R>& rhs)
-{
- return oln::image_for_all_p(oln::pw_value(lhs) or oln::pw_value(rhs));
-}
-
-
-/// Operator 'xor' between 2 binary images.
-
-template <typename L, typename R>
-const oln::image_from_pwf< oln::pw::binary_op< oln::f_xor_type,
- oln::pw::value<L>,
- oln::pw::value<R> > >
-operator xor (const oln::abstract::binary_image<L>& lhs,
- const oln::abstract::binary_image<R>& rhs)
-{
- return oln::image_for_all_p(oln::pw_value(lhs) xor oln::pw_value(rhs));
-}
-
-
-// FIXME...
-// /// Unary operator 'not' on a binary image.
-
-// template <typename I>
-// oln::image_from_pw< oln::pw::not_< oln::pw::image<I> > >
-// operator ! (const oln::abstract::binary_image<I>& rhs)
-// {
-// return oln::image_for_all_p(!oln::p_value(rhs));
-// }
-
-
-
-#endif // ! OLENA_ARITH_LOGIC_HH
Index: oln/arith/cmp.hh
===================================================================
--- oln/arith/cmp.hh (revision 179)
+++ oln/arith/cmp.hh (working copy)
@@ -1,96 +0,0 @@
-// 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_ARITH_CMP_HH
-# define OLENA_ARITH_CMP_HH
-
-# include <oln/core/abstract/image.hh>
-# include <oln/core/pw/cmp.hh>
-# include <oln/core/pw/check.hh>
-
-
-/// Operator '==' between 2 images.
-
-template <typename L, typename R>
-bool operator == (const oln::abstract::image<L>& lhs,
- const oln::abstract::image<R>& rhs)
-{
- return oln::pw::check(oln::pw_value(lhs) == oln::pw_value(rhs));
-}
-
-
-/// Operator '!=' between 2 images.
-
-template <typename L, typename R>
-bool operator != (const oln::abstract::image<L>& lhs,
- const oln::abstract::image<R>& rhs)
-{
- return oln::pw::check(oln::pw_value(lhs) != oln::pw_value(rhs));
-}
-
-
-/// Operator '<' between 2 images.
-
-template <typename L, typename R>
-bool operator < (const oln::abstract::image<L>& lhs,
- const oln::abstract::image<R>& rhs)
-{
- return oln::pw::check(oln::pw_value(lhs) < oln::pw_value(rhs));
-}
-
-
-/// Operator '<=' between 2 images.
-
-template <typename L, typename R>
-bool operator <= (const oln::abstract::image<L>& lhs,
- const oln::abstract::image<R>& rhs)
-{
- return oln::pw::check(oln::pw_value(lhs) <= oln::pw_value(rhs));
-}
-
-
-/// Operator '>' between 2 images.
-
-template <typename L, typename R>
-bool operator > (const oln::abstract::image<L>& lhs,
- const oln::abstract::image<R>& rhs)
-{
- return oln::pw::check(oln::pw_value(lhs) > oln::pw_value(rhs));
-}
-
-
-/// Operator '>=' between 2 images.
-
-template <typename L, typename R>
-bool operator >= (const oln::abstract::image<L>& lhs,
- const oln::abstract::image<R>& rhs)
-{
- return oln::pw::check(oln::pw_value(lhs) >= oln::pw_value(rhs));
-}
-
-
-#endif // ! OLENA_ARITH_CMP_HH
Index: oln/level/arith.hh
===================================================================
--- oln/level/arith.hh (revision 0)
+++ oln/level/arith.hh (revision 0)
@@ -0,0 +1,246 @@
+// 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_LEVEL_ARITH_HH
+# define OLENA_LEVEL_ARITH_HH
+
+# include <mlc/cmp.hh>
+# include <oln/core/ch_value_type.hh>
+
+# include <oln/funobj/arith.hh>
+
+# include <oln/ops/arith.hh>
+# include <oln/utils/clone.hh>
+
+
+# define oln_arith_output(Op, I1, I2) \
+ typename arith_output<f_::Op##_,I1,I2>::ret
+
+
+
+namespace oln
+{
+
+ namespace level
+ {
+
+ // min
+
+ template <typename I1, typename I2>
+ oln_type_of(I1, concrete)
+ min (const abstract::image<I1>& input1,
+ const abstract::image<I2>& input2)
+ {
+ mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
+ mlc::eq<oln_type_of(I1, value), oln_type_of(I2, value)>::ensure();
+
+ entering("level::min");
+ registering(input1, "input1");
+ registering(input2, "input2");
+
+ precondition(input1.size() == input2.size());
+
+ oln_type_of(I1, concrete) output("output");
+ output = clone( oln::min(input1, input2) );
+
+ exiting("level::min");
+ return output;
+ }
+
+
+ // max
+
+ template <typename I1, typename I2>
+ oln_type_of(I1, concrete)
+ max (const abstract::image<I1>& input1,
+ const abstract::image<I2>& input2)
+ {
+ mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
+ mlc::eq<oln_type_of(I1, value), oln_type_of(I2, value)>::ensure();
+
+ entering("level::max");
+ registering(input1, "input1");
+ registering(input2, "input2");
+
+ precondition(input1.size() == input2.size());
+
+ oln_type_of(I1, concrete) output("output");
+ output = clone( oln::max(input1, input2) );
+
+ exiting("level::max");
+ return output;
+ }
+
+
+ // arith output
+
+ template <template <typename, typename> class F,
+ typename I1, typename I2>
+ struct arith_output
+ {
+ typedef oln_type_of(I1, value) T1;
+ typedef oln_type_of(I2, value) T2;
+ typedef oln_fun2_type_2_of(F<T1,T2>, res) T;
+ typedef oln_ch_concrete_type(I1, T) ret;
+ };
+
+
+ template <typename I1, typename I2>
+ oln_arith_output(plus, I1, I2)
+ f_plus (const abstract::image<I1>& input1,
+ const abstract::image<I2>& input2)
+ {
+ // FIXME: recording(?)
+ mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
+ typedef oln::f_::plus_<oln_type_of(I1, value), oln_type_of(I2, value)>
fun_type;
+ return apply2(fun_type(), input1, input2);
+ // FIXME: does not work yet!
+// return apply2(oln::f_plus, input1, input2);
+ }
+
+
+// // plus
+
+// template <typename I1, typename I2>
+// oln_arith_output(plus,I1,I2)
+// plus (const abstract::image<I1>& input1,
+// const abstract::image<I2>& input2)
+// {
+// mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
+
+// entering("level::plus");
+// registering(input1, "input1");
+// registering(input2, "input2");
+
+// precondition(input1.size() == input2.size());
+
+// oln_arith_output(plus,I1,I2) output("output");
+// output = clone( input1 + input2 );
+
+// exiting("level::plus");
+// return output;
+// }
+
+
+ // minus
+
+ template <typename I1, typename I2>
+ oln_arith_output(minus,I1,I2)
+ minus (const abstract::image<I1>& input1,
+ const abstract::image<I2>& input2)
+ {
+ mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
+
+ entering("level::minus");
+ registering(input1, "input1");
+ registering(input2, "input2");
+
+ precondition(input1.size() == input2.size());
+
+ oln_arith_output(minus,I1,I2) output("output");
+ output = clone( input1 + input2 );
+
+ exiting("level::minus");
+ return output;
+ }
+
+
+ // times
+
+ template <typename I1, typename I2>
+ oln_arith_output(times,I1,I2)
+ times (const abstract::image<I1>& input1,
+ const abstract::image<I2>& input2)
+ {
+ mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
+
+ entering("level::times");
+ registering(input1, "input1");
+ registering(input2, "input2");
+
+ precondition(input1.size() == input2.size());
+
+ oln_arith_output(times,I1,I2) output("output");
+ output = clone( input1 + input2 );
+
+ exiting("level::times");
+ return output;
+ }
+
+
+ // div
+
+ template <typename I1, typename I2>
+ oln_arith_output(div,I1,I2)
+ div (const abstract::image<I1>& input1,
+ const abstract::image<I2>& input2)
+ {
+ mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
+
+ entering("level::div");
+ registering(input1, "input1");
+ registering(input2, "input2");
+
+ precondition(input1.size() == input2.size());
+
+ oln_arith_output(div,I1,I2) output("output");
+ output = clone( input1 + input2 );
+
+ exiting("level::div");
+ return output;
+ }
+
+
+ // mod
+
+ template <typename I1, typename I2>
+ oln_arith_output(mod,I1,I2)
+ mod (const abstract::image<I1>& input1,
+ const abstract::image<I2>& input2)
+ {
+ mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
+
+ entering("level::mod");
+ registering(input1, "input1");
+ registering(input2, "input2");
+
+ precondition(input1.size() == input2.size());
+
+ oln_arith_output(mod,I1,I2) output("output");
+ output = clone( input1 + input2 );
+
+ exiting("level::mod");
+ return output;
+ }
+
+
+ } // end of namespace oln::level
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_LEVEL_ARITH_HH
Index: oln/level/logic.hh
===================================================================
--- oln/level/logic.hh (revision 0)
+++ oln/level/logic.hh (revision 0)
@@ -0,0 +1,122 @@
+// 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_LEVEL_LOGIC_HH
+# define OLENA_LEVEL_LOGIC_HH
+
+# include <oln/core/abstract/image_entry.hh>
+# include <oln/core/apply.hh>
+# include <oln/funobj/logic.hh>
+
+
+
+namespace oln
+{
+
+ namespace level
+ {
+
+ // f_and
+
+ template <typename I1, typename I2>
+ oln_type_of(I1, concrete)
+ f_and (const abstract::binary_image<I1>& input1,
+ const abstract::binary_image<I2>& input2)
+ {
+ // FIXME: recording(?)
+ mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
+ return apply2(oln::f_and, input1, input2);
+ }
+
+
+ // f_nand
+
+ template <typename I1, typename I2>
+ oln_type_of(I1, concrete)
+ f_nand (const abstract::binary_image<I1>& input1,
+ const abstract::binary_image<I2>& input2)
+ {
+ mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
+ return apply2(oln::f_nand, input1, input2);
+ }
+
+
+ // f_or
+
+ template <typename I1, typename I2>
+ oln_type_of(I1, concrete)
+ f_or (const abstract::binary_image<I1>& input1,
+ const abstract::binary_image<I2>& input2)
+ {
+ mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
+ return apply2(oln::f_or, input1, input2);
+ }
+
+
+ // f_nor
+
+ template <typename I1, typename I2>
+ oln_type_of(I1, concrete)
+ f_nor (const abstract::binary_image<I1>& input1,
+ const abstract::binary_image<I2>& input2)
+ {
+ mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
+ return apply2(oln::f_nor, input1, input2);
+ }
+
+
+
+ // f_xor
+
+ template <typename I1, typename I2>
+ oln_type_of(I1, concrete)
+ f_xor (const abstract::binary_image<I1>& input1,
+ const abstract::binary_image<I2>& input2)
+ {
+ mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
+ return apply2(oln::f_xor, input1, input2);
+ }
+
+
+ // f_nxor
+
+ template <typename I1, typename I2>
+ oln_type_of(I1, concrete)
+ f_xnor (const abstract::binary_image<I1>& input1,
+ const abstract::binary_image<I2>& input2)
+ {
+ mlc::eq<oln_type_of(I1, grid), oln_type_of(I2, grid)>::ensure();
+ return apply2(oln::f_xnor, input1, input2);
+ }
+
+
+ } // end of namespace oln::level
+
+} // end of namespace oln
+
+
+#endif // ! OLENA_LEVEL_LOGIC_HH