Commit 01ca7d23 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Introduce debug::quiet.

	* headers.mk: add new header to distribution.

	* mln/debug/all.hh,
	* mln/debug/essential.hh: include quiet.hh

	* mln/debug/println.hh: use debug::quiet. Println prints nothing if
	debug::quiet is set to true.

	* mln/debug/quiet.hh: the new global variable.

	* tests/unit_test/Makefile.am,
	* tests/unit_test/mln_debug_quiet.cc: new unit test.

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@3172 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 60ffc4dc
2009-01-20 Guillaume Lazzara <z@lrde.epita.fr>
Introduce debug::quiet.
* headers.mk: add new header to distribution.
* mln/debug/all.hh,
* mln/debug/essential.hh: include quiet.hh
* mln/debug/println.hh: use debug::quiet. Println prints nothing if
debug::quiet is set to true.
* mln/debug/quiet.hh: the new global variable.
* tests/unit_test/Makefile.am,
* tests/unit_test/mln_debug_quiet.cc: new unit test.
2009-01-20 Guillaume Lazzara <z@lrde.epita.fr>
 
Make the use of pw::cst() optional in predicates.
......@@ -1019,6 +1019,7 @@ mln/debug/println.spe.hh \
mln/debug/colorize.hh \
mln/debug/draw_graph.hh \
mln/debug/put_word.hh \
mln/debug/quiet.hh \
mln/debug/println_with_border.spe.hh \
mln/debug/format.hh \
mln/debug/println.hh \
......
......@@ -53,6 +53,6 @@ namespace mln
# include <mln/debug/println.hh>
# include <mln/debug/println_with_border.hh>
# include <mln/debug/put_word.hh>
# include <mln/debug/quiet.hh>
#endif // ! MLN_DEBUG_ALL_HH
// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
......
......@@ -38,6 +38,7 @@
# include <mln/core/concept/image.hh>
# include <mln/core/concept/window.hh>
# include <mln/geom/bbox.hh>
# include <mln/debug/quiet.hh>
# include <mln/debug/format.hh>
// Specializations are in:
......@@ -89,16 +90,21 @@ namespace mln
println(const Image<I>& input)
{
trace::entering("debug::println");
impl::println(geom::bbox(exact(input).domain()),
exact(input));
if (!quiet)
impl::println(geom::bbox(exact(input).domain()),
exact(input));
trace::exiting("debug::println");
}
template <typename I>
void println(const std::string& msg, const Image<I>& input)
{
std::cout << msg << std::endl;
println(input);
if (!quiet)
{
std::cout << msg << std::endl;
println(input);
}
}
# endif // ! MLN_INCLUDE_ONLY
......
// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of the Olena Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License version 2 as published by the
// Free Software Foundation.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this library; see the file COPYING. If not, write to
// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
// Boston, MA 02111-1307, USA.
//
// As a special exception, you may use this file as part of a free
// software library without restriction. Specifically, if other files
// instantiate templates or use macros or inline functions from this
// file, or you compile this file and link it with other files to
// produce an executable, this file does not by itself cause the
// resulting executable to be covered by the GNU General Public
// License. This exception does not however invalidate any other
// reasons why the executable file might be covered by the GNU General
// Public License.
#ifndef MLN_DEBUG_QUIET_HH
# define MLN_DEBUG_QUIET_HH
/// \file mln/debug/quiet.hh
///
/// global variable telling whether the debug should be printed or not.
namespace mln
{
namespace debug
{
extern bool quiet;
# ifndef MLN_INCLUDE_ONLY
bool quiet = false;
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::debug
} // end of namespace mln
#endif // ! MLN_DEBUG_QUIET_HH
......@@ -983,6 +983,7 @@ mln_debug_println_with_border \
mln_debug_colorize \
mln_debug_draw_graph \
mln_debug_put_word \
mln_debug_quiet \
mln_debug_format \
mln_debug_println \
mln_debug_essential \
......@@ -1998,6 +1999,7 @@ mln_debug_println_with_border_SOURCES = mln_debug_println_with_border.cc
mln_debug_colorize_SOURCES = mln_debug_colorize.cc
mln_debug_draw_graph_SOURCES = mln_debug_draw_graph.cc
mln_debug_put_word_SOURCES = mln_debug_put_word.cc
mln_debug_quiet_SOURCES = mln_debug_quiet.cc
mln_debug_format_SOURCES = mln_debug_format.cc
mln_debug_println_SOURCES = mln_debug_println.cc
mln_debug_essential_SOURCES = mln_debug_essential.cc
......
// Unit test for mln/debug/quiet.hh.
// Generated by ./build_unit_test.sh, do not modify.
// Include the file twice, so we detect missing inclusion guards.
#include <mln/debug/quiet.hh>
#include <mln/debug/quiet.hh>
int main()
{
// Nothing.
}
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