Commit 1f0b6046 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

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.
parent 7876a2ce
2011-11-29 Guillaume Lazzara <z@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@lrde.epita.fr>
 
Fix invalid minimum value for builtin floating types. (ticket #247)
......@@ -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,
......
// 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");
......
// 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;
......
// 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)
{
......
// 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)
{
......
// 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)
{
......
// 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
......
// 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)
{
......
// 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
{
......
// 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)
{
......
......@@ -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)
......
// 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);
}
}
// 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);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment