pd_debug.h
Go to the documentation of this file.
1 /** @file pd_debug.h Debug functions */
2 
3 
4 /* Pushdown plugin for FAU Discrete Event Systems Library (libfaudes)
5 
6  Copyright (C) 2013/14 Ramon Barakat, Stefan Jacobi, Sven Schneider, Anne-Kathrin Hess
7 
8 */
9 
10 #ifndef PD_DEBUG_H
11 #define PD_DEBUG_H
12 
13 #include "libfaudes.h"
14 #include "pd_include.h"
15 
16 
17 namespace faudes{
18 
19 /**
20  * Set level of debugging
21  * 0: do nothing
22  * 1: print to console
23  * 2: print generator to file (.dot and .png)
24  */
25 #define PD_DEBUG_LEVEL 2
26 
27 //Maximal number of printable transitions
28 #define PD_DEBUG_MAX_TRANS 1000
29 
30 
31 //***************************************************************
32 // Print Ops
33 // **************************************************************
34 
35 /**
36  * Print generator depending on debug level (PD_DEBUG_LEVEL)
37  *
38  * @param msg
39  * debugging message and name of printed file
40  * @param pd
41  * reference to generator to be printed
42  *
43  * @return
44  */
45 void debug_printf(const std::string& msg, const PushdownGenerator& pd);
46 
47 /**
48  * Print given text depending on debug level (PD_DEBUG_LEVEL)
49  *
50  * @param msg
51  * debugging message and name of printed file
52  * @param tex
53  * text to be printed
54  *
55  * @return
56  */
57 void debug_printf(const std::string& msg, const std::string& tex = "");
58 
59 
60 #if true
61  #define DEBUG_PRINTF(b, x, y) if(b)debug_printf(x,y)
62 #else
63  #define DEBUG_PRINTF(b, x, y)
64 #endif
65 
66 
67 
68 /**
69  * Print pushdown generator to file,
70  * if the number of transitions does not exceed PD_DEBUG_MAX_TRANS
71  *
72  * The file will be annoutated with pd.XXXXX.name where XXXX stands for an unique
73  * number for each file.
74  *
75  * @param pd
76  * reference to pushdown generator to be printed
77  * @param name
78  * name of file
79  * @param printDOT
80  * true, if DOT-file should be print
81  * @param printPNG
82  * true, if PNG Image should be print
83  *
84  * @return
85  *
86  */
87 void ToFile(const PushdownGenerator& pd,std::string name, bool printDOT =true, bool printPNG=true);
88 
89 /**
90  * Print given text to file.
91  *
92  * The file will be annoutated with pd.XXXXX.name where XXXX stands for an unique
93  * number for each file.
94  *
95  * @param pd
96  * reference to pushdown generator to be print
97  * @param name
98  * name of file
99  *
100  */
101 void ToFile(const std::string& tex,std::string name);
102 
103 
104 }
105 
106 #endif

libFAUDES 2.28c --- 2016.09.30 --- c++ api documentaion by doxygen