
* mln/border/mirror.hh, * mln/canvas/labeling/blobs.hh, * mln/canvas/labeling/generic.hh, * mln/canvas/labeling/sorted.hh, * mln/canvas/labeling/video.hh, * mln/data/stretch.hh, * mln/debug/put_word.hh, * mln/debug/trace.hh, * mln/draw/dashed_line.hh, * mln/draw/line.hh, * mln/labeling/colorize.hh, * mln/subsampling/antialiased.hh: Make use of this macro here. --- milena/ChangeLog | 17 +++++++++++++++++ milena/mln/border/mirror.hh | 2 +- milena/mln/canvas/labeling/blobs.hh | 2 +- milena/mln/canvas/labeling/generic.hh | 2 +- milena/mln/canvas/labeling/sorted.hh | 2 +- milena/mln/canvas/labeling/video.hh | 2 +- milena/mln/data/stretch.hh | 2 +- milena/mln/debug/put_word.hh | 2 +- milena/mln/debug/trace.hh | 10 ++++++++++ milena/mln/draw/dashed_line.hh | 4 ++-- milena/mln/draw/line.hh | 4 ++-- milena/mln/labeling/colorize.hh | 2 +- milena/mln/subsampling/antialiased.hh | 2 +- 13 files changed, 40 insertions(+), 13 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 39d46b9..48577a2 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,22 @@ 2013-03-19 Guillaume Lazzara <z@lrde.epita.fr> + Introduce mln_trace_warning macro. + + * mln/border/mirror.hh, + * mln/canvas/labeling/blobs.hh, + * mln/canvas/labeling/generic.hh, + * mln/canvas/labeling/sorted.hh, + * mln/canvas/labeling/video.hh, + * mln/data/stretch.hh, + * mln/debug/put_word.hh, + * mln/debug/trace.hh, + * mln/draw/dashed_line.hh, + * mln/draw/line.hh, + * mln/labeling/colorize.hh, + * mln/subsampling/antialiased.hh: Make use of this macro here. + +2013-03-19 Guillaume Lazzara <z@lrde.epita.fr> + Remove last references to mln::trace::*. * mln/arith/min.hh, diff --git a/milena/mln/border/mirror.hh b/milena/mln/border/mirror.hh index 390f581..89a132d 100644 --- a/milena/mln/border/mirror.hh +++ b/milena/mln/border/mirror.hh @@ -197,7 +197,7 @@ namespace mln inline void mirror_(const box3d&, const I& ima) { - debug::trace::warning("border::mirror for 3D image is not implemented," + mln_trace_warning("border::mirror for 3D image is not implemented," " so image borders have not been mirrored!"); (void) ima; // FIXME write it! diff --git a/milena/mln/canvas/labeling/blobs.hh b/milena/mln/canvas/labeling/blobs.hh index 1a30886..7f962db 100644 --- a/milena/mln/canvas/labeling/blobs.hh +++ b/milena/mln/canvas/labeling/blobs.hh @@ -120,7 +120,7 @@ namespace mln // Label this point component. if (nlabels == mln_max(L)) { - debug::trace::warning("labeling aborted! Too many labels \ + mln_trace_warning("labeling aborted! Too many labels \ for this label type: nlabels > max(label_type)."); return output; diff --git a/milena/mln/canvas/labeling/generic.hh b/milena/mln/canvas/labeling/generic.hh index 19aad51..12a4de3 100644 --- a/milena/mln/canvas/labeling/generic.hh +++ b/milena/mln/canvas/labeling/generic.hh @@ -161,7 +161,7 @@ namespace mln if (nlabels == mln_max(L)) { status = false; - debug::trace::warning("labeling aborted! Too many labels \ + mln_trace_warning("labeling aborted! Too many labels \ for this label type: nlabels > \ max(label_type)."); diff --git a/milena/mln/canvas/labeling/sorted.hh b/milena/mln/canvas/labeling/sorted.hh index 89ebc82..ff7c97e 100644 --- a/milena/mln/canvas/labeling/sorted.hh +++ b/milena/mln/canvas/labeling/sorted.hh @@ -172,7 +172,7 @@ namespace mln { if (nlabels == mln_max(L)) { - debug::trace::warning("labeling aborted! Too many labels \ + mln_trace_warning("labeling aborted! Too many labels \ for this label type: nlabels > \ max(label_type)."); return output; diff --git a/milena/mln/canvas/labeling/video.hh b/milena/mln/canvas/labeling/video.hh index 8d3c65f..0b840a6 100644 --- a/milena/mln/canvas/labeling/video.hh +++ b/milena/mln/canvas/labeling/video.hh @@ -159,7 +159,7 @@ namespace mln { if (nlabels == mln_max(L)) { - debug::trace::warning("labeling aborted! Too many labels for \ + mln_trace_warning("labeling aborted! Too many labels for \ this label type: nlabels > \ max(label_type)."); return output; diff --git a/milena/mln/data/stretch.hh b/milena/mln/data/stretch.hh index 1288376..5b36dbe 100644 --- a/milena/mln/data/stretch.hh +++ b/milena/mln/data/stretch.hh @@ -111,7 +111,7 @@ namespace mln else { initialize(output, input); - debug::trace::warning("output has no significative data!"); + mln_trace_warning("output has no significative data!"); } return output; diff --git a/milena/mln/debug/put_word.hh b/milena/mln/debug/put_word.hh index 335baf0..c91700e 100644 --- a/milena/mln/debug/put_word.hh +++ b/milena/mln/debug/put_word.hh @@ -66,7 +66,7 @@ namespace mln word_end.last_coord() = static_cast<def::coord>(word_end.last_coord() + word.length() - 1); if (! inout.has(word_end)) - debug::trace::warning("Cannot write text outside the image domain"); + mln_trace_warning("Cannot write text outside the image domain"); const unsigned n = word.length(); point2d p = word_start; diff --git a/milena/mln/debug/trace.hh b/milena/mln/debug/trace.hh index 07e9c5e..bddd8a1 100644 --- a/milena/mln/debug/trace.hh +++ b/milena/mln/debug/trace.hh @@ -40,6 +40,8 @@ mln::debug::trace mln_trace_(S); \ (void) mln_trace_; +# define mln_trace_warning(S) \ + mln::debug::trace::warning(S); namespace mln { @@ -61,6 +63,9 @@ namespace mln void my_function() { mln_trace("mln::my_function"); + + /// Your code + /// .... } } \endcode @@ -117,6 +122,7 @@ namespace mln // Implementations. + inline trace::trace(const std::string& scope) { if (quiet) @@ -136,6 +142,7 @@ namespace mln } + inline trace::~trace() { if (quiet) @@ -179,12 +186,14 @@ namespace mln } + inline void trace::resume() { quiet = is_quiet_; } + inline void trace::stop() { is_quiet_ = quiet; @@ -193,6 +202,7 @@ namespace mln } + inline void trace::warning(const std::string& message) { std::cerr << "Warning: " << message << std::endl; diff --git a/milena/mln/draw/dashed_line.hh b/milena/mln/draw/dashed_line.hh index c9fe6b7..d26559b 100644 --- a/milena/mln/draw/dashed_line.hh +++ b/milena/mln/draw/dashed_line.hh @@ -99,9 +99,9 @@ namespace mln mln_precondition(ima.is_valid()); if (! ima.has(beg)) - debug::trace::warning("Begin site is not part of the given image."); + mln_trace_warning("Begin site is not part of the given image."); if (! ima.has(end)) - debug::trace::warning("End site is not part of the given image."); + mln_trace_warning("End site is not part of the given image."); data::fill(((ima | p_line2d(beg, end)).rw() | internal::dashed_line_f<I, 1>()).rw(), v); } diff --git a/milena/mln/draw/line.hh b/milena/mln/draw/line.hh index 08c9920..fb2435f 100644 --- a/milena/mln/draw/line.hh +++ b/milena/mln/draw/line.hh @@ -78,9 +78,9 @@ namespace mln I& ima = exact(ima_); mln_precondition(ima.is_valid()); if (! ima.has(beg)) - debug::trace::warning("Begin site is not part of the given image."); + mln_trace_warning("Begin site is not part of the given image."); if (! ima.has(end)) - debug::trace::warning("End site is not part of the given image."); + mln_trace_warning("End site is not part of the given image."); data::paste(pw::cst(v) | p_line2d(beg, end), safe(ima).rw()); } diff --git a/milena/mln/labeling/colorize.hh b/milena/mln/labeling/colorize.hh index a3e8f5c..52a76fd 100644 --- a/milena/mln/labeling/colorize.hh +++ b/milena/mln/labeling/colorize.hh @@ -144,7 +144,7 @@ namespace mln if (ntries == nelements) { - debug::trace::warning("labeling::colorize - Can't find a new unique color. Returning black."); + mln_trace_warning("labeling::colorize - Can't find a new unique color. Returning black."); return literal::black; } diff --git a/milena/mln/subsampling/antialiased.hh b/milena/mln/subsampling/antialiased.hh index 169eb0b..378f452 100644 --- a/milena/mln/subsampling/antialiased.hh +++ b/milena/mln/subsampling/antialiased.hh @@ -409,7 +409,7 @@ namespace mln output_domain, border_thickness); else - debug::trace::warning("Not implemented yet."); + mln_trace_warning("Not implemented yet."); mln_concrete(I) output; return output; -- 1.7.2.5