https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Nicolas Ballas <ballas(a)lrde.epita.fr>
Update documentation, add an operator to the sign value class.
* tests/value/sign.cc: Update.
* doc/technical/designs/properties/values.txt: Update.
* mln/value/sign.hh: Add an operator.
doc/technical/designs/properties/values.txt | 22 +++++++++++++---------
mln/value/sign.hh | 14 ++++++++++----
tests/value/sign.cc | 14 +++++++++++---
3 files changed, 34 insertions(+), 16 deletions(-)
Index: tests/value/sign.cc
--- tests/value/sign.cc (revision 2467)
+++ tests/value/sign.cc (working copy)
@@ -32,6 +32,7 @@
#include <cassert>
#include <mln/value/sign.hh>
+#include <mln/value/set.hh>
int main()
@@ -44,8 +45,15 @@
s = -1;
s = 0;
s = 1;
- assert(sign::zero == 0);
- assert(sign::one == 1);
- assert(s != 3);
+ assert(sign::zero == (sign) 0);
+ assert(sign::one == (sign) 1);
+ assert(s != (sign) -1);
+ }
+
+ {
+ value::set<sign> set;
+ mln_viter_(value::set<sign>) v(set);
+ for_all(v)
+ std::cout << v << std::endl;
}
}
Index: doc/technical/designs/properties/values.txt
--- doc/technical/designs/properties/values.txt (revision 2467)
+++ doc/technical/designs/properties/values.txt (working copy)
@@ -23,7 +23,7 @@
- direct: Images store all their values in memory, we can take a reference
of the values.
-- semi-direct: Images store partially their value in memory, we can't take
+- semi_direct: Images store partially their value in memory, we can't take
a reference on them. For instance, images that compute a value at the first
access and store it in a buffer to speed up the next access, are semi-direct.
@@ -96,7 +96,7 @@
=> image.buffer() -> return the start adress of the ima buffer
value_storage == piece_wise
- // runs iterator?
+ => image.pieces() -> return all the pieces composing the image.
** value_browsing:/any/
|
@@ -112,11 +112,12 @@
value_browsing == value_wise
=> ima.values_taken() -> return the current values taken by
ima
+ => ima.sites(v) -> return the sites associated to the
+ value v
+// FIXME these method depend on value_taken more than ima
=> ima.change_value(oldVal, newVal) -> change the value oldVal to newVal
=> ima.apply(f) -> apply f (a function v2v) to all the
values
- => ima.sites(v) -> return the sites associated to the
- value v
value_browsing == cell_wise
=> ima.values_cell() -> return the cells composing the image
@@ -132,7 +133,7 @@
+ -- read_write
=> Definition:
- Indicates the io permission for the site access.
+ Indicates the io permissions for the site access.
It replaces the property value_access.
- read_only: We can only read the image values.
@@ -161,10 +162,13 @@
*** value_storage == piece_wise
// MemCopy on the runs?
-for (ungsigned i = 0; i < ima.nruns(); ++i)
- //FIXME
-**** Method related:
- nruns ???
+mln_miter(I::miter) mit(image.pieces())
+for_all(miter)
+ for (unsigned i = 0; i < miter.size(); ++i)
+ *miter.buffer[i] = v;
+**** Method/Type related
+ -> I::miter
+ -> ima.pieces
*** value_browsing == value_wise
// direct access to the value
Index: mln/value/sign.hh
--- mln/value/sign.hh (revision 2467)
+++ mln/value/sign.hh (working copy)
@@ -32,7 +32,6 @@
*
* \brief Definition of the mln::value::sign class.
*/
-
# include <mln/value/internal/integer.hh>
# include <mln/trait/value_.hh>
# include <mln/literal/zero.hh>
@@ -85,7 +84,6 @@
sign& operator=(int i);
-
/// Zero value.
static const sign zero;
@@ -108,7 +106,8 @@
std::ostream& operator<<(std::ostream& ostr, const sign& i);
/// Comparaison operator
- bool operator==(sign lhs, sign rhs);
+ bool operator==(const sign& lhs, const sign& rhs);
+ bool operator<(const sign& lhs, const sign& rhs);
# ifndef MLN_INCLUDE_ONLY
@@ -187,7 +186,13 @@
}
inline
- bool operator==(sign lhs, sign rhs)
+ bool operator==(const sign& lhs, const sign& rhs)
+ {
+ return lhs.val_() == rhs.val_();
+ }
+
+ inline
+ bool operator<(const sign& lhs, const sign& rhs)
{
return lhs.val_() == rhs.val_();
}
@@ -220,6 +225,7 @@
typedef int sum;
};
+
} // end of namespace trait