DATRW++ library: seismic data I/O with multiple formats
debug.h
Go to the documentation of this file.
1 /*! \file debug.h
2  * \brief macro function for debugging output (prototypes)
3  *
4  * ----------------------------------------------------------------------------
5  *
6  * \author Thomas Forbriger
7  * \date 29/06/2007
8  *
9  * macro function for debugging output (prototypes)
10  *
11  * Copyright (c) 2007 by Thomas Forbriger (BFO Schiltach)
12  *
13  * ----
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27  * ----
28  *
29  * REVISIONS and CHANGES
30  * - 29/06/2007 V1.0 Thomas Forbriger
31  * - 02/09/2011 V1.1 value function to be used in the argument of debug
32  * function
33  *
34  * ============================================================================
35  */
36 
37 // include guard
38 #ifndef DATRW_DEBUG_H_VERSION
39 
40 #define DATRW_DEBUG_H_VERSION \
41  "DATRW_DEBUG_H V1.1"
42 
43 /*! \brief produce debug output
44  * \ingroup group_util
45  *
46  * \param C output will be generated if C == true
47  * \param N name of function
48  * \param M message to print
49  */
50 #define DATRW_debug(C,N,M) \
51  if (C) { \
52  std::cerr << "DEBUG (" << N << ", " \
53  << __FILE__ << " line #" << __LINE__ << "):" << std::endl \
54  << " " << M << std::endl; \
55  std::cerr.flush(); \
56  }
57 
58 /*! \brief report value
59  * \ingroup group_util
60  *
61  * \param V expression variable to report
62  *
63  * The macro can be used in the argument \par M of DATRW_debug
64  */
65 #define DATRW_value(V) #V << "=" << V
66 
67 #endif // DATRW_DEBUG_H_VERSION (includeguard)
68 
69 /* ----- END OF debug.h ----- */