Commit 67d91163 authored by Thierry Geraud's avatar Thierry Geraud
Browse files

Help g++-3.3 to compile.

	* mln/trait/value/internal/comp.hh,
	* mln/world/inter_pixel/separator_to_pixels.hh,
	* mln/core/image/imorph/tr_image.hh,
	* mln/geom/rotate.hh,
	* mln/fun/unary.hh,
	* mln/labeling/wrap.hh,
	* tests/world/inter_pixel/is_separator.cc,
	* tests/world/inter_pixel/is_pixel.cc,
	* tests/world/inter_pixel/immerse.cc: Help g++-3.3 to compile.
	
	* demos/genericity/neighborhood/input: New directory.
	* demos/genericity/neighborhood/output: New directory.
	* demos/genericity/neighborhood/world.pbm,
	* demos/genericity/neighborhood/drawing.pbm: Move...
	* demos/genericity/neighborhood/input/world.pbm,
	* demos/genericity/neighborhood/input/drawing.pbm: ...here.


git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@4237 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 4f63d8d4
2009-07-03 Thierry Geraud <thierry.geraud@lrde.epita.fr>
Help g++-3.3 to compile.
* mln/trait/value/internal/comp.hh,
* mln/world/inter_pixel/separator_to_pixels.hh,
* mln/core/image/imorph/tr_image.hh,
* mln/geom/rotate.hh,
* mln/fun/unary.hh,
* mln/labeling/wrap.hh,
* tests/world/inter_pixel/is_separator.cc,
* tests/world/inter_pixel/is_pixel.cc,
* tests/world/inter_pixel/immerse.cc: Help g++-3.3 to compile.
* demos/genericity/neighborhood/input: New directory.
* demos/genericity/neighborhood/output: New directory.
* demos/genericity/neighborhood/world.pbm,
* demos/genericity/neighborhood/drawing.pbm: Move...
* demos/genericity/neighborhood/input/world.pbm,
* demos/genericity/neighborhood/input/drawing.pbm: ...here.
2009-07-03 Guillaume Lazzara <guillaume.lazzara@lrde.epita.fr>
 
* mln/geom/rotate.hh: use accu::bbox to compute the rotated bbox.
......@@ -126,8 +126,11 @@ namespace mln
/// Test if a pixel value is accessible at \p p.
using super_::has;
enum { dim_ = site::dim };
typedef mln::algebra::vec<dim_, float> vec_t;
/// Test if a pixel value is accessible at \p v.
bool has(const mln::algebra::vec<site::dim, float>& v) const;
bool has(const vec_t& v) const;
/// Read-only access of pixel value at point site \p p.
/// Mutable access is only OK for reading (not writing).
......@@ -194,11 +197,11 @@ namespace mln
template <typename S, typename I, typename T>
inline
bool
tr_image<S,I,T>::has(const algebra::vec<site::dim, float>& v) const
tr_image<S,I,T>::has(const vec_t& v) const
{
mln_psite(I) p;
algebra::vec<I::site::dim, float> v2 = this->data_->tr_.inv()(v);
for (unsigned i = 0; i < I::site::dim; ++i)
algebra::vec<site::dim, float> v2 = this->data_->tr_.inv()(v);
for (unsigned i = 0; i < site::dim; ++i)
p[i] = static_cast<int>(v2[i]);
return this->delegatee_().has(p);
}
......
......@@ -30,6 +30,7 @@
# include <mln/fun/spe/unary.hh>
# include <mln/trait/next/solve.hh>
namespace mln
{
......@@ -69,13 +70,20 @@ namespace mln
template <typename T>
typename with<T>::ret::template lresult_with<T>::ret operator()(T& v) const
{
return typename with<T>::ret(state()).apply_rw(v);
// See the commentary in next method.
typedef typename with<T>::ret fun_t;
fun_t f(state());
return f.apply_rw(v);
}
template <typename T, typename R>
void set(T& v, const R& r) const
{
typename with<T>::ret(state()).set(v, r);
// Decomposing "with<T>::ret(state()).set(v, r)" into 3 lines
// helps g++-3.3!
typedef typename with<T>::ret fun_t;
fun_t f(state());
f.set(v, r);
}
template <typename U>
......
......@@ -146,7 +146,7 @@ namespace mln
typedef
tr_image<mln_box(I), extension_val<const I>, comp_transf_t> tr_t;
tr_t tr = transposed_image(b, extend(input, extension_), comp_transf);
tr_t tr = transposed_image(b, extend(input, extension), comp_transf);
typedef mln_site(I) P;
P rpmin = P(rot(input.domain().pmin().to_vec()));
......
......@@ -38,6 +38,7 @@
# include <mln/metal/is_a.hh>
# include <mln/value/label_8.hh>
namespace mln
{
......@@ -62,7 +63,7 @@ namespace mln
///
/// \return A new image with values wrapped with type label_8.
template <typename I>
mln_ch_value(I,value::label_8)
mln_ch_value(I, mln::value::label_8)
wrap(const Image<I>& input);
......@@ -88,10 +89,10 @@ namespace mln
template <typename I>
inline
mln_ch_value(I,value::label_8)
mln_ch_value(I, mln::value::label_8)
wrap(const Image<I>& input)
{
return wrap(value::label_8(), input);
return wrap(mln::value::label_8(), input);
}
# endif // ! MLN_INCLUDE_ONLY
......@@ -100,4 +101,5 @@ namespace mln
} // end of namespace mln
#endif // ! MLN_LABELING_WRAP_HH
......@@ -185,8 +185,18 @@ namespace mln
}
};
// Technical note:
//
// We distinguish between a type T being a C-array type (T =
// U[dim]) and T a "regular" type (meaning "not a C-array
// type"). We have two stages to help g++-3.3 which has
// difficulty in solving such partial specializations.
// Regular case.
template <typename T, unsigned i, unsigned dim>
struct get_comp
struct get_comp_with_regular_
{
typedef mln::trait::value_<T> Tr;
typedef typename Tr::comp C;
......@@ -199,38 +209,42 @@ namespace mln
}
};
template <typename T, unsigned i, unsigned dim>
struct get_comp< T[dim], i, dim >
template <typename T>
struct get_comp_with_regular_< T, 0, 1 >
{
typedef T ret;
static ret on(const T (&v)[dim])
static ret on(const T& v)
{
return v[i];
return v;
}
};
template <typename T>
struct get_comp< T, 0, 1 >
template <typename T, unsigned i, unsigned dim>
struct get_comp : get_comp_with_regular_<T, i, dim>
{
};
// C-array case.
template <typename T, unsigned i, unsigned dim>
struct get_comp_with_C_array
{
typedef T ret;
static ret on(const T& v)
static ret on(const T (&v)[dim])
{
return v;
return v[i];
}
};
template <typename T>
struct get_comp< T[1], 0, 1 > // Disambiguate between both
// previous specialization.
template <typename T, unsigned i, unsigned dim>
struct get_comp< T[dim], i, dim > : get_comp_with_C_array<T, i, dim>
{
typedef T ret;
static ret on(const T (&v)[1]) { return v[0]; }
};
// comp< T, i >
template <typename T, unsigned i>
......
......@@ -69,10 +69,15 @@ namespace mln
Gpoint<P>& p1_, Gpoint<P>& p2_)
{
const P& s = exact(s_);
mln_precondition(is_separator()(s));
P& p1 = exact(p1_);
P& p2 = exact(p2_);
P &p1 = exact(p1_),
&p2 = exact(p2_);
{
// Pre-condition.
is_separator is_separator_;
mln_precondition(is_separator_(s));
(void) is_separator_;
}
// FIXME: 2D only.
if (s.row() % 2)
......@@ -88,8 +93,13 @@ namespace mln
p2 = point2d(s.row(), s.col() + 1);
}
mln_postcondition(is_pixel()(p1));
mln_postcondition(is_pixel()(p2));
{
// Post-conditions.
is_pixel is_pixel_;
mln_postcondition(is_pixel_(p1));
mln_postcondition(is_pixel_(p2));
(void) is_pixel_;
}
}
template <typename Ps, typename P>
......@@ -99,15 +109,25 @@ namespace mln
Gpoint<P>& p1_, Gpoint<P>& p2_)
{
const Ps& s = exact(s_);
mln_precondition(is_separator()(s));
P& p1 = exact(p1_);
P& p2 = exact(p2_);
P &p1 = exact(p1_),
&p2 = exact(p2_);
{
// Pre-condition.
is_separator is_separator_;
mln_precondition(is_separator_(s));
(void) is_separator_;
}
separator_to_pixels(s.to_site(), p1, p2);
mln_postcondition(is_pixel()(p1));
mln_postcondition(is_pixel()(p2));
{
// Post-conditions.
is_pixel is_pixel_;
mln_postcondition(is_pixel_(p1));
mln_postcondition(is_pixel_(p2));
(void) is_pixel_;
}
}
# endif // ! MLN_INCLUDE_ONLY
......
......@@ -54,7 +54,9 @@ int main()
mln_assertion(imax == (make::image2d(refs) | is_pixel()));
is_pixel is_pixel_; // Help g++-3.3.
mln_piter_(Ix) p(imax.domain());
for_all(p)
mln_assertion(is_pixel()(p));
mln_assertion(is_pixel_(p));
}
......@@ -34,7 +34,9 @@ int main()
point2d p00(0, 0), p01(0, 1), p11(1, 1);
mln_assertion( is_pixel()(p00));
mln_assertion(! is_pixel()(p01));
mln_assertion(! is_pixel()(p11));
is_pixel is_pixel_; // Help g++-3.3.
mln_assertion( is_pixel_(p00));
mln_assertion(! is_pixel_(p01));
mln_assertion(! is_pixel_(p11));
}
......@@ -34,8 +34,10 @@ int main()
point2d p00(0, 0), p01(0, 1), p10(1, 0), p11(1, 1);
mln_assertion(! is_separator()(p00));
mln_assertion( is_separator()(p01));
mln_assertion(! is_separator()(p11));
mln_assertion( is_separator()(p10));
is_separator is_separator_; // Help g++-3.3.
mln_assertion(! is_separator_(p00));
mln_assertion( is_separator_(p01));
mln_assertion(! is_separator_(p11));
mln_assertion( is_separator_(p10));
}
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