Main Page | Modules | Class Hierarchy | Class List | File List | Class Members | Related Pages

defs.h

00001 //==========================================================================
00002 //  DEFS.H - part of
00003 //                     OMNeT++/OMNEST
00004 //            Discrete System Simulation in C++
00005 //
00006 //
00007 //  Defines of global interest
00008 //
00009 //==========================================================================
00010 
00011 /*--------------------------------------------------------------*
00012   Copyright (C) 1992-2005 Andras Varga
00013 
00014   This file is distributed WITHOUT ANY WARRANTY. See the file
00015   `license' for details on this and other legal matters.
00016 *--------------------------------------------------------------*/
00017 
00018 #ifndef __DEFS_H
00019 #define __DEFS_H
00020 
00021 #include <stddef.h>   // size_t
00022 #include <math.h>     // HUGE_VAL
00023 
00024 // OMNeT++ version -- must match NEDC_VERSION in nedxml source!
00025 #define OMNETPP_VERSION 0x0300
00026 
00027 //=== Windows DLL IMPORT/EXPORT stuff
00028 #ifndef __WIN32__
00029 #  if defined(_WIN32) || defined(WIN32)
00030 #    define __WIN32__
00031 #  endif
00032 #endif
00033 
00034 // OPP_DLLIMPORT/EXPORT are empty if not needed
00035 #if defined(__WIN32__)
00036 #  define OPP_DLLEXPORT  __declspec(dllexport)
00037 #  if defined(WIN32_DLL)
00038 #    define OPP_DLLIMPORT  __declspec(dllimport)
00039 #  else
00040 #    define OPP_DLLIMPORT
00041 #  endif
00042 #else
00043 #  define OPP_DLLIMPORT
00044 #  define OPP_DLLEXPORT
00045 #endif
00046 
00047 // SIM_API, ENVIR_API etc are also empty if not needed
00048 #ifdef BUILDING_SIM
00049 #  define SIM_API  OPP_DLLEXPORT
00050 #else
00051 #  define SIM_API  OPP_DLLIMPORT
00052 #endif
00053 
00054 // we need this because cenvir.h is in our directory
00055 #ifdef BUILDING_ENVIR
00056 #  define ENVIR_API  OPP_DLLEXPORT
00057 #else
00058 #  define ENVIR_API  OPP_DLLIMPORT
00059 #endif
00060 
00061 
00062 //=== NULL
00063 #ifndef NULL
00064 #define NULL ((void*)0)
00065 #endif
00066 
00067 
00068 // maximum lengths for className(), fullPath() and old info(buf) strings
00069 #define MAX_CLASSNAME       100
00070 #define MAX_OBJECTFULLPATH  1024
00071 #define MAX_OBJECTINFO      500
00072 
00073 // in case someone still needs the old name
00074 #define FULLPATHBUF_SIZE  MAX_OBJECTFULLPATH
00075 
00076 //=== other common defines
00077 
00078 #ifndef PI
00079 #define PI        3.141592653589793
00080 #endif
00081 
00082 #ifndef Min
00083 #define Min(a,b)     ( (a)<(b) ? (a) : (b) )
00084 #define Max(a,b)     ( (a)>(b) ? (a) : (b) )
00085 #endif
00086 
00087 #define sgn(x)       ((x)==0 ? 0 : ((x)<0 ? -1 : 1))
00088 
00089 // gcc 2.9x.x had broken exception handling
00090 #ifdef __GNUC__
00091 #  if  __GNUC__<3
00092 #    error gcc 3.x required -- please upgrade
00093 #  endif
00094 #endif
00095 
00096 #ifndef NDEBUG
00097 #define ASSERT(expr)  \
00098   ((void) ((expr) ? 0 : \
00099            (opp_error("ASSERT: condition %s false, %s line %d", \
00100                              #expr, __FILE__, __LINE__), 0)))
00101 #else
00102 #define ASSERT(expr)  ((void)0)
00103 #endif
00104 
00105 
00109 typedef double       simtime_t;
00110 
00111 #define MAXTIME      HUGE_VAL
00112 
00113 
00114 //
00115 // memory mgmt functions for void* pointers  (used by cLinkedList and cPar)
00116 //
00117 
00123 typedef void (*VoidDelFunc)(void *);
00124 
00130 typedef void *(*VoidDupFunc)(void *);
00131 
00132 //
00133 // used by cPar expressions
00134 //
00135 
00141 typedef double (*MathFunc)(...);
00142 
00148 typedef double (*MathFuncNoArg)();
00149 
00155 typedef double (*MathFunc1Arg)(double);
00156 
00162 typedef double (*MathFunc2Args)(double,double);
00163 
00169 typedef double (*MathFunc3Args)(double,double,double);
00170 
00176 typedef double (*MathFunc4Args)(double,double,double,double);
00177 
00178 #endif
00179 

Generated on Fri Apr 1 12:25:33 2005 for OMNeT++/OMNEST Simulation Library by  doxygen 1.3.9.1