cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
util.cpp
Go to the documentation of this file.
1 
25 #include "util.hpp"
26 
27 
28 
29 void Dfprintf(uint8_t level, FILE *stream, const char* format, ... ) {
30 #ifndef __SYNTHESIS__
31  if (level<=DEBUG_LEVEL) {
32  va_list arglist;
33  va_start( arglist, format );
34  vfprintf(stream, format, arglist );
35  va_end( arglist );
36  }
37 #endif
38 }
39 
40 void bprintf( const char* format, ... ) {
41 #ifndef __SYNTHESIS__
42  va_list arglist;
43  va_start( arglist, format );
44  vprintf( format, arglist );
45  va_end( arglist );
46 #endif
47 }
48 
49 
50 #ifdef DEBUG
51 std::ostream &dout = cout;
52 #else
53 std::ofstream dev_null ("/dev/null");
54 std::ostream &dout = dev_null;
55 #endif
56 
57 
58 bool isNumeric(const std::string str) { // loop Through each character in the string
59  for(char x: str)
60  if(!isdigit(x)) // Check if a single character "x" its a digit
61  return false; // if its not return false
62  return true; // else return true
63 }
#define DEBUG_LEVEL
Definition: nal.hpp:123
std::ofstream dev_null("/dev/null")
std::ostream & dout
Definition: util.cpp:54
void Dfprintf(uint8_t level, FILE *stream, const char *format,...)
Definition: util.cpp:29
void bprintf(const char *format,...)
Definition: util.cpp:40
bool isNumeric(const std::string str)
Definition: util.cpp:58
Common utility functions headers, i.e. timing, printing wrappers.