only use equalities in a single var
[barvinok.git] / debug.h
blob136fa6b0818809b252abcd2291162a797943edf2
1 //-*-c++-*-
2 #ifndef DYNAMIC_DEBUG_H
3 #define DYNAMIC_DEBUG_H
5 #include <fstream>
6 #include <map>
7 #include <algorithm>
8 #include <string>
10 using namespace std;
12 class DynamicDebug {
13 map<string,long> debug_functions;
14 public:
15 DynamicDebug(const char* DebugConfigFile);
16 DynamicDebug(ifstream& DebugConfigStream);
17 #ifdef DEBUG_RETURNS_FALSE
18 inline long debug(const string& s) const { return 0; }
19 #else
20 long debug(const string& s) const {
21 if (debug_functions.find(s) == debug_functions.end())
22 return 0;
23 else
24 return (*(debug_functions.find(s))).second;
26 #endif
27 inline void add(const string& s, const long level) { debug_functions[s] = level; }
28 inline void remove(const string& s) { debug_functions.erase(s); }
29 map<string,long>::const_iterator begin() const { return debug_functions.begin(); }
30 map<string,long>::const_iterator end() const { return debug_functions.end(); }
33 extern DynamicDebug DebugBlackboard;
35 #endif