]> Creatis software - gdcm.git/blob - src/gdcmDebug.h
FIX: Revert back to previous version, I don't believe this was a really safe code...
[gdcm.git] / src / gdcmDebug.h
1 /*=========================================================================
2                                                                                 
3   Program:   gdcm
4   Module:    $RCSfile: gdcmDebug.h,v $
5   Language:  C++
6   Date:      $Date: 2004/09/24 03:34:27 $
7   Version:   $Revision: 1.6 $
8                                                                                 
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.htm for details.
12                                                                                 
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16                                                                                 
17 =========================================================================*/
18
19 #ifndef GDCMDEBUG_H
20 #define GDCMDEBUG_H
21
22 #include "gdcmCommon.h"
23
24 //-----------------------------------------------------------------------------
25
26 /**
27  * \ingroup gdcmDebug
28  * \brief gdcmDebug is an object for debugging in program.
29  * It has 2 debugging modes :
30  *  - error : for bad library use
31  *  - debug : for debugging messages
32  * 
33  * A debugging message has a level of priority and is 
34  * Shown only when the debug level is higher than the 
35  * message level.
36  */
37 class GDCM_EXPORT gdcmDebug
38 {
39 public:
40    gdcmDebug(int level = -1);
41
42    void SetDebug (int level);
43    void Verbose(int level, const char* msg1, const char* msg2 = "") ;
44    void Error  (bool test, const char* msg1, const char* msg2 = "");
45    void Error  (const char* msg1, const char* msg2 = "", const char* msg3 = "");
46
47    void Assert(int level, bool test, const char * msg1, const char * msg2);
48    void Exit(int a);
49
50    static gdcmDebug &GetReference();
51
52 private:
53 /// warning message level to be displayed
54    int DebugLevel;
55
56 };
57
58 /// Instance of debugging utility.
59 static gdcmDebug dbg;
60
61 #endif