Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members  

defs.h

00001 //==========================================================================
00002 //   DEFS.H - header for
00003 //                             OMNeT++
00004 //            Discrete System Simulation in C++
00005 //
00006 //
00007 //  Defines of global interest
00008 //
00009 //==========================================================================
00010 
00011 /*--------------------------------------------------------------*
00012   Copyright (C) 1992-2001 Andras Varga
00013   Technical University of Budapest, Dept. of Telecommunications,
00014   Stoczek u.2, H-1111 Budapest, Hungary.
00015 
00016   This file is distributed WITHOUT ANY WARRANTY. See the file
00017   `license' for details on this and other legal matters.
00018 *--------------------------------------------------------------*/
00019 
00020 #ifndef __DEFS_H
00021 #define __DEFS_H
00022 
00023 #include <stddef.h>   // size_t
00024 #include <math.h>     // HUGE_VAL
00025 
00026 // OMNeT++ version -- must match NEDC_VERSION in nedc source!
00027 #define OMNETPP_VERSION 0x0202
00028 
00029 //=== Windows DLL IMPORT/EXPORT stuff
00030 #ifndef __WIN32__
00031 #  if defined(_WIN32) || defined(WIN32)
00032 #    define __WIN32__
00033 #  endif
00034 #endif
00035 
00036 // OPP_DLLIMPORT/EXPORT are empty if not needed
00037 #if defined(__WIN32__) && defined(WIN32_DLL)
00038 #  define OPP_DLLIMPORT  __declspec(dllimport)
00039 #  define OPP_DLLEXPORT  __declspec(dllexport)
00040 #else
00041 #  define OPP_DLLIMPORT
00042 #  define OPP_DLLEXPORT
00043 #endif
00044 
00045 // SIM_API, ENVIR_API etc are also empty if not needed
00046 #ifdef BUILDING_SIM
00047 #  define SIM_API  OPP_DLLEXPORT
00048 #else
00049 #  define SIM_API  OPP_DLLIMPORT
00050 #endif
00051 
00052 // we need this because cenvir.h is in our directory
00053 #ifdef BUILDING_ENVIR
00054 #  define ENVIR_API  OPP_DLLEXPORT
00055 #else
00056 #  define ENVIR_API  OPP_DLLIMPORT
00057 #endif
00058 
00059 
00060 //=== NULL
00061 #ifndef NULL
00062 #define NULL ((void*)0)
00063 #endif
00064 
00065 #define NO(cXX)   ((cXX *)NULL)
00066 
00067 //=== other common defines
00068 
00069 // for backwards compatibility:
00070 #ifndef TRUE
00071 #define TRUE      true
00072 #define FALSE     false
00073 #endif
00074 
00076 // #if (defined(__BORLANDC__) && (__BORLANDC__<=0x410)) || (defined(__WATCOMC__) && (__WATCOMC__<1060))
00077 // typedef int bool;
00078 // #define true   1
00079 // #define false  0
00080 // #endif
00081 
00082 #ifndef PI
00083 #define PI        3.141592653589793
00084 #endif
00085 
00086 #ifndef Min
00087 #define Min(a,b)     ( (a)<(b) ? (a) : (b) )
00088 #define Max(a,b)     ( (a)>(b) ? (a) : (b) )
00089 #endif
00090 
00091 #define sgn(x)       ((x)==0 ? 0 : ((x)<0 ? -1 : 1))
00092 
00093 #ifndef NDEBUG
00094 #define ASSERT(expr)  \
00095   ((void) ((expr) ? 0 : \
00096            (opp_error("ASSERT: condition %s false, %s line %d", \
00097                              #expr, __FILE__, __LINE__), 0)))
00098 #else
00099 #define ASSERT(expr)  ((void)0)
00100 #endif
00101 
00102 
00103 //=== model time
00104 typedef double       simtime_t;
00105 #define MAXTIME      HUGE_VAL
00106 
00107 //=== backwards compatibility defines
00108 #define isA()          className()
00109 // cQueue:
00110 #define insertHead(a)  insert(a)
00111 #define peekTail()     tail()
00112 #define peekHead()     head()
00113 #define getTail()      pop()
00114 
00115 
00116 //=== memory mgmt functions for void* pointers
00117 //    (used by cLinkedList and cPar)
00118 
00124 typedef void (*VoidDelFunc)(void *);
00125 
00131 typedef void *(*VoidDupFunc)(void *);
00132 
00133 //=== used by cPar expressions
00134 
00140 typedef double (*MathFunc)(...);
00141 
00147 typedef double (*MathFuncNoArg)();
00148 
00154 typedef double (*MathFunc1Arg)(double);
00155 
00161 typedef double (*MathFunc2Args)(double,double);
00162 
00168 typedef double (*MathFunc3Args)(double,double,double);
00169 
00170 #endif
00171 

Generated at Sat May 4 15:45:49 2002 for OMNeT++ by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001