https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Nicolas Ballas <ballas(a)lrde.epita.fr>
Run image encoded by values: fix some mistakes.
* tests/core/value_enc_image.cc: Update.
* mln/core/value_enc_image.hh: Fix mistakes.
mln/core/value_enc_image.hh | 7 +++----
tests/core/value_enc_image.cc | 34 ++++++++++++++++++++++++++++++++--
2 files changed, 35 insertions(+), 6 deletions(-)
Index: tests/core/value_enc_image.cc
--- tests/core/value_enc_image.cc (revision 1906)
+++ tests/core/value_enc_image.cc (working copy)
@@ -32,16 +32,46 @@
#include <mln/core/image2d.hh>
#include <mln/core/value_enc_image.hh>
+#include <iostream>
int main()
{
using namespace mln;
- /// Basic tests
+ /// Basic test
{
typedef value_enc_image<point2d, int> ima_type;
+ typedef p_runs_<point2d> runs;
- ima_type ima();
+ p_runs_<point2d> pruns0;
+ p_runs_<point2d> pruns1;
+ p_runs_<point2d> pruns2;
+
+ pruns0.insert(p_run<point2d>(make::point2d(0, 0), 2));
+ pruns1.insert(p_run<point2d>(make::point2d(2, 4), 7));
+ pruns1.insert(p_run<point2d>(make::point2d(18, 42), 5));
+ pruns1.insert(p_run<point2d>(make::point2d(50, 76), 2));
+ pruns1.insert(p_run<point2d>(make::point2d(17,40), 6));
+ pruns2.insert(p_run<point2d>(make::point2d(10,10), 5));
+
+ ima_type ima;
+ ima.insert(pruns0, 0);
+ ima.insert(pruns2, 2);
+ ima.insert(pruns1, 1);
+
+ mln_piter_(ima_type) piter (ima.domain());
+ int i = 0;
+ int nb = 0;
+ for_all(piter)
+ {
+ assert(ima(piter) == i);
+
+ ++nb;
+ if (nb == 2)
+ i = 2;
+ if (nb == 7)
+ i = 1;
+ }
}
}
Index: mln/core/value_enc_image.hh
--- mln/core/value_enc_image.hh (revision 1906)
+++ mln/core/value_enc_image.hh (working copy)
@@ -72,7 +72,7 @@
template <typename P, typename T>
struct image_< value_enc_image<P,T> > :
- default_image_< T, rle_image<P,T> >
+ default_image_< T, value_enc_image<P,T> >
{
typedef trait::image::category::primary category;
@@ -98,7 +98,7 @@
*/
template <typename P, typename T>
class value_enc_image :
- public internal::image_primary_< pset_array_psite< runs_psite<P> >,
+ public internal::image_primary_< pset_array< p_runs_<P> >,
value_enc_image<P, T> >
{
public:
@@ -116,7 +116,6 @@
/// Skeleton.
typedef value_enc_image< tag::psite_<P>, tag::value_<T> >
skeleton;
-
value_enc_image();
/// Add a new range to the image.
@@ -202,7 +201,7 @@
bool
value_enc_image<P, T>::has(const typename value_enc_image<P, T>::psite&
site) const
{
- return this->data_.domain_.has(site);
+ return this->data_->domain_.has(site);
}
template <typename P, typename T>