cfl_definitions.h
Go to the documentation of this file.
1 /** @file cfl_definitions.h
2 
3 Compiletime options. This file configures the runtime bahaviour of
4 libFAUDES, in particular informative output on stderr and stdout; see
5 also the Makefile.
6 
7 */
8 
9 
10 /* FAU Discrete Event Systems Library (libfaudes)
11 
12  Copyright (C) 2006 Bernd Opitz
13  Copyright (C) 2008-2021 Thomas Moor
14  Exclusive copyright is granted to Klaus Schmidt
15 
16  This library is free software; you can redistribute it and/or
17  modify it under the terms of the GNU Lesser General Public
18  License as published by the Free Software Foundation; either
19  version 2.1 of the License, or (at your option) any later version.
20 
21  This library is distributed in the hope that it will be useful,
22  but WITHOUT ANY WARRANTY; without even the implied warranty of
23  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24  Lesser General Public License for more details.
25 
26  You should have received a copy of the GNU Lesser General Public
27  License along with this library; if not, write to the Free Software
28  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
29 
30 
31 
32 #ifndef FAUDES_DEFINITIONS_H
33 #define FAUDES_DEFINITIONS_H
34 
35 #include <iostream>
36 #include <sstream>
37 #include <inttypes.h>
38 #include "configuration.h"
39 
40 namespace faudes {
41 
42 /** Type definition for index type (allways 32bit) */
43 typedef uint32_t Idx;
44 #define FAUDES_IDX_MAX 0xFFFFFFFFU
45 
46 /** Type definition for integer type (let target system decide, minimum 32bit) */
47 typedef long int Int;
48 #define FAUDES_INT_MIN (std::numeric_limits<int>::min())
49 #define FAUDES_INT_MAX (std::numeric_limits<Type>::max())
50 
51 /** Type definition for real type */
52 typedef double Float;
53 
54 /** Length of strings for text fields in token output*/
55 #define FD_NAMELEN 13
56 
57 /** Max length of automatic container names (set to -1 for unlimited) */
58 #define FD_MAXCONTAINERNAME 70
59 
60 /** Max size of transrel for state name output */
61 #define FD_SMALLTRANSREL 100
62 
63 /** Min number of states to use consecutive section in file output */
64 #define FD_CONSECUTIVE 6
65 
66 /** Max number of automatic signatures */
67 #define FD_RTIMAXSIG 5
68 
69 #ifndef FAUDES_VERSION
70 /** Fallback version string (should define version in Makefile) */
71 #define FAUDES_VERSION "undefined version"
72 #endif
73 
74 /** Debug: console output, no redirection */
75 #define FAUDES_WRITE_DIRECT(message) \
76  { if(!faudes::ConsoleOut::G()->Mute()) { std::cout << message << std::endl;} }
77 
78 /** Debug: output macro for optional redirection of all console output */
79 #define FAUDES_WRITE_CONSOLE(message) \
80  { if(!faudes::ConsoleOut::G()->Mute()) { \
81  std::ostringstream cfl_line; cfl_line << message << std::endl; faudes::ConsoleOut::G()->Write(cfl_line.str());} }
82 
83 /** Debug: always report warnings */
84 #define FD_WARN(message) FAUDES_WRITE_CONSOLE("FAUDES_WARNING: " << message)
85 
86 /** Debug: report more errors with file/line info */
87 #ifdef FAUDES_DEBUG_CODE
88 #define FD_ERR(message) \
89  FAUDES_WRITE_CONSOLE("FAUDES_CODE: " << message << " in " << __FILE__ << ":" << __LINE__ )
90 #else
91 #define FD_ERR(message)
92 #endif
93 
94 /** Application callback: optional write progress report to console or application */
95 #ifdef FAUDES_WRITE_PROGRESS
96 #define FD_WP(message) {FAUDES_WRITE_CONSOLE("FAUDES_PROGRESS: " << message); LoopCallback();}
97 #else
98 #define FD_WP(message)
99 #endif
100 
101 /** Application callback: optional write progress report to console or application, incl count */
102 #ifdef FAUDES_WRITE_PROGRESS
103 #define FD_WPC(cntnow, cntdone, message) \
104  { std::ostringstream cfl_line; cfl_line << "FAUDES_PROGRESS: " << message << std::endl; \
105  faudes::ConsoleOut::G()->Write(cfl_line.str(),(cntnow),(cntdone)); LoopCallback(); }
106 #else
107 #define FD_WPC(cntnow, contdone, message)
108 #endif
109 
110 /** Alternative progessreport for development */
111 #define FD_WPD(cntnow, cntdone, message) { \
112  static faudes_systime_t start; \
113  static faudes_systime_t now; \
114  static faudes_mstime_t lap; \
115  static Int prog; \
116  static bool init(false); \
117  if(!init) { faudes_gettimeofday(&start); prog=cntnow;} \
118  faudes_gettimeofday(&now); \
119  faudes_diffsystime(now,start,&lap); \
120  if(!init) lap=10000; \
121  if(lap>=10000) { \
122  Int cps = (cntnow-prog)/(lap/1000); \
123  std::ostringstream cfl_line; \
124  cfl_line << "FAUDES_PROGRESS: " << message; \
125  if(cntnow>0) cfl_line << " (#/sec: " << cps << ")";\
126  cfl_line << std::endl; \
127  faudes::ConsoleOut::G()->Write(cfl_line.str(),(cntnow),(cntdone)); LoopCallback(); \
128  faudes_gettimeofday(&start); \
129  prog=cntnow; \
130  } \
131  init=true; }
132 
133 
134 /** Debug: optional report on user functions */
135 #ifdef FAUDES_DEBUG_FUNCTION
136 #define FD_DF(message) FAUDES_WRITE_CONSOLE("FAUDES_FUNCTION: " << message)
137 #else
138 #define FD_DF(message)
139 #endif
140 
141 
142 /** Debug: optional report on generator operations */
143 #ifdef FAUDES_DEBUG_GENERATOR
144 #define FD_DG(message) FAUDES_WRITE_CONSOLE("FAUDES_GENERATOR: " << message)
145 #else
146 #define FD_DG(message)
147 #endif
148 
149 /** Debug: optional report on container operations */
150 #ifdef FAUDES_DEBUG_CONTAINER
151 #define FD_DC(message) FAUDES_WRITE_CONSOLE("FAUDES_CONTAINER: " << message)
152 #else
153 #define FD_DC(message)
154 #endif
155 
156 /** Debug: optional on function and type definition */
157 #ifdef FAUDES_DEBUG_RUNTIMEINTERFACE
158 #define FD_DRTI(message) FAUDES_WRITE_CONSOLE("FAUDES_RTI: " << message)
159 #else
160 #define FD_DRTI(message)
161 #endif
162 
163 /** Debug: optional report registry operations */
164 #ifdef FAUDES_DEBUG_REGISTRY
165 #define FD_DREG(message) FAUDES_WRITE_CONSOLE("FAUDES_REG: " << message)
166 #else
167 #define FD_DREG(message)
168 #endif
169 
170 /** Debug: optional low-level report on iterations and token IO */
171 #ifdef FAUDES_DEBUG_VERBOSE
172 #define FD_DV(message) FAUDES_WRITE_CONSOLE("FAUDES_VERBOSE: " << message)
173 #else
174 #define FD_DV(message)
175 #endif
176 
177 /** Debug: count objects, report on exit */
178 #ifdef FAUDES_DEBUG_CODE
179 #define FAUDES_OBJCOUNT_INC(type) ObjectCount::Inc(type)
180 #define FAUDES_OBJCOUNT_DEC(type) ObjectCount::Dec(type)
181 #else
182 #define FAUDES_OBJCOUNT_INC(type)
183 #define FAUDES_OBJCOUNT_DEC(type)
184 #endif
185 
186 /** Debug: timing */
187 #define FAUDES_TIMER_START(msg) { \
188  FD_WARN("timer start " << msg ); \
189  faudes_gettimeofday(& gPerfTimer1 ); }
190 #define FAUDES_TIMER_LAP(msg) { \
191  faudes_systime_t now; \
192  faudes_mstime_t lap; \
193  faudes_gettimeofday(&now); \
194  faudes_diffsystime(now,gPerfTimer1,&lap); \
195  FD_WARN("timer lap " << msg << " " << lap << "ms");}
196 
197 
198 /** Tutorial/debugging mark */
199 #define FD_DLINE(message) FD_WARN( \
200  std::endl << "################################################ " << \
201  std::endl << message << " at file " << __FILE__ << ", line " << __LINE__ << endl << \
202  std::endl << "################################################ " << std::endl );
203 
204 
205 /** Doxygen: exclude this from doxygen */
206 #ifndef FAUDES_DOXYGEN
207 #define FAUDES_NODOC(a) a
208 #else
209 #define FAUDES_NODOC(a)
210 #endif
211 
212 /* Doxygen: include group definitions */
213 #ifdef FAUDES_DOXYGEN
214 #include "doxygen_groups.h"
215 #endif
216 
217 } // namespace faudes
218 
219 #endif
220 
libFAUDES resides within the namespace faudes.
uint32_t Idx
Type definition for index type (allways 32bit)
double Float
Type definition for real type.
long int Int
Type definition for integer type (let target system decide, minimum 32bit)

libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen