cfl_definitions.h

Go to the documentation of this file.
00001 /** @file cfl_definitions.h 
00002 
00003 Compiletime options. This file configures the runtime bahaviour of
00004 libFAUDES, in particular informative output on stderr and stdout; see
00005 also the Makefile.
00006 
00007 */
00008 
00009 
00010 /* FAU Discrete Event Systems Library (libfaudes)
00011 
00012    Copyright (C) 2006  Bernd Opitz
00013    Copyright (C) 2008  Thomas Moor
00014    Exclusive copyright is granted to Klaus Schmidt
00015 
00016    This library is free software; you can redistribute it and/or
00017    modify it under the terms of the GNU Lesser General Public
00018    License as published by the Free Software Foundation; either
00019    version 2.1 of the License, or (at your option) any later version.
00020 
00021    This library is distributed in the hope that it will be useful,
00022    but WITHOUT ANY WARRANTY; without even the implied warranty of
00023    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00024    Lesser General Public License for more details.
00025 
00026    You should have received a copy of the GNU Lesser General Public
00027    License along with this library; if not, write to the Free Software
00028    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
00029 
00030 
00031 
00032 #ifndef FAUDES_DEFINITIONS_H
00033 #define FAUDES_DEFINITIONS_H
00034 
00035 #include "configuration.h"
00036 #include "cfl_platform.h"
00037 
00038 #include <sstream>
00039 #include <iostream>
00040 #include <inttypes.h>
00041 
00042 namespace faudes {
00043 
00044 
00045 /** Type definition for index type (allways 32bit) */
00046 typedef uint32_t Idx;
00047 #define FAUDES_IDX_MAX 0xFFFFFFFFU
00048 
00049 /** Type definition for integer type (let target system decide, minimum 32bit) */
00050 typedef long int Int;
00051 #define FAUDES_INT_MIN LONG_MIN
00052 #define FAUDES_INT_MAX LONG_MAX
00053 
00054 /** Type definition for real type (use C std double, must at least represent Int) */
00055 typedef double Float;
00056 
00057 /** Length of strings for text fields in token output*/
00058 #define FD_NAMELEN 13
00059 
00060 /** Max length of automatic container names (set to -1 for unlimited) */
00061 #define FD_MAXCONTAINERNAME 70
00062 
00063 /** Max size of transrel for state name output */
00064 #define FD_SMALLTRANSREL 100
00065 
00066 /** Min number of states to use consecutive section in file output */
00067 #define FD_CONSECUTIVE 6
00068 
00069 /** Max number of automatic signatures */
00070 #define FD_RTIMAXSIG 5
00071 
00072 #ifndef FAUDES_VERSION
00073 /** Fallback version string (should define version in Makefile) */
00074 #define FAUDES_VERSION "undefined version"
00075 #endif
00076 
00077 /** Debug: console output, no redirection */
00078 #define FAUDES_WRITE_DIRECT(message) \
00079   { if(!ConsoleOut::G()->Mute()) { std::cout << message << std::endl;} }
00080 
00081 /** Debug: output macro for optional redirection of all console output */
00082 #define FAUDES_WRITE_CONSOLE(message) \
00083   { if(!ConsoleOut::G()->Mute()) { \
00084     std::ostringstream cfl_line; cfl_line << message << std::endl; ConsoleOut::G()->Write(cfl_line.str());} }
00085 
00086 /** Debug: always report warnings */
00087 #define FD_WARN(message) FAUDES_WRITE_CONSOLE("FAUDES_WARNING:   " << message)
00088 
00089 /** Debug: report more errors with file/line info */
00090 #ifdef FAUDES_DEBUG_CODE
00091 #define FD_ERR(message) \
00092  FAUDES_WRITE_CONSOLE("FAUDES_CODE: "  << message << " in " << __FILE__ << ":" << __LINE__ )
00093 #else
00094 #define FD_ERR(message)
00095 #endif
00096 
00097 /** Application callback: optional write progress report to console or application */
00098 #ifdef FAUDES_WRITE_PROGRESS 
00099 #define FD_WP(message) {FAUDES_WRITE_CONSOLE("FAUDES_PROGRESS:  " << message); LoopCallback();}
00100 #else
00101 #define FD_WP(message)
00102 #endif
00103 
00104 /** Application callback: optional write progress report to console or application, incl count  */
00105 #ifdef FAUDES_WRITE_PROGRESS 
00106 #define FD_WPC(cntnow, cntdone, message)          \
00107   { std::ostringstream cfl_line; cfl_line << "FAUDES_PROGRESS:  " << message << std::endl; \
00108     ConsoleOut::G()->Write(cfl_line.str(),(cntnow),(cntdone)); LoopCallback(); }
00109 #else
00110 #define FD_WPC(cntnow, contdone, message)
00111 #endif
00112 
00113 /** Alternative progessreport for development */
00114 #define FD_WPD(cntnow, cntdone, message)  { \
00115   static faudes_systime_t start; \
00116   static faudes_systime_t now; \
00117   static faudes_mstime_t lap;  \
00118   static Int prog;  \
00119   static bool init(false);  \
00120   if(!init) { faudes_gettimeofday(&start); prog=cntnow;}  \
00121   faudes_gettimeofday(&now);  \
00122   faudes_diffsystime(now,start,&lap); \
00123   if(!init) lap=10000;                  \
00124   if(lap>=10000) {      \
00125     Int cps = (cntnow-prog)/(lap/1000); \
00126     std::ostringstream cfl_line; \
00127     cfl_line << "FAUDES_PROGRESS:  " << message;      \
00128     if(cntnow>0) cfl_line << " (#/sec: " << cps << ")";\
00129     cfl_line << std::endl; \
00130     ConsoleOut::G()->Write(cfl_line.str(),(cntnow),(cntdone)); LoopCallback(); \
00131     faudes_gettimeofday(&start); \
00132     prog=cntnow; \
00133   } \
00134   init=true; } 
00135 
00136 
00137 /** Debug: optional report on user functions */
00138 #ifdef FAUDES_DEBUG_FUNCTION
00139 #define FD_DF(message)  FAUDES_WRITE_CONSOLE("FAUDES_FUNCTION:  " << message)
00140 #else
00141 #define FD_DF(message)
00142 #endif
00143 
00144 
00145 /** Debug: optional report on generator operations */
00146 #ifdef FAUDES_DEBUG_GENERATOR
00147 #define FD_DG(message) FAUDES_WRITE_CONSOLE("FAUDES_GENERATOR: " << message)
00148 #else
00149 #define FD_DG(message)
00150 #endif
00151 
00152 /** Debug: optional report on container operations */
00153 #ifdef FAUDES_DEBUG_CONTAINER
00154 #define FD_DC(message) FAUDES_WRITE_CONSOLE("FAUDES_CONTAINER: " << message)
00155 #else
00156 #define FD_DC(message)
00157 #endif
00158 
00159 /** Debug: optional on function and type definition */
00160 #ifdef FAUDES_DEBUG_RUNTIMEINTERFACE
00161 #define FD_DRTI(message) FAUDES_WRITE_CONSOLE("FAUDES_RTI:     " << message)
00162 #else
00163 #define FD_DRTI(message)
00164 #endif
00165 
00166 /** Debug: optional report registry operations */
00167 #ifdef FAUDES_DEBUG_REGISTRY
00168 #define FD_DREG(message) FAUDES_WRITE_CONSOLE("FAUDES_REG:     " << message)
00169 #else
00170 #define FD_DREG(message)
00171 #endif
00172 
00173 /** Debug: optional low-level report on iterations and  token IO */
00174 #ifdef FAUDES_DEBUG_VERBOSE
00175 #define FD_DV(message) FAUDES_WRITE_CONSOLE("FAUDES_VERBOSE:   " <<  message)
00176 #else
00177 #define FD_DV(message)
00178 #endif
00179 
00180 /** Debug: count objects, report on exit */
00181 #ifdef FAUDES_DEBUG_CODE
00182 #define FAUDES_OBJCOUNT_INC(type) ObjectCount::Inc(type)
00183 #define FAUDES_OBJCOUNT_DEC(type) ObjectCount::Dec(type)
00184 #else
00185 #define FAUDES_OBJCOUNT_INC(type)
00186 #define FAUDES_OBJCOUNT_DEC(type)
00187 #endif
00188 
00189 /** Debug: timing */
00190 #define FAUDES_TIMER_START(msg) {   \
00191  FD_WARN("timer start " << msg );  \
00192  faudes_gettimeofday(& gPerfTimer1 ); } 
00193 #define FAUDES_TIMER_LAP(msg) {  \
00194  faudes_systime_t now; \
00195  faudes_mstime_t lap;  \
00196  faudes_gettimeofday(&now);  \
00197  faudes_diffsystime(now,gPerfTimer1,&lap); \
00198  FD_WARN("timer lap " << msg << " " << lap << "ms");} 
00199 
00200 
00201 /** Tutorial/debugging mark */
00202 #define FD_DLINE(message) FD_WARN( \
00203   std::endl << "################################################ " << \
00204   std::endl << message << " at file " << __FILE__ << ", line " << __LINE__ << endl << \
00205   std::endl << "################################################ " << std::endl );
00206 
00207 
00208 /** Doxygen: exclude this from doxygen */
00209 #ifndef FAUDES_DOXYGEN
00210 #define FAUDES_NODOC(a) a
00211 #else
00212 #define FAUDES_NODOC(a)
00213 #endif
00214 
00215 /* Doxygen: include group definitions */
00216 #ifdef FAUDES_DOXYGEN
00217 #include "doxygen_groups.h"
00218 #endif
00219 
00220 } // namespace faudes
00221 
00222 #endif 
00223 

libFAUDES 2.23h --- 2014.04.03 --- c++ api documentaion by doxygen