barry: Your go-to motif accountant  0.0-1
Full enumeration of sample space and fast count of sufficient statistics for binary arrays
barry-debug.hpp
Go to the documentation of this file.
1 #ifndef BARRY_DEBUG_HPP
2 #define BARRY_DEBUG_HPP
3 
4 #ifndef BARRY_DEBUG_LEVEL
5  #define BARRY_DEBUG_LEVEL 0
6 #else
7  // The start of the line in every debug print
8  #define BARRY_DEBUG_HEADER "[barry]"
9  #define BARRY_DEBUG_MSG(a) \
10  printf_barry("%s %s\n", BARRY_DEBUG_HEADER, (a));
11 
12  // Generic printer (default)
13  template <typename T>
14  void BARRY_DEBUG_VEC_PRINT(const std::vector<T> & a) {
15  printf_barry("%s [", BARRY_DEBUG_HEADER);
16  for(const auto & iter : (a))
17  printf_barry("%.4f ", static_cast<double>(iter));
18  printf_barry("]\n");
19  return;
20  }
21 
22  // Specialization for the printer
23  template<>
24  inline void BARRY_DEBUG_VEC_PRINT(const std::vector< int > & a) {
25  printf_barry("%s [", BARRY_DEBUG_HEADER);
26  for(const auto & iter : (a))
27  printf_barry("%i ", iter);
28  printf_barry("]\n");
29  return;
30  }
31 
32  template<>
33  inline void BARRY_DEBUG_VEC_PRINT(const std::vector< std::string > & a) {
34  printf_barry("%s \n", BARRY_DEBUG_HEADER);
35  for(const auto & iter : (a))
36  printf_barry("%s %s\n", BARRY_DEBUG_HEADER, iter.c_str());
37  printf_barry("%s \n", BARRY_DEBUG_HEADER);
38  return;
39  }
40 #endif
41 
42 #endif
#define printf_barry