Commit 618f8aa5 authored by Thierry Geraud's avatar Thierry Geraud
Browse files

Fix make doc, handle todos, and pass tests with g++-2.95.

	* tests/safe_image.cc,
	* mln/core/concept/genpoint.hh,
	* mln/core/window.hh,
	* mln/core/internal/image_adaptor.hh,
	* mln/core/internal/set_of.hh,
	* mln/level/fill.hh,
	* mln/level/compare.hh,
	* mln/level/paste.hh,
	* mln/make/window2d.hh: Fix.


git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@1014 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 8af8d53c
2007-07-13 Thierry Geraud <thierry.geraud@lrde.epita.fr>
Fix make doc, handle todos, and pass tests with g++-2.95.
* tests/safe_image.cc,
* mln/core/concept/genpoint.hh,
* mln/core/window.hh,
* mln/core/internal/image_adaptor.hh,
* mln/core/internal/set_of.hh,
* mln/level/fill.hh,
* mln/level/compare.hh,
* mln/level/paste.hh,
* mln/make/window2d.hh: Fix.
2007-07-13 Thierry Geraud <thierry.geraud@lrde.epita.fr>
Add subimage in milena.
......
......@@ -185,9 +185,6 @@ namespace mln
*
* \see mln::Dpoint
* \relates mln::GenPoint
*
* \todo Introduce the notion of "generalized dpoint" and
* add the more general extra operator-(GenPoint, GenDpoint).
*/
template <typename P>
mln_point(P)
......
......@@ -103,6 +103,7 @@ namespace mln
template <typename I, typename E, typename S>
bool image_adaptor_<I,E,S>::owns_(const psite& p) const
{
mln_precondition(exact(this)->has_data());
return adaptee_.owns_(p);
}
......@@ -110,6 +111,7 @@ namespace mln
const S&
image_adaptor_<I,E,S>::domain() const
{
mln_precondition(exact(this)->has_data());
return adaptee_.domain();
}
......
......@@ -37,6 +37,8 @@
# include <set>
# include <iterator>
# include <mln/core/internal/force_exact.hh>
namespace mln
{
......@@ -70,9 +72,9 @@ namespace mln
*
* If \p elt is already in the set, this method is a no-op.
*
* \todo Returns exact(*this).
* \return The set itself after insertion.
*/
void insert(const E& elt);
set_of_<E>& insert(const E& elt);
/*! \brief Return the i-th element of the set.
......@@ -189,12 +191,13 @@ namespace mln
}
template <typename E>
void
set_of_<E>&
set_of_<E>::insert(const E& elt)
{
s_.insert(elt);
if (needs_update_ == false)
needs_update_ = true;
return internal::force_exact< set_of_<E> >(*this);
}
template <typename E>
......
......@@ -94,8 +94,6 @@ namespace mln
bool is_centered() const;
/*! \brief Test if the window is symmetric.
*
* \todo Implementation!
*/
bool is_symmetric() const;
......
......@@ -45,7 +45,7 @@ namespace mln
* \param[in] lhs A first image.
* \param[in] rhs A second image.
*
* \todo Test domain equality.
* \pre lhs.domain == rhs.domain
*/
template <typename L, typename R>
bool operator == (const Image<L>& lhs, const Image<R>& rhs);
......@@ -57,7 +57,7 @@ namespace mln
* \param[in] lhs A first image.
* \param[in] rhs A second image.
*
* \todo Test domain equality.
* \pre lhs.domain == rhs.domain
*/
template <typename L, typename R>
bool operator < (const Image<L>& lhs, const Image<R>& rhs);
......@@ -69,7 +69,7 @@ namespace mln
* \param[in] lhs A first image.
* \param[in] rhs A second image.
*
* \todo Test domain equality.
* \pre lhs.domain == rhs.domain
*/
template <typename L, typename R> // required!
bool operator <= (const Image<L>& lhs, const Image<R>& rhs);
......@@ -83,6 +83,7 @@ namespace mln
{
const L& lhs = exact(lhs_);
const R& rhs = exact(rhs_);
mln_precondition(lhs.domain() == rhs.domain());
mln_piter(L) p(lhs.domain());
for_all(p)
if (! (lhs(p) == rhs(p)))
......@@ -95,6 +96,7 @@ namespace mln
{
const L& lhs = exact(lhs_);
const R& rhs = exact(rhs_);
mln_precondition(lhs.domain() == rhs.domain());
mln_piter(L) p(lhs.domain());
for_all(p)
if (! (lhs(p) < rhs(p)))
......@@ -107,6 +109,7 @@ namespace mln
{
const L& lhs = exact(lhs_);
const R& rhs = exact(rhs_);
mln_precondition(lhs.domain() == rhs.domain());
mln_piter(L) p(lhs.domain());
for_all(p)
if (! (lhs(p) <= rhs(p)))
......
......@@ -50,8 +50,7 @@ namespace mln
* \pre \p ima has to be initialized.
*/
template <typename I>
void fill(Image<I>& ima,
const mln_value(I)& v);
void fill(Image<I>& ima, const mln_value(I)& v);
/*! Fill the image \p ima by applying the function \p f.
......@@ -65,8 +64,7 @@ namespace mln
* \pre \p ima has to be initialized.
*/
template <typename I>
void fill(Image<I>& ima,
mln_value(I) (*f)(const mln_point(I)& p));
void fill(Image<I>& ima, mln_value(I) (*f)(const mln_point(I)& p));
/*! Fill the image \p ima with the values given by the array \p arr.
......@@ -78,12 +76,10 @@ namespace mln
* of image points, otherwise the program crashes.
*
* \pre \p ima has to be initialized.
*
* \todo Add as parameter the array size, then add a test.
* \pre N == \p ima.npoints
*/
template <typename I>
void fill(Image<I>& ima,
const mln_value(I) arr[]);
template <typename I, unsigned N>
void fill(Image<I>& ima, mln_value(I) (&arr)[N]);
/*! Fill the image \p ima with the values of the image \p data.
......@@ -94,13 +90,10 @@ namespace mln
* \warning The definition domain of \p ima has to be included in
* the one of \p data.
*
* \pre \p ima has to be initialized.
*
* \todo Test domain inclusion.
* \pre \p ima.domain <= \p data.domain.
*/
template <typename I, typename J>
void fill(Image<I>& ima,
const Image<J>& data);
void fill(Image<I>& ima, const Image<J>& data);
......@@ -128,16 +121,17 @@ namespace mln
ima(p) = f(p);
}
template <typename I>
template <typename I, unsigned N>
void fill(Image<I>& ima_,
const mln_value(I) array[])
mln_value(I) (&arr)[N])
{
I& ima = exact(ima_);
mln_precondition(ima.has_data());
mln_precondition(N == ima.npoints());
mln_piter(I) p(ima.domain());
unsigned i = 0;
for_all(p)
ima(p) = array[i++];
ima(p) = arr[i++];
}
template <typename I, typename J>
......@@ -146,7 +140,7 @@ namespace mln
{
I& ima = exact(ima_);
const J& data = exact(data_);
mln_precondition(ima.has_data() && data.has_data());
mln_precondition(ima.domain() <= data.domain());
mln_piter(I) p(ima.domain());
for_all(p)
......
......@@ -52,12 +52,11 @@ namespace mln
* This routine runs: \n
* for all p of \p data, \p destination(p) = \p data(p).
*
* \warning The definition domain of \p data has to be included
* in the one of \p destination.
* \warning The definition domain of \p data has to be included in
* the one of \p destination; so using mln::safe_image does not
* make pasting outside the destination domain work.
*
* \pre Both images have to be initialized.
*
* \todo Test domain inclusion.
* \pre \p data.domain <= \p destination.domain
*/
template <typename I, typename J>
void paste(const Image<I>& data, Image<J>& destination);
......@@ -69,8 +68,8 @@ namespace mln
void paste(const Image<I>& data_, Image<J>& destination_)
{
const I& data = exact(data_);
I& destination = exact(destination_);
assert(ima.has_data() && destination.has_data());
J& destination = exact(destination_);
mln_precondition(data.domain() <= destination.domain());
mln_piter(I) p(data.domain());
for_all(p)
......
......@@ -53,13 +53,13 @@ namespace mln
* \return A 2D window.
*/
template <unsigned M>
mln::window2d window2d(const bool (&values)[M]);
mln::window2d window2d(bool (&values)[M]);
# ifndef MLN_INCLUDE_ONLY
template <unsigned M>
mln::window2d window2d(const bool (&values)[M])
mln::window2d window2d(bool (&values)[M])
{
int h = unsigned(std::sqrt(float(M))) / 2;
assert((2 * h + 1) * (2 * h + 1) == M);
......
......@@ -32,6 +32,7 @@
#include <mln/core/image2d_b.hh>
#include <mln/core/safe_image.hh>
#include <mln/level/paste.hh>
int main()
......@@ -44,4 +45,5 @@ int main()
point2d p = make::point2d(-5, -1);
ima_(p) = 0;
level::paste(ima, ima_);
}
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