* mln/debug/slices_2d.hh,
* mln/io/dump/get_header.hh,
* mln/io/fld/header.hh,
* mln/io/fld/load.hh,
* mln/io/fld/load_header.hh,
* mln/io/off/load.hh,
* mln/io/off/save.hh,
* mln/math/jacobi.hh,
* mln/morpho/hit_or_miss.hh,
* mln/world/binary_2d/subsample.hh: Add missing 'inline'.
* tests/Makefile.am (CXXFLAGS): Add -DMLN_WO_GLOBAL_VARS.
* tests/global_vars1.cc,
* tests/global_vars2.cc: Make take MLN_WO_GLOBAL_VARS into
consideration.
---
milena/ChangeLog | 21 +++++++++++++++++++++
milena/mln/debug/slices_2d.hh | 2 ++
milena/mln/io/dump/get_header.hh | 4 +++-
milena/mln/io/fld/header.hh | 7 +++++--
milena/mln/io/fld/load.hh | 3 ++-
milena/mln/io/fld/load_header.hh | 5 ++++-
milena/mln/io/off/load.hh | 15 ++++++++++++++-
milena/mln/io/off/save.hh | 11 ++++++++++-
milena/mln/math/jacobi.hh | 4 +++-
milena/mln/morpho/hit_or_miss.hh | 7 ++++++-
milena/mln/world/binary_2d/subsample.hh | 4 +++-
milena/tests/Makefile.am | 2 ++
milena/tests/global_vars1.cc | 6 +++++-
milena/tests/global_vars2.cc | 10 +++++++---
14 files changed, 87 insertions(+), 14 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index d24b327..b977679 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,3 +1,24 @@
+2011-11-29 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Fix the initialization of all global constants (ticket #43)
+
+ * mln/debug/slices_2d.hh,
+ * mln/io/dump/get_header.hh,
+ * mln/io/fld/header.hh,
+ * mln/io/fld/load.hh,
+ * mln/io/fld/load_header.hh,
+ * mln/io/off/load.hh,
+ * mln/io/off/save.hh,
+ * mln/math/jacobi.hh,
+ * mln/morpho/hit_or_miss.hh,
+ * mln/world/binary_2d/subsample.hh: Add missing 'inline'.
+
+ * tests/Makefile.am (CXXFLAGS): Add -DMLN_WO_GLOBAL_VARS.
+
+ * tests/global_vars1.cc,
+ * tests/global_vars2.cc: Make take MLN_WO_GLOBAL_VARS into
+ consideration.
+
2011-11-28 Guillaume Lazzara <z(a)lrde.epita.fr>
Fix invalid minimum value for builtin floating types. (ticket #247)
diff --git a/milena/mln/debug/slices_2d.hh b/milena/mln/debug/slices_2d.hh
index 11e0aaa..b7d194f 100644
--- a/milena/mln/debug/slices_2d.hh
+++ b/milena/mln/debug/slices_2d.hh
@@ -123,6 +123,7 @@ namespace mln
namespace internal
{
+ inline
unsigned round_up(float f)
{
unsigned n = static_cast<unsigned>(f + 0.499999f);
@@ -133,6 +134,7 @@ namespace mln
return n;
}
+ inline
void slices2d_helper(float nslis, float nrows, float ncols,
float ratio_hv,
unsigned& n_horizontal,
diff --git a/milena/mln/io/dump/get_header.hh b/milena/mln/io/dump/get_header.hh
index 2eaffdd..10b74ab 100644
--- a/milena/mln/io/dump/get_header.hh
+++ b/milena/mln/io/dump/get_header.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2010, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -65,6 +66,7 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
+ inline
dump_header get_header(const std::string& filename)
{
trace::entering("mln::io::dump::get_header");
diff --git a/milena/mln/io/fld/header.hh b/milena/mln/io/fld/header.hh
index a1326f0..8ce08ab 100644
--- a/milena/mln/io/fld/header.hh
+++ b/milena/mln/io/fld/header.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -66,6 +67,7 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
+ inline
fld_header::fld_header()
: ndim (-1),
dim (0),
@@ -76,7 +78,8 @@ namespace mln
{
}
- fld_header::~fld_header()
+ inline
+ fld_header::~fld_header()
{
delete [] dim;
delete [] max_ext;
diff --git a/milena/mln/io/fld/load.hh b/milena/mln/io/fld/load.hh
index 33768df..0c092f3 100644
--- a/milena/mln/io/fld/load.hh
+++ b/milena/mln/io/fld/load.hh
@@ -1,4 +1,4 @@
-// Copyright (C) 2008, 2009, 2010 EPITA Research and Development
+// Copyright (C) 2008, 2009, 2010, 2011 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
@@ -84,6 +84,7 @@ namespace mln
namespace internal
{
+ inline
void
abort_load(const char* msg, const char* filename)
{
diff --git a/milena/mln/io/fld/load_header.hh b/milena/mln/io/fld/load_header.hh
index d3d9831..bc335fc 100644
--- a/milena/mln/io/fld/load_header.hh
+++ b/milena/mln/io/fld/load_header.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -59,6 +60,8 @@ namespace mln
namespace internal
{
+
+ inline
void
abort_fld_reader(const char* msg, unsigned line = 0)
{
diff --git a/milena/mln/io/off/load.hh b/milena/mln/io/off/load.hh
index c9c4af7..49c121a 100644
--- a/milena/mln/io/off/load.hh
+++ b/milena/mln/io/off/load.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -175,6 +176,7 @@ namespace mln
| Facades. |
`----------*/
+ inline
void
load(bin_2complex_image3df& ima, const std::string& filename)
{
@@ -183,6 +185,7 @@ namespace mln
trace::exiting("mln::io::off::load");
}
+ inline
void
load(float_2complex_image3df& ima, const std::string& filename)
{
@@ -191,6 +194,7 @@ namespace mln
trace::exiting("mln::io::off::load");
}
+ inline
void
load(rgb8_2complex_image3df& ima, const std::string& filename)
{
@@ -495,12 +499,14 @@ namespace mln
default is gray (R,G,B,A=.666).''
\{ */
+ inline
void
bin_off_loader::read_face_data(std::istream& /* istr */)
{
// Do nothing (no data associated to faces).
}
+ inline
void
float_off_loader::read_face_data(std::istream& istr)
{
@@ -526,6 +532,7 @@ namespace mln
face_value.push_back(r);
}
+ inline
void
rgb8_off_loader::read_face_data(std::istream& istr)
{
@@ -549,6 +556,7 @@ namespace mln
/* \} */
+ inline
void
bin_off_loader::reserve(unsigned /* nvertices */,
unsigned /* nedges */,
@@ -557,6 +565,7 @@ namespace mln
// Do nothing (no data associated to faces).
}
+ inline
void
float_off_loader::reserve(unsigned /* nvertices */,
unsigned /* nedges */,
@@ -566,6 +575,7 @@ namespace mln
}
+ inline
void
rgb8_off_loader::reserve(unsigned /* nvertices */,
unsigned /* nedges */,
@@ -575,6 +585,7 @@ namespace mln
}
+ inline
void
bin_off_loader::assign(values& vs, const domain& s)
{
@@ -583,6 +594,7 @@ namespace mln
vs[i].insert(vs[i].begin(), s.cplx().nfaces_of_dim(i), true);
}
+ inline
void
float_off_loader::assign(values& vs, const domain& s)
{
@@ -593,6 +605,7 @@ namespace mln
vs[D] = face_value;
}
+ inline
void
rgb8_off_loader::assign(values& vs, const domain& s)
{
diff --git a/milena/mln/io/off/save.hh b/milena/mln/io/off/save.hh
index 1ec747d..d846946 100644
--- a/milena/mln/io/off/save.hh
+++ b/milena/mln/io/off/save.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -161,6 +162,7 @@ namespace mln
| Facades. |
`----------*/
+ inline
void
save(const bin_2complex_image3df& ima, const std::string& filename)
{
@@ -169,6 +171,7 @@ namespace mln
trace::exiting("mln::io::off::save");
}
+ inline
void
save(const int_u8_2complex_image3df& ima, const std::string& filename)
{
@@ -177,6 +180,7 @@ namespace mln
trace::exiting("mln::io::off::save");
}
+ inline
void
save(const float_2complex_image3df& ima, const std::string& filename)
{
@@ -185,6 +189,7 @@ namespace mln
trace::exiting("mln::io::off::save");
}
+ inline
void
save(const rgb8_2complex_image3df& ima, const std::string& filename)
{
@@ -380,6 +385,7 @@ namespace mln
default is gray (R,G,B,A=.666).''
\{ */
+ inline
void
bin_off_saver::write_face_data(std::ostream& /* ostr */,
const value& /* v */) const
@@ -387,6 +393,7 @@ namespace mln
// Do nothing (no data associated to faces).
}
+ inline
void
int_u8_off_saver::write_face_data(std::ostream& ostr,
const value& v) const
@@ -405,6 +412,7 @@ namespace mln
/* FIXME: We should turn float_off_saver into a
float01_off_saver to avoid the assertions below. */
+ inline
void
float_off_saver::write_face_data(std::ostream& ostr,
const value& v) const
@@ -424,6 +432,7 @@ namespace mln
<< ' ' << 1.0f;
}
+ inline
void
rgb8_off_saver::write_face_data(std::ostream& ostr,
const value& v) const
diff --git a/milena/mln/math/jacobi.hh b/milena/mln/math/jacobi.hh
index 605121b..60cd934 100644
--- a/milena/mln/math/jacobi.hh
+++ b/milena/mln/math/jacobi.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -54,6 +55,7 @@ namespace mln
a(k,l)=h+s*(g-h*tau);
+ inline
algebra::quat
jacobi(algebra::mat<4u,4u,float> a)
{
diff --git a/milena/mln/morpho/hit_or_miss.hh b/milena/mln/morpho/hit_or_miss.hh
index 8e30f09..950a45a 100644
--- a/milena/mln/morpho/hit_or_miss.hh
+++ b/milena/mln/morpho/hit_or_miss.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -102,8 +103,12 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
+# ifndef MLN_WO_GLOBAL_VARS
+
bool constrained_hit_or_miss = true;
+# endif // ! MLN_WO_GLOBAL_VARS
+
namespace internal
{
diff --git a/milena/mln/world/binary_2d/subsample.hh
b/milena/mln/world/binary_2d/subsample.hh
index 9958c43..0d8c557 100644
--- a/milena/mln/world/binary_2d/subsample.hh
+++ b/milena/mln/world/binary_2d/subsample.hh
@@ -1,4 +1,5 @@
-// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009, 2011 EPITA Research and Development Laboratory
+// (LRDE)
//
// This file is part of Olena.
//
@@ -60,6 +61,7 @@ namespace mln
# ifndef MLN_INCLUDE_ONLY
+ inline
image2d<value::int_u8>
subsample(image2d<bool>& input, unsigned n)
{
diff --git a/milena/tests/Makefile.am b/milena/tests/Makefile.am
index 83f946e..3493250 100644
--- a/milena/tests/Makefile.am
+++ b/milena/tests/Makefile.am
@@ -81,7 +81,9 @@ all_headers_LDFLAGS = \
$(CFITSIO_LDFLAGS) $(GDCM_LDFLAGS) $(MAGICKXX_LDFLAGS) $(TIFF_LDFLAGS)
essential_headers_SOURCES = essential_headers.cc
+
global_vars_SOURCES = global_vars1.cc global_vars2.cc
+global_vars_CXXFLAGS = -DMLN_WO_GLOBAL_VARS
TESTS = $(check_PROGRAMS)
diff --git a/milena/tests/global_vars1.cc b/milena/tests/global_vars1.cc
index f1ccde4..adac06a 100644
--- a/milena/tests/global_vars1.cc
+++ b/milena/tests/global_vars1.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -23,6 +24,7 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
+# undef MLN_WO_GLOBAL_VARS
#include <mln/all.hh>
int f1();
@@ -36,6 +38,7 @@ int main ()
mln::border::thickness = b1;
int b2 = f1();
+ // Checking that both files share the same symbol.
mln_assertion(b1 == b2);
}
@@ -43,6 +46,7 @@ int main ()
mln::border::thickness = 4;
f2();
+ // Checking that both files share the same symbol.
mln_assertion(mln::border::thickness == 2);
}
}
diff --git a/milena/tests/global_vars2.cc b/milena/tests/global_vars2.cc
index 14a1f5c..eabde77 100644
--- a/milena/tests/global_vars2.cc
+++ b/milena/tests/global_vars2.cc
@@ -1,4 +1,5 @@
-// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008, 2009, 2011 EPITA Research and Development
+// Laboratory (LRDE)
//
// This file is part of Olena.
//
@@ -23,8 +24,6 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-# define MLN_INCLUDE_ONLY
-
#include <mln/all.hh>
int f1 ()
@@ -37,3 +36,8 @@ void f2 ()
{
mln::border::thickness = 2;
}
+
+void f3 ()
+{
+ mln::image2d<int> ima(2,2);
+}
--
1.7.2.5