URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-11-27 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
convert for graylevel.
* mln/value/graylevel.hh: the graylevel type wasn't compatible with
the generic convert in convert.hh because of a convertion to int.
---
graylevel.hh | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
Index: trunk/milena/mln/value/graylevel.hh
===================================================================
--- trunk/milena/mln/value/graylevel.hh (revision 1554)
+++ trunk/milena/mln/value/graylevel.hh (revision 1555)
@@ -170,7 +170,6 @@
typedef float sum;
};
-
} // end of namespace mln::trait
@@ -247,6 +246,20 @@
+ namespace internal
+ {
+
+ // convert for graylevel
+ template <unsigned n>
+ struct convert_< graylevel<n> >
+ {
+ static graylevel<n> value_at_index(unsigned i);
+ static unsigned index_of_value(graylevel<n> v);
+ };
+
+ } // end of namespace mln::value::internal
+
+
/// Op<<.
template <unsigned n>
std::ostream& operator<<(std::ostream& ostr, const
graylevel<n>& g);
@@ -430,6 +443,27 @@
}
+
+ namespace internal
+ {
+
+ template <unsigned n>
+ graylevel<n>
+ convert_< graylevel<n> >::value_at_index(unsigned i)
+ {
+ mln_assertion(i <= mln_max(mln_equiv(graylevel<n>)));
+ return graylevel<n>(i);
+ }
+
+ template <unsigned n>
+ unsigned
+ convert_< graylevel<n> >::index_of_value(graylevel<n> v)
+ {
+ return v.value();
+ }
+
+ } // end of namespace mln::value::internal
+
// Operators.
template <unsigned n>