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-2003 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 nedc source!
00025 #define OMNETPP_VERSION 0x0203
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__) && defined(WIN32_DLL)
00036 #  define OPP_DLLIMPORT  __declspec(dllimport)
00037 #  define OPP_DLLEXPORT  __declspec(dllexport)
00038 #else
00039 #  define OPP_DLLIMPORT
00040 #  define OPP_DLLEXPORT
00041 #endif
00042 
00043 // SIM_API, ENVIR_API etc are also empty if not needed
00044 #ifdef BUILDING_SIM
00045 #  define SIM_API  OPP_DLLEXPORT
00046 #else
00047 #  define SIM_API  OPP_DLLIMPORT
00048 #endif
00049 
00050 // we need this because cenvir.h is in our directory
00051 #ifdef BUILDING_ENVIR
00052 #  define ENVIR_API  OPP_DLLEXPORT
00053 #else
00054 #  define ENVIR_API  OPP_DLLIMPORT
00055 #endif
00056 
00057 
00058 //=== NULL
00059 #ifndef NULL
00060 #define NULL ((void*)0)
00061 #endif
00062 
00063 // obsolete:
00064 // #define NO(cXX)   ((cXX *)NULL)
00065 
00066 //=== other common defines
00067 
00068 #ifndef PI
00069 #define PI        3.141592653589793
00070 #endif
00071 
00072 #ifndef Min
00073 #define Min(a,b)     ( (a)<(b) ? (a) : (b) )
00074 #define Max(a,b)     ( (a)>(b) ? (a) : (b) )
00075 #endif
00076 
00077 #define sgn(x)       ((x)==0 ? 0 : ((x)<0 ? -1 : 1))
00078 
00079 #ifndef NDEBUG
00080 #define ASSERT(expr)  \
00081   ((void) ((expr) ? 0 : \
00082            (opp_error("ASSERT: condition %s false, %s line %d", \
00083                              #expr, __FILE__, __LINE__), 0)))
00084 #else
00085 #define ASSERT(expr)  ((void)0)
00086 #endif
00087 
00088 
00092 typedef double       simtime_t;
00093 
00094 #define MAXTIME      HUGE_VAL
00095 
00096 
00097 //
00098 // backwards compatibility defines
00099 //
00100 #define isA()          className()
00101 // cQueue:
00102 #define insertHead(a)  insert(a)
00103 #define peekTail()     tail()
00104 #define peekHead()     head()
00105 #define getTail()      pop()
00106 // cSimulation
00107 #define lastModuleIndex() lastModuleId()
00108 
00109 // following ones became inner classes:
00110 #define cKSplitIterator       cKSplit::Iterator
00111 #define sGrid                 cKSplit::Grid
00112 #define cQueueIterator        cQueue::Iterator
00113 #define cLinkedListIterator   cLinkedList::Iterator
00114 #define sXElem                cPar::ExprElem
00115 #define cMessageHeapIterator  cMessageHeap::Iterator
00116 #define sTopoLink             cTopology::Link
00117 #define sTopoLinkIn           cTopology::LinkIn
00118 #define sTopoLinkOut          cTopology::LinkOut
00119 #define sTopoNode             cTopology::Node
00120 
00121 //
00122 // memory mgmt functions for void* pointers  (used by cLinkedList and cPar)
00123 //
00124 
00130 typedef void (*VoidDelFunc)(void *);
00131 
00137 typedef void *(*VoidDupFunc)(void *);
00138 
00139 //
00140 // used by cPar expressions
00141 //
00142 
00148 typedef double (*MathFunc)(...);
00149 
00155 typedef double (*MathFuncNoArg)();
00156 
00162 typedef double (*MathFunc1Arg)(double);
00163 
00169 typedef double (*MathFunc2Args)(double,double);
00170 
00176 typedef double (*MathFunc3Args)(double,double,double);
00177 
00183 typedef double (*MathFunc4Args)(double,double,double,double);
00184 
00185 #endif
00186 

Generated at Mon Jun 16 23:37:31 2003 for OMNeT++ by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001