- Main Page
- Modules
- Classes
- Files
- Directories
- 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, and opp_msgc version!
    00025 #define OMNETPP_VERSION 0x0303
    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 // disable VC8.0 warnings on Unix syscalls
    00077 #ifdef _MSC_VER
    00078 #pragma warning(disable:4996)
    00079 #endif
    00080
    00081 //=== other common defines
    00082
    00083 #ifndef PI
    00084 #define PI        3.141592653589793
    00085 #endif
    00086
    00087 #ifndef Min
    00088 #define Min(a,b)     ( (a)<(b) ? (a) : (b) )
    00089 #define Max(a,b)     ( (a)>(b) ? (a) : (b) )
    00090 #endif
    00091
    00092 #define sgn(x)       ((x)==0 ? 0 : ((x)<0 ? -1 : 1))
    00093
    00094 // gcc 2.9x.x had broken exception handling
    00095 #ifdef __GNUC__
    00096 #  if  __GNUC__<3
    00097 #    error gcc 3.x required -- please upgrade
    00098 #  endif
    00099 #endif
    00100
    00101 #ifndef NDEBUG
    00102 #define ASSERT(expr)  \
    00103   ((void) ((expr) ? 0 : \
    00104            (opp_error("ASSERT: condition %s false, %s line %d", \
    00105                              #expr, __FILE__, __LINE__), 0)))
    00106 #else
    00107 #define ASSERT(expr)  ((void)0)
    00108 #endif
    00109
    00110
    00114 typedef double       simtime_t;
    00115
    00116 #define MAXTIME      HUGE_VAL
    00117
    00118
    00119 //
    00120 // memory mgmt functions for void* pointers  (used by cLinkedList and cPar)
    00121 //
    00122
    00128 typedef void (*VoidDelFunc)(void *);
    00129
    00135 typedef void *(*VoidDupFunc)(void *);
    00136
    00137 //
    00138 // used by cPar expressions
    00139 //
    00140
    00146 typedef double (*MathFunc)(...);
    00147
    00153 typedef double (*MathFuncNoArg)();
    00154
    00160 typedef double (*MathFunc1Arg)(double);
    00161
    00167 typedef double (*MathFunc2Args)(double,double);
    00168
    00174 typedef double (*MathFunc3Args)(double,double,double);
    00175
    00181 typedef double (*MathFunc4Args)(double,double,double,double);
    00182
    00183 #endif
    00184