#175: Use std::vector to store data of mln::image[123]d<T>
----------------------+-----------------------------------------------------
Reporter: levill_r | Owner: Olena Team
Type: proposal | Status: new
Priority: minor | Milestone: Olena 1.0
Component: Milena | Version: 1.0
Keywords: |
----------------------+-----------------------------------------------------
Currently, the following classes use plain dynamically-allocated memory to
store their data (values):
* source:trunk/milena/mln/core/image/image1d.hh
* source:trunk/milena/mln/core/image/image2d.hh
* source:trunk/milena/mln/core/image/image2d_h.hh
* source:trunk/milena/mln/core/image/image3d.hh
We could try to replace these arrays with `std::vectors`.
Pros:
* Automatic memory management.
* Direct access (using pointers) is still possible, thanks to the ISO/IEC
C++ Standard; see paragraph 23.2.4.1:
"(...) The elements of a vector are stored contiguously, meaning that
if `v` is a `vector<T, Allocator>` where `T` is some type other than
`bool`, then it obeys the identity `&v[n] == &v[0] + n` for all `0 <= n <
v.size()`".
* Optimized storage for boolean values, thanks to the `std::vector<bool>`
specialization.
Cons:
* We can't iterate on an `std::vector<bool>` using a pointer; but we can
provide optimized specialization for that very case, that could as fast as
pointer iterations (IMHO).
--
Ticket URL: <https://trac.lrde.org/olena/ticket/175>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image processing library.
#170: Get rid of typedef mln::internal::image_base::coord
-------------------------+--------------------------------------------------
Reporter: levill_r | Owner: Olena Team
Type: enhancement | Status: new
Priority: minor | Milestone: Olena 1.0
Component: Milena | Version: 1.0
Keywords: point |
-------------------------+--------------------------------------------------
In source:branches/cleanup-2008/milena/mln/core/internal/image_base.hh,
`mln::internal::image_base` defines a typedef `coord`, which reduces the
genericity of this class:
{{{
#!cpp
/// Coordinate associated type.
typedef mln_deduce(S, site, coord) coord;
}}}
A consequence is that the site type `S::site` must define an associated
type `coord` (hence `std::vector<point2d>` is not a valid site type), yet
we had decided that there should be no prerequisites on the interfaces of
sites in Milena.
--
Ticket URL: <https://trac.lrde.org/olena/ticket/170>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image processing library.
* milena/tests/unit_test/build_unit_test.sh,
* scribo/tests/unit_test/build_unit_test.sh
(LC_ALL): Set envvar to C.
* milena/generate_dist_headers.sh,
* milena/doc/generate_dist_files.sh:
Likewise.
Use plain `sort' instead of `sort -d'.
---
ChangeLog | 12 ++++++++++++
milena/doc/generate_dist_files.sh | 5 ++++-
milena/generate_dist_headers.sh | 7 +++++--
milena/tests/unit_test/build_unit_test.sh | 2 ++
scribo/tests/unit_test/build_unit_test.sh | 2 ++
5 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 28f856d..d11b7d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-05-27 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Improve determinism of Makefile helpers generators.
+
+ * milena/tests/unit_test/build_unit_test.sh,
+ * scribo/tests/unit_test/build_unit_test.sh
+ (LC_ALL): Set envvar to C.
+ * milena/generate_dist_headers.sh,
+ * milena/doc/generate_dist_files.sh:
+ Likewise.
+ Use plain `sort' instead of `sort -d'.
+
2009-05-22 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
* configure.ac: Configure milena/tests/core/image/dmorph.
diff --git a/milena/doc/generate_dist_files.sh b/milena/doc/generate_dist_files.sh
index fdef488..9c77f20 100755
--- a/milena/doc/generate_dist_files.sh
+++ b/milena/doc/generate_dist_files.sh
@@ -8,13 +8,16 @@
## would be to only emit lines ended with newlines.
ECHO_N=printf
+# Use the C locale to have a deterministic sort.
+export LC_ALL=C
+
for dir in figures outputs examples; do
OUT="$dir/$dir.mk"
echo "## Generated by ../generate_dist_files, do not modify." > $OUT
echo >>$OUT
$ECHO_N "EXTRA_DIST += " >> $OUT
for ftype in cc.raw p*m txt; do
- for file in `find $dir -mindepth 1 -name *.$ftype | sort -d `; do
+ for file in `find $dir -mindepth 1 -name *.$ftype | sort`; do
echo " \\" >> $OUT
$ECHO_N $file >> $OUT
done
diff --git a/milena/generate_dist_headers.sh b/milena/generate_dist_headers.sh
index d6cfa4d..6f72a5f 100755
--- a/milena/generate_dist_headers.sh
+++ b/milena/generate_dist_headers.sh
@@ -4,14 +4,17 @@
# ------------------------------
# List all the headers in order to make them part of distribution.
+# Use the C locale to have a deterministic sort.
+export LC_ALL=C
+
echo "## Generated by ./generate_dist_headers, do not modify ##" > headers.mk
echo "" >> headers.mk
echo "nobase_include_HEADERS = \\" >> headers.mk
echo "mln/version.hh \\" >> headers.mk
echo "generating headers.mk"
-find mln -type f -name '*.hh'| grep -v "\.svn" | sed -e 's/$/ \\/g' | sort -d >> headers.mk
-find mln -type f -name '*.hxx'| grep -v "\.svn" | sed -e 's/$/ \\/g'| sort -d >> headers.mk
+find mln -type f -name '*.hh'| grep -v "\.svn" | sed -e 's/$/ \\/g' | sort >> headers.mk
+find mln -type f -name '*.hxx'| grep -v "\.svn" | sed -e 's/$/ \\/g'| sort >> headers.mk
last_line=`tail -n 1 headers.mk | sed -e 's/\\\//g'` # remove '\' in last line
sed '$d' < headers.mk > headers.mk.tmp # remove last line
diff --git a/milena/tests/unit_test/build_unit_test.sh b/milena/tests/unit_test/build_unit_test.sh
index 310823d..dee4436 100755
--- a/milena/tests/unit_test/build_unit_test.sh
+++ b/milena/tests/unit_test/build_unit_test.sh
@@ -8,6 +8,8 @@
## would be to only emit lines ended with newlines.
ECHO_N=printf
+# Use the C locale to have a deterministic sort.
+export LC_ALL=C
test $# -eq 1 || { echo "Usage: $0 <mln path>" && exit 1; }
diff --git a/scribo/tests/unit_test/build_unit_test.sh b/scribo/tests/unit_test/build_unit_test.sh
index 7c80671..87863e3 100755
--- a/scribo/tests/unit_test/build_unit_test.sh
+++ b/scribo/tests/unit_test/build_unit_test.sh
@@ -8,6 +8,8 @@
## would be to only emit lines ended with newlines.
ECHO_N=printf
+# Use the C locale to have a deterministic sort.
+export LC_ALL=C
test $# -eq 1 || { echo "Usage: $0 <scribo path>" && exit 1; }
--
1.6.1.2