MPQC  3.0.0-alpha
debug.hpp
1 #ifndef MPQC_UTILITY_DEBUG_HPP
2 #define MPQC_UTILITY_DEBUG_HPP
3 
4 #include "mpqc/utility/string.hpp"
5 
6 #include <stdio.h>
7 #include <stdarg.h>
8 #include <string>
9 
10 namespace mpqc {
11 
12 #ifndef DOXYGEN
13 
14  void debug(char const *file, long line, const char *fmt = NULL, ...) {
15  std::string s = "DEBUG: " + string_cast(file) + ":" + string_cast(line);
16  if (!fmt) {
17  printf("%s", s.c_str());
18  }
19  else {
20  s = s + ": " + fmt;
21  va_list args;
22  va_start(args, fmt);
23  vprintf(s.c_str(), args);
24  va_end(args);
25  }
26  fflush(stdout);
27  }
28 
29 #endif // DOXYGEN
30 
31 }
32 
39 #define MPQC_DEBUG(...) mpqc::debug(__FILE__, __LINE__, __VA_ARGS__)
40 
41 #endif /* MPQC_UTILITY_DEBUG_HPP */
mpqc
Contains new MPQC code since version 3.
Definition: integralenginepool.hpp:37
mpqc::string_cast
std::string string_cast(const T &value)
cast type T to string
Definition: string.hpp:14

Generated at Sun Jan 26 2020 23:24:01 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.