FOX/ObjCryst++  1.10.X (development)
VFNDebug.cpp
1 /* ObjCryst++ Object-Oriented Crystallographic Library
2  (c) 2000-2002 Vincent Favre-Nicolin vincefn@users.sourceforge.net
3  2000-2001 University of Geneva (Switzerland)
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 /*
20 * source file for LibCryst++ LibCryst Debug messages functions
21 *
22 */
23 
24 #ifdef __DEBUG__
25 
26 #include "ObjCryst/Quirks/VFNDebug.h"
27 //#include <stdlib.h>
28 #include <iostream>
29 using namespace std;
30 int gDebugMessageGlobalLevel=10;
31 int gDebugMessageLevel=gDebugMessageLevel;
32 unsigned int gVFNDebugMessageIndent=0;
33 /*
34 void LibCrystDebugMessage(const string &message, const int level=0)
35 {
36  if(level >= sDebugMessageLevel) cout << "DEBUG MSG:" << message <<endl;
37 }
38 */
39 void LibCrystDebugGlobalLevel(const int level)
40 {
41  gDebugMessageGlobalLevel=level;
42  LibCrystDebugLocalLevel(-1);
43 };
44 
45 //Use this for a local modification of debug level messages. Call this at the
46 //beginning of the function, and call it without argument at the ned of the function
47 //to revert to the default global debug level.
48 void LibCrystDebugLocalLevel(const int level)
49 {
50  if(level != -1) gDebugMessageLevel=level;
51  else gDebugMessageLevel=gDebugMessageGlobalLevel;
52  cout << "DEBUG MSG: Setting debug level to " << gDebugMessageLevel <<endl;
53 }
54 
55 int gVFNDebugMessageGlobalLevel=10;//The default : few messages.
56 int gVFNDebugMessageLevel=gVFNDebugMessageGlobalLevel;
57 
58 #endif //__DEBUG__