Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __INET_INETDEFS_H
00019 #define __INET_INETDEFS_H
00020
00021
00022
00023
00024
00025
00026 #include <omnetpp.h>
00027
00028 #if OMNETPP_VERSION < 0x0400
00029 # error At least OMNeT++/OMNEST version 4.0 required
00030 #endif
00031
00032 #if defined(INET_EXPORT)
00033 # define INET_API OPP_DLLEXPORT
00034 #elif defined(INET_IMPORT)
00035 # define INET_API OPP_DLLIMPORT
00036 #else
00037 # define INET_API
00038 #endif
00039
00040 typedef unsigned short ushort;
00041 typedef unsigned int uint;
00042 typedef unsigned long ulong;
00043
00044
00045
00046
00047
00048
00049 #define EV ev.isDisabled()?ev:ev
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 template <class T>
00061 T *__checknull(T *p, const char *expr, const char *file, int line)
00062 {
00063 if (!p)
00064 opp_error("Expression %s returned NULL at %s:%d",expr,file,line);
00065 return p;
00066 }
00067 #define CHK(x) __checknull((x), #x, __FILE__, __LINE__)
00068
00069
00070 #define PK(msg) check_and_cast<cPacket *>(msg)
00071
00072
00073 #ifdef _MSC_VER
00074
00075
00076
00077
00078
00079
00080
00081
00082 static double erfc(double x)
00083 {
00084 double t, u, y;
00085
00086 if (x <= -6)
00087 return 2;
00088 if (x >= 6)
00089 return 0;
00090
00091 t = 3.97886080735226 / (fabs(x) + 3.97886080735226);
00092 u = t - 0.5;
00093 y = (((((((((0.00127109764952614092 * u + 1.19314022838340944e-4) * u -
00094 0.003963850973605135) * u - 8.70779635317295828e-4) * u +
00095 0.00773672528313526668) * u + 0.00383335126264887303) * u -
00096 0.0127223813782122755) * u - 0.0133823644533460069) * u +
00097 0.0161315329733252248) * u + 0.0390976845588484035) * u +
00098 0.00249367200053503304;
00099 y = ((((((((((((y * u - 0.0838864557023001992) * u -
00100 0.119463959964325415) * u + 0.0166207924969367356) * u +
00101 0.357524274449531043) * u + 0.805276408752910567) * u +
00102 1.18902982909273333) * u + 1.37040217682338167) * u +
00103 1.31314653831023098) * u + 1.07925515155856677) * u +
00104 0.774368199119538609) * u + 0.490165080585318424) * u +
00105 0.275374741597376782) * t * exp(-x * x);
00106
00107 return x < 0 ? 2 - y : y;
00108 }
00109 #endif
00110
00111 #endif