LSSTApplications
10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
home
lsstsw
stack
Linux64
meas_algorithms
11.0-2-gb8b8ce7
include
lsst
meas
algorithms
shapelet
dbg.h
Go to the documentation of this file.
1
#ifndef MeasAlgoShapeletDbg_H
2
#define MeasAlgoShapeletDbg_H
3
4
#if 0 // for now, turn this off for LSST.
5
6
/* Put the following in the main program file:
7
8
std::ostream* dbgout=0;
9
bool XDEBUG=false;
10
11
*/
12
13
//
14
// Set up debugging stuff
15
//
16
17
#include <iostream>
18
#include <stdexcept>
19
20
#if defined(__GNUC__) && defined(OPENMP_LINK)
21
extern
__thread std::ostream*
dbgout
;
22
extern
__thread
bool
XDEBUG
;
23
#else
24
extern
std::ostream*
dbgout
;
25
extern
bool
XDEBUG
;
26
#endif
27
28
#ifdef _OPENMP
29
#pragma omp threadprivate( dbgout , XDEBUG )
30
#endif
31
32
struct
AssertFailureException :
33
public
std::runtime_error
34
{
35
AssertFailureException(
const
char
* e) : std::runtime_error(
36
std::string(
"Error - Assert "
) + e +
" failed"
) {}
37
};
38
39
#ifdef NDEBUG
40
#define dbg if (false) (*dbgout)
41
#define xdbg if (false) (*dbgout)
42
#define xxdbg if (false) (*dbgout)
43
#define Assert(x)
44
#else
45
#define dbg if (dbgout) (*dbgout)
46
#define xdbg if (dbgout && XDEBUG) (*dbgout)
47
#define xxdbg if (false) (*dbgout)
48
#define Assert(x) \
49
do { \
50
if(!(x)) { \
51
dbg << "Error - Assert " #x " failed"<<std::endl; \
52
dbg << "on line "<<__LINE__<<" in file "<<__FILE__<<std::endl; \
53
throw AssertFailureException(#x); \
54
} \
55
} while(false)
56
#endif
57
58
#else // Define simple replacements so dbg code can remain without problems.
59
60
#include "assert.h"
61
#include <ostream>
62
63
const
bool
XDEBUG
=
false
;
64
std::ostream*
const
dbgout
= 0;
65
#ifdef USE_CERR_FOR_DBG
66
#define dbg if (true) (std::cerr)
67
#define xdbg if (true) (std::cerr)
68
#else
69
#define dbg if (false) (std::cerr)
70
#define xdbg if (false) (std::cerr)
71
#endif
72
#define xxdbg if (false) (std::cerr)
73
#define Assert(x) assert(x)
74
75
#endif
76
77
#endif
XDEBUG
const bool XDEBUG
Definition:
dbg.h:63
dbgout
std::ostream *const dbgout
Definition:
dbg.h:64
Generated on Thu Sep 24 2015 02:29:20 for LSSTApplications by
1.8.5