00001 /*========================================================================= 00002 00003 Program: gdcm 00004 Module: $RCSfile: gdcmDebug.cxx,v $ 00005 Language: C++ 00006 Date: $Date: 2005/02/04 16:51:36 $ 00007 Version: $Revision: 1.24 $ 00008 00009 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de 00010 l'Image). All rights reserved. See Doc/License.txt or 00011 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details. 00012 00013 This software is distributed WITHOUT ANY WARRANTY; without even 00014 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00015 PURPOSE. See the above copyright notices for more information. 00016 00017 =========================================================================*/ 00018 00019 #include "gdcmDebug.h" 00020 #include <iostream> 00021 00022 namespace gdcm 00023 { 00024 //----------------------------------------------------------------------------- 00025 // Warning message level to be displayed 00026 static bool DebugFlag = false; 00027 static bool DebugToFile = false; 00028 static std::ofstream DebugFile; 00029 00030 //----------------------------------------------------------------------------- 00031 // Constructor / Destructor 00032 Debug::Debug() 00033 { 00034 00035 } 00036 00037 Debug::~Debug() 00038 { 00039 if ( DebugFile.is_open() ) 00040 DebugFile.close(); 00041 } 00042 00043 //----------------------------------------------------------------------------- 00044 // Public 00049 void Debug::SetDebugFlag (bool flag) 00050 { 00051 DebugFlag = flag; 00052 } 00053 00058 bool Debug::GetDebugFlag () 00059 { 00060 return DebugFlag; 00061 } 00062 00067 void Debug::SetDebugToFile (bool flag) 00068 { 00069 DebugToFile = flag; 00070 } 00071 00075 bool Debug::GetDebugToFile () 00076 { 00077 return DebugToFile; 00078 } 00079 00087 void Debug::SetDebugFilename (std::string const &filename) 00088 { 00089 DebugToFile = true; // Just in case ... 00090 DebugFlag = true; // Just in case ... 00091 if( DebugFile.is_open() ) 00092 DebugFile.close(); 00093 DebugFile.open( filename.c_str() ); 00094 } 00095 00101 std::ofstream &Debug::GetDebugFile () 00102 { 00103 return DebugFile; 00104 } 00105 00106 //----------------------------------------------------------------------------- 00107 // Protected 00108 00109 //----------------------------------------------------------------------------- 00110 // Private 00111 00112 //----------------------------------------------------------------------------- 00113 // Print 00114 00115 //----------------------------------------------------------------------------- 00116 } // end namespace gdcm