Statistics
| Branch: | Revision:

root / include / simkerneldefs.h @ 47c4b975

History | View | Annotate | Download (2.38 KB)

1 01873262 Georg Kunz
//==========================================================================
2
//  SIMKERNELDEFS.H - part of
3
//                     OMNeT++/OMNEST
4
//            Discrete System Simulation in C++
5
//
6
//
7
//  Defines of for the simulation kernel
8
//
9
//==========================================================================
10
11
/*--------------------------------------------------------------*
12
  Copyright (C) 1992-2008 Andras Varga
13
  Copyright (C) 2006-2008 OpenSim Ltd.
14

15
  This file is distributed WITHOUT ANY WARRANTY. See the file
16
  `license' for details on this and other legal matters.
17
*--------------------------------------------------------------*/
18
19
#ifndef __SIMKERNELDEFS_H
20
#define __SIMKERNELDEFS_H
21
22
#include <stddef.h>
23
#include <float.h>
24
#include <math.h>
25
#include "platdep/platdefs.h"
26
#include "platdep/intxtypes.h"
27
28
// OMNeT++ version -- must match NEDC_VERSION and MSGC_VERSION in nedxml
29
#define OMNETPP_VERSION 0x0401
30
31
#if defined(SIM_EXPORT)
32
#  define SIM_API OPP_DLLEXPORT
33
#elif defined(SIM_IMPORT) || defined(OMNETPPLIBS_IMPORT)
34
#  define SIM_API OPP_DLLIMPORT
35
#else
36
#  define SIM_API
37
#endif
38
39
// NULL
40
#ifndef NULL
41
#define NULL 0
42
#endif
43
44
//
45
// WITHOUT_CPACKET turns on a compatibility mode, where older models that use
46
// cMessage instead of cMessage for network packets can be compiled; this
47
// feature may make porting existing models to 4.0 easier.
48
//
49
#ifdef WITHOUT_CPACKET
50
#define cMessage cPacket
51
#endif
52
53
//
54
// other common defines
55
//
56
57
#ifndef PI
58
#define PI        3.141592653589793
59
#endif
60
61
#ifndef NDEBUG
62
#define ASSERT(expr) \
63
  ((void) ((expr) ? 0 : (opp_error("ASSERT: condition %s false in function %s, %s line %d", \
64
                                   #expr, __FUNCTION__, __FILE__, __LINE__), 0)))
65
#define ASSERT2(expr,text) \
66
  ((void) ((expr) ? 0 : (opp_error("ASSERT: %s in function %s, %s line %d", \
67
                                   text, __FUNCTION__, __FILE__, __LINE__), 0)))
68
#else
69
#define ASSERT(expr)        ((void)0)
70
#define ASSERT2(expr,text)  ((void)0)
71
#endif
72
73
74
typedef int64 eventnumber_t;
75
76
77
/**
78
 * Prototype for functions that are called by some objects (cMsgPar, cLinkedList)
79
 * to free up user-defined data structures.
80
 * @ingroup EnumsTypes
81
 */
82
typedef void (*VoidDelFunc)(void *);
83
84
/**
85
 * Prototype for functions that are called by some objects (cMsgPar, cLinkedList)
86
 * to duplicate user-defined data structures.
87
 * @ingroup EnumsTypes
88
 */
89
typedef void *(*VoidDupFunc)(void *);
90
91
92
#endif