cfl_definitions.h
Go to the documentation of this file.
1/** @file cfl_definitions.h
2
3Compiletime options. This file configures the runtime bahaviour of
4libFAUDES, in particular informative output on stderr and stdout; see
5also 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
40namespace faudes {
41
42/** Type definition for index type (allways 32bit) */
43typedef uint32_t Idx;
44#define FAUDES_IDX_MAX 0xFFFFFFFFU
45
46/** Type definition for integer type (let target system decide, minimum 32bit) */
47typedef 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 */
52typedef 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()->Verb()>0) { 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()->Verb()>0) { \
81 std::ostringstream cfl_line; cfl_line << message << std::endl; \
82 faudes::ConsoleOut::G()->Write(cfl_line.str()); } }
83
84/** Debug: always report warnings */
85#define FD_WARN(message) FAUDES_WRITE_CONSOLE("FAUDES_WARNING: " << message)
86
87/** Debug: report more errors with file/line info */
88#ifdef FAUDES_DEBUG_CODE
89#define FD_ERR(message) \
90 FAUDES_WRITE_CONSOLE("FAUDES_CODE: " << message << " in " << __FILE__ << ":" << __LINE__ )
91#else
92#define FD_ERR(message)
93#endif
94
95/** Application callback: optional write progress report to console or application */
96#ifdef FAUDES_WRITE_PROGRESS
97#define FD_WP(message) {FAUDES_WRITE_CONSOLE("FAUDES_PROGRESS: " << message); LoopCallback();}
98#else
99#define FD_WP(message)
100#endif
101
102/** Application callback: optional write progress report to console or application, incl count */
103#ifdef FAUDES_WRITE_PROGRESS
104#define FD_WPC(cntnow, cntdone, message) \
105 { std::ostringstream cfl_line; cfl_line << "FAUDES_PROGRESS: " << message << std::endl; \
106 faudes::ConsoleOut::G()->Write(cfl_line.str(),(cntnow),(cntdone)); LoopCallback(); }
107#else
108#define FD_WPC(cntnow, contdone, message)
109#endif
110
111/** Alternative progessreport for development */
112#ifdef FAUDES_SYSTIME
113#define FD_WPD(cntnow, cntdone, message) { \
114 static faudes_systime_t start; \
115 static faudes_systime_t now; \
116 static faudes_mstime_t lap; \
117 static Int prog; \
118 static bool init(false); \
119 if(!init) { faudes_gettimeofday(&start); prog=cntnow;} \
120 faudes_gettimeofday(&now); \
121 faudes_diffsystime(now,start,&lap); \
122 if(!init) lap=10000; \
123 if(lap>=10000) { \
124 Int cps = (cntnow-prog)/(lap/1000); \
125 std::ostringstream cfl_line; \
126 cfl_line << "FAUDES_PROGRESS: " << message; \
127 if(cntnow>0) cfl_line << " (#/sec: " << cps << ")";\
128 cfl_line << std::endl; \
129 faudes::ConsoleOut::G()->Write(cfl_line.str(),(cntnow),(cntdone)); LoopCallback(); \
130 faudes_gettimeofday(&start); \
131 prog=cntnow; \
132 } \
133 init=true; }
134#else
135#define FD_WPD(cntnow, contdone, message) FD_WPC(cntnow, contdone, message)
136#endif
137
138
139/** Debug: optional report on user functions */
140#ifdef FAUDES_DEBUG_FUNCTION
141#define FD_DF(message) FAUDES_WRITE_CONSOLE("FAUDES_FUNCTION: " << message)
142#else
143#define FD_DF(message)
144#endif
145
146
147/** Debug: optional report on generator operations */
148#ifdef FAUDES_DEBUG_GENERATOR
149#define FD_DG(message) FAUDES_WRITE_CONSOLE("FAUDES_GENERATOR: " << message)
150#else
151#define FD_DG(message)
152#endif
153
154/** Debug: optional report on container operations */
155#ifdef FAUDES_DEBUG_CONTAINER
156#define FD_DC(message) FAUDES_WRITE_CONSOLE("FAUDES_CONTAINER: " << message)
157#else
158#define FD_DC(message)
159#endif
160
161/** Debug: optional on function and type definition */
162#ifdef FAUDES_DEBUG_RUNTIMEINTERFACE
163#define FD_DRTI(message) FAUDES_WRITE_CONSOLE("FAUDES_RTI: " << message)
164#else
165#define FD_DRTI(message)
166#endif
167
168/** Debug: optional report registry operations */
169#ifdef FAUDES_DEBUG_REGISTRY
170#define FD_DREG(message) FAUDES_WRITE_CONSOLE("FAUDES_REG: " << message)
171#else
172#define FD_DREG(message)
173#endif
174
175/** Debug: optional low-level report on iterations and token IO */
176#ifdef FAUDES_DEBUG_VERBOSE
177#define FD_DV(message) FAUDES_WRITE_CONSOLE("FAUDES_VERBOSE: " << message)
178#else
179#define FD_DV(message)
180#endif
181
182/** Debug: count objects, report on exit */
183#ifdef FAUDES_DEBUG_CODE
184#define FAUDES_OBJCOUNT_INC(type) ObjectCount::Inc(type)
185#define FAUDES_OBJCOUNT_DEC(type) ObjectCount::Dec(type)
186#else
187#define FAUDES_OBJCOUNT_INC(type)
188#define FAUDES_OBJCOUNT_DEC(type)
189#endif
190
191/** Debug: timing */
192#define FAUDES_TIMER_START(msg) { \
193 FD_WARN("timer start " << msg ); \
194 faudes_gettimeofday(& gPerfTimer1 ); }
195#define FAUDES_TIMER_LAP(msg) { \
196 faudes_systime_t now; \
197 faudes_mstime_t lap; \
198 faudes_gettimeofday(&now); \
199 faudes_diffsystime(now,gPerfTimer1,&lap); \
200 FD_WARN("timer lap " << msg << " " << lap << "ms");}
201
202
203/** Tutorial/debugging mark */
204#define FD_DLINE(message) FD_WARN( \
205 std::endl << "################################################ " << \
206 std::endl << message << " at file " << __FILE__ << ", line " << __LINE__ << endl << \
207 std::endl << "################################################ " << std::endl );
208
209
210/** Doxygen: exclude this from doxygen */
211#ifndef FAUDES_DOXYGEN
212#define FAUDES_NODOC(a) a
213#else
214#define FAUDES_NODOC(a)
215#endif
216
217/* Doxygen: include group definitions */
218#ifdef FAUDES_DOXYGEN
219#include "doxygen_groups.h"
220#endif
221
222} // namespace faudes
223
224#endif
225
uint32_t Idx
double Float
long int Int

libFAUDES 2.33k --- 2025.09.16 --- c++ api documentaion by doxygen