Commit 62b2f613 authored by Edwin Carlinet's avatar Edwin Carlinet
Browse files

Move inf and sup accumulators into math directory.

	* mln/accu/inf.hh,
	* mln/accu/sup.hh: Move to...
	* mln/accu/math/inf.hh,
	* mln/accu/math/sup.hh:
	Move inf, sup accus.

	* mln/accu/math/all.hh:
	Update all.hh with respect to new location.

	* sandbox/theo/esiee/slides_2009_may/dilation.hh:
	Replace accu::accu_name by accu::math::accu_name,
		accu/accu_name by accu/math/accu_name.

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@4148 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 3bc3f741
2009-06-15 Edwin Carlinet <carlinet@lrde.epita.fr>
Move inf and sup accumulators into math directory.
* mln/accu/inf.hh,
* mln/accu/sup.hh: Move to...
* mln/accu/math/inf.hh,
* mln/accu/math/sup.hh:
Move inf, sup accus.
* mln/accu/math/all.hh:
Update all.hh with respect to new location.
* sandbox/theo/esiee/slides_2009_may/dilation.hh:
Replace accu::accu_name by accu::math::accu_name,
accu/accu_name by accu/math/accu_name.
2009-06-15 Guillaume Lazzara <guillaume.lazzara@lrde.epita.fr>
 
Small fixes.
......@@ -54,5 +54,7 @@ namespace mln
# include <mln/accu/math/sum.hh>
# include <mln/accu/math/count.hh>
# include <mln/accu/math/inf.hh>
# include <mln/accu/math/sup.hh>
#endif // ! MLN_ACCU_MATH_ALL_HH
......@@ -23,8 +23,8 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
#ifndef MLN_ACCU_INF_HH
# define MLN_ACCU_INF_HH
#ifndef MLN_ACCU_MATH_INF_HH
# define MLN_ACCU_MATH_INF_HH
/// \file
///
......@@ -42,124 +42,137 @@ namespace mln
namespace accu
{
/// \brief Generic inf accumulator class.
///
/// The parameter \c T is the type of values.
///
/// \ingroup modaccuvalues
//
template <typename T>
struct inf : public mln::accu::internal::base< const T&, inf<T> >
namespace math
{
typedef T argument;
inf();
/// Manipulators.
/// \{
void init();
void take_as_init_(const argument& t);
void take(const argument& t);
void take(const inf<T>& other);
/// \}
/// \brief Generic inf accumulator class.
///
/// The parameter \c T is the type of values.
///
/// \ingroup modaccuvalues
//
template <typename T>
struct inf : public mln::accu::internal::base< const T&, inf<T> >
{
typedef T argument;
inf();
/// Get the value of the accumulator.
const T& to_result() const;
/// Manipulators.
/// \{
void init();
void take_as_init_(const argument& t);
void take(const argument& t);
void take(const inf<T>& other);
/// \}
/// Check whether this accu is able to return a result.
/// Always true here.
bool is_valid() const;
/// Get the value of the accumulator.
const T& to_result() const;
protected:
/// Check whether this accu is able to return a result.
/// Always true here.
bool is_valid() const;
T t_;
typename mln::fun::inf::with<T, T>::ret fun_;
};
protected:
T t_;
typename mln::fun::inf::with<T, T>::ret fun_;
};
template <typename I> struct inf< util::pix<I> >;
template <typename I> struct inf< util::pix<I> >;
} // end of mln::accu::math
namespace meta
{
/// Meta accumulator for inf.
struct inf : public Meta_Accumulator< inf >
namespace math
{
template <typename T>
struct with
/// Meta accumulator for inf.
struct inf : public Meta_Accumulator< inf >
{
typedef accu::inf<T> ret;
template <typename T>
struct with
{
typedef accu::math::inf<T> ret;
};
};
};
} // end of namespace mln::accu::meta
} // end of namespace mln::accu::meta::math
} // end of namespace mln::accu::meta
# ifndef MLN_INCLUDE_ONLY
# ifndef MLN_INCLUDE_ONLY
template <typename T>
inline
inf<T>::inf()
namespace math
{
init();
}
template <typename T>
inline
void
inf<T>::init()
{
t_ = mln_max(T);
}
template <typename T>
inline
inf<T>::inf()
{
init();
}
template <typename T>
inline
void inf<T>::take_as_init_(const argument& t)
{
t_ = t;
}
template <typename T>
inline
void
inf<T>::init()
{
t_ = mln_max(T);
}
template <typename T>
inline
void inf<T>::take(const argument& t)
{
this->t_ = this->fun_(t_, t);
}
template <typename T>
inline
void inf<T>::take_as_init_(const argument& t)
{
t_ = t;
}
template <typename T>
inline
void
inf<T>::take(const inf<T>& other)
{
this->t_ = this->fun_(t_, other.t_);
}
template <typename T>
inline
void inf<T>::take(const argument& t)
{
this->t_ = this->fun_(t_, t);
}
template <typename T>
inline
const T&
inf<T>::to_result() const
{
return t_;
}
template <typename T>
inline
void
inf<T>::take(const inf<T>& other)
{
this->t_ = this->fun_(t_, other.t_);
}
template <typename T>
inline
bool
inf<T>::is_valid() const
{
return true;
}
template <typename T>
inline
const T&
inf<T>::to_result() const
{
return t_;
}
template <typename T>
inline
bool
inf<T>::is_valid() const
{
return true;
}
# endif // ! MLN_INCLUDE_ONLY
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::accu::math
} // end of namespace mln::accu
} // end of namespace mln
#endif // ! MLN_ACCU_INF_HH
#endif // ! MLN_ACCU_MATH_INF_HH
......@@ -23,8 +23,8 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
#ifndef MLN_ACCU_SUP_HH
# define MLN_ACCU_SUP_HH
#ifndef MLN_ACCU_MATH_SUP_HH
# define MLN_ACCU_MATH_SUP_HH
/// \file
///
......@@ -42,124 +42,139 @@ namespace mln
namespace accu
{
/// \brief Generic sup accumulator class.
/*!
* The parameter \c T is the type of values.
*
* \ingroup modaccuvalues
*/
template <typename T>
struct sup : public mln::accu::internal::base< const T&, sup<T> >
namespace math
{
typedef T argument;
sup();
/// Manipulators.
/// \{
void init();
void take_as_init_(const argument& t);
void take(const argument& t);
void take(const sup<T>& other);
/// \}
/// \brief Generic sup accumulator class.
/*!
* The parameter \c T is the type of values.
*
* \ingroup modaccuvalues
*/
template <typename T>
struct sup : public mln::accu::internal::base< const T&, sup<T> >
{
typedef T argument;
sup();
/// Get the value of the accumulator.
const T& to_result() const;
/// Manipulators.
/// \{
void init();
void take_as_init_(const argument& t);
void take(const argument& t);
void take(const sup<T>& other);
/// \}
/// Check whether this accu is able to return a result.
/// Always true here.
bool is_valid() const;
/// Get the value of the accumulator.
const T& to_result() const;
protected:
/// Check whether this accu is able to return a result.
/// Always true here.
bool is_valid() const;
T t_;
typename mln::fun::sup::with<T, T>::ret fun_;
};
protected:
T t_;
typename mln::fun::sup::with<T, T>::ret fun_;
};
template <typename I> struct sup< util::pix<I> >;
template <typename I> struct sup< util::pix<I> >;
} // end of mln::accu::math
namespace meta
{
/// Meta accumulator for sup.
struct sup : public Meta_Accumulator< sup >
namespace math
{
template <typename T>
struct with
/// Meta accumulator for sup.
struct sup : public Meta_Accumulator< sup >
{
typedef accu::sup<T> ret;
template <typename T>
struct with
{
typedef accu::math::sup<T> ret;
};
};
};
} // end of namespace mln::accu::meta::math
} // end of namespace mln::accu::meta
# ifndef MLN_INCLUDE_ONLY
# ifndef MLN_INCLUDE_ONLY
template <typename T>
inline
sup<T>::sup()
namespace math
{
init();
}
template <typename T>
inline
void
sup<T>::init()
{
t_ = mln_min(T);
}
template <typename T>
inline
sup<T>::sup()
{
init();
}
template <typename T>
inline
void sup<T>::take_as_init_(const argument& t)
{
t_ = t;
}
template <typename T>
inline
void
sup<T>::init()
{
t_ = mln_min(T);
}
template <typename T>
inline
void sup<T>::take(const argument& t)
{
this->t_ = this->fun_(t_, t);
}
template <typename T>
inline
void sup<T>::take_as_init_(const argument& t)
{
t_ = t;
}
template <typename T>
inline
void
sup<T>::take(const sup<T>& other)
{
this->t_ = this->fun_(t_, other.t_);
}
template <typename T>
inline
void sup<T>::take(const argument& t)
{
this->t_ = this->fun_(t_, t);
}
template <typename T>
inline
const T&
sup<T>::to_result() const
{
return t_;
}
template <typename T>
inline
void
sup<T>::take(const sup<T>& other)
{
this->t_ = this->fun_(t_, other.t_);
}
template <typename T>
inline
bool
sup<T>::is_valid() const
{
return true;
}
template <typename T>
inline
const T&
sup<T>::to_result() const
{
return t_;
}
template <typename T>
inline
bool
sup<T>::is_valid() const
{
return true;
}
# endif // ! MLN_INCLUDE_ONLY
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::accu::math
} // end of namespace mln::accu
} // end of namespace mln
#endif // ! MLN_ACCU_SUP_HH
#endif // ! MLN_ACCU_MATH_SUP_HH
......@@ -52,7 +52,7 @@ namespace mln
mln_piter(I) p(ima.domain());
mln_qiter(W) q(win, p);
accu::sup<mln_value(I)> sup;
accu::math::sup<mln_value(I)> sup;
for_all(p)
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment