1 /*=========================================================================
4 Module: $RCSfile: gdcmDebug.cxx,v $
6 Date: $Date: 2005/06/24 10:55:58 $
7 Version: $Revision: 1.25 $
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.html for details.
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.
17 =========================================================================*/
19 #include "gdcmDebug.h"
24 //-----------------------------------------------------------------------------
25 // Warning message level to be displayed
26 static bool DebugFlag = false;
27 static bool DebugToFile = false;
28 static std::ofstream DebugFile;
30 //-----------------------------------------------------------------------------
31 // Constructor / Destructor
39 if ( DebugFile.is_open() )
43 //-----------------------------------------------------------------------------
46 * \brief Sets the debug flag
47 * @param flag Set the debug flag
49 void Debug::SetDebugFlag (bool flag)
55 * \brief Gets the debug flag value
56 * @return debug flag value
58 bool Debug::GetDebugFlag ()
65 * @param flag whether we want to redirect to file
67 void Debug::SetDebugToFile (bool flag)
73 * \brief Accessor to know whether debug info are redirected to file
75 bool Debug::GetDebugToFile ()
81 * \brief Set the filename the debug stream should be redirect to
82 * Settting a filename also sets DebugToFile to true
83 * @param filename File to redirect debug info
84 * Absolutely nothing is check. You have to pass in
87 void Debug::SetDebugFilename (std::string const &filename)
89 DebugToFile = true; // Just in case ...
90 DebugFlag = true; // Just in case ...
91 if ( DebugFile.is_open() )
93 DebugFile.open( filename.c_str() );
97 * \brief Internal use only. Allow us to retrieve the static from anywhere
101 std::ofstream &Debug::GetDebugFile ()
106 //-----------------------------------------------------------------------------
109 //-----------------------------------------------------------------------------
112 //-----------------------------------------------------------------------------
115 //-----------------------------------------------------------------------------
116 } // end namespace gdcm