* io/pnm/load.hh: add specials cases to handle vectorial type when
loading from ascii ppms.
Conflicts:
milena/ChangeLog
---
milena/ChangeLog | 13 ++++++++-----
milena/mln/io/pnm/load.hh | 43 +++++++++++++++++++++++++++++++++++++++----
2 files changed, 47 insertions(+), 9 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index af4f536..9572039 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
2013-09-02 Roland Levillain <roland(a)lrde.epita.fr>
Add parentheses around complex operands of operator `|'.
@@ -4769,6 +4770,13 @@
* mln/geom/crop.hh,
* mln/geom/crop_without_localization.hh: New.
+2012-06-05 Edwin Carlinet <carlinet(a)lrde.epita.fr>
+
+ Fix issues with loading ascii ppm.
+
+ * io/pnm/load.hh: add specials cases to handle vectorial type when
+ loading from ascii ppms.
+
2011-10-14 Guillaume Lazzara <z(a)lrde.epita.fr>
* mln/value/builtin/floatings.hh: Fix string name for builtin
@@ -6840,11 +6848,6 @@
(make::edge_image(const vertex_image<P,V,G>&, const
Function_v2b<F>&)):
Actually use the predicate passed as second argument.
Remove debug code.
-=======
- * mln/trait/ch_value.hh,
- * mln/util/ctree/node.hh,
- * mln/value/sign.hh : Add MLN_WO_GLOBAL_VARS define.
->>>>>>> Add MLN_WO_GLOBAL_VARS directive that prevents globals vars
to be
2010-05-04 edwin carlinet <carlinet(a)lrde.epita.fr>
diff --git a/milena/mln/io/pnm/load.hh b/milena/mln/io/pnm/load.hh
index ee77e5e..acd9400 100644
--- a/milena/mln/io/pnm/load.hh
+++ b/milena/mln/io/pnm/load.hh
@@ -44,7 +44,9 @@
# include <mln/io/pnm/max_component.hh>
# include <mln/io/pnm/macros.hh>
+# include <mln/trait/value_.hh>
# include <mln/metal/is_a.hh>
+# include <mln/metal/bool.hh>
namespace mln
{
@@ -59,7 +61,13 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
template <typename I>
- void load_ascii_value(std::ifstream& file, I& ima);
+ void
+ load_ascii_value(std::ifstream& file, I& ima, metal::true_ is_scalar);
+
+ template <typename I>
+ void
+ load_ascii_value(std::ifstream& file, I& ima, metal::false_ is_scalar);
+
template <typename I>
void load_ascii_builtin(std::ifstream& file, I& ima);
@@ -73,7 +81,7 @@ namespace mln
void
load_ascii_dispatch(std::ifstream& file, I& ima, const
metal::bool_<true>&)
{
- load_ascii_value(file, ima);
+ load_ascii_value(file, ima, mlc_bool( mln_dim(mln_value(I)) == 1 ) () );
}
template <typename I>
@@ -158,20 +166,47 @@ namespace mln
file.read((char*)(&ima(p)), len);
}
- /// load_ascii for Milena value types.
+ /// load_ascii for Vectorial Milena value types.
template <typename I>
inline
- void load_ascii_value(std::ifstream& file, I& ima)
+ void
+ load_ascii_value(std::ifstream& file, I& ima, metal::false_)
+ {
+ enum { dim = mln_dim(mln_value(I)) };
+ typedef mln_equiv(mln_value_(I)) E;
+ typedef mln_equiv(trait::value_<E>::comp) T;
+ E v;
+ T x;
+
+ mln_fwd_piter(I) p(ima.domain());
+ for_all(p)
+ {
+ for (int i = 0; i<dim; ++i) {
+ file >> x;
+ v[i] = x;
+ }
+ ima(p) = v;
+ }
+ }
+
+ /// load_ascii for Scalar Milena value types
+ template <typename I>
+ inline
+ void
+ load_ascii_value(std::ifstream& file, I& ima, metal::true_)
{
mln_equiv(mln_value_(I)) c;
+
mln_fwd_piter(I) p(ima.domain());
for_all(p)
{
file >> c;
+ std::cout << c << std::endl;
ima(p) = c;
}
}
+
/// load_ascii for builtin value types.
template <typename I>
inline
--
1.7.10.4
Show replies by date