LSSTApplications
10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
home
lsstsw
stack
Linux64
meas_algorithms
11.0.rc2+3
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 Wed Sep 16 2015 13:35:30 for LSSTApplications by
1.8.5