studies/performance/Performance-Code5/generator_n.cpp
⇒
download file
1
2
3
4
5
6
7
8
9
10
11 #include <math.h>
12 #include "omnetpp.h"
13
14 #define check_error() \
15 {(void)0;}
16 #define check_memory() \
17 {if (memoryIsLow()) {throw new cException(eNOMEM); }}
18 #define check_module_count(num, mod, parentmod) \
19 {if ((int)num<=0) {throw new cException("Negative or zero module vector size %s[%d] in compound module %s", ===>\<===
20 mod,(int)num,parentmod);}}
21 #define check_gate_count(num, mod, gate, parentmod) \
22 {if ((int)num<0) {throw new cException("Negative gate vector size %s.%s[%d] in compound module %s", ===>\<===
23 mod,gate,(int)num,parentmod);}}
24 #define check_loop_bounds(lower, upper, parentmod) \
25 {if ((int)lower<0) ===>\<===
26 {throw new cException("Bad loop bounds (%d..%d) in compound module %s", ===>\<===
27 (int)lower,(int)upper,parentmod);}}
28 #define check_module_index(index,modvar,modname,parentmod) \
29 {if (index<0 || index>=modvar[0]->size()) {throw new cException("Bad submodule index %s[%d] in compound module %s", ===>\<===
30 modname,(int)index,parentmod);}}
31 #define check_channel_params(delay, err, channel) \
32 {if ((double)delay<0.0) ===>\<===
33 {throw new cException("Negative delay value %lf in channel %s",(double)delay,channel);} ===>\<===
34 if ((double)err<0.0 || (double)err>1.0) ===>\<===
35 {throw new cException("Incorrect error value %lf in channel %s",(double)err,channel);}}
36 #define check_modtype(modtype, modname) \
37 {if ((modtype)==NULL) {throw new cException("Simple module type definition %s not found", ===>\<===
38 modname);}}
39 #define check_function(funcptr, funcname) \
40 {if ((funcptr)==NULL) {throw new cException("Function %s not found", ===>\<===
41 funcname);}}
42 #define check_function_retnull(funcptr, funcname) \
43 {if ((funcptr)==NULL) {throw new cException("Function %s not found", ===>\<===
44 funcname);return NULL;}}
45 #define check_gate(gateindex, modname, gatename) \
46 {if ((int)gateindex==-1) {throw new cException("Gate %s.%s not found",modname,gatename);}}
47 #define check_anc_param(ptr,parname,compoundmod) \
48 {if ((ptr)==NULL) {throw new cException("Unknown ancestor parameter named %s in compound module %s", ===>\<===
49 parname,compoundmod);}}
50 #define check_param(ptr,parname) \
51 {if ((ptr)==NULL) {throw new cException("Unknown parameter named %s", ===>\<===
52 parname);}}
53 #ifndef __cplusplus
54 # error Compile as C++!
55 #endif
56 #ifdef __BORLANDC__
57 # if !defined(__FLAT__) && !defined(__LARGE__)
58 # error Compile as 16-bit LARGE model or 32-bit DPMI!
59 # endif
60 #endif
61
62
63 #ifdef _MSC_VER
64 # pragma warning(disable:4101)
65 #endif
66 #ifdef __BORLANDC__
67 # pragma warn -waus
68 # pragma warn -wuse
69 #endif
70
71
72
73
74 #define NEDC_VERSION 0x0203
75 #if (NEDC_VERSION!=OMNETPP_VERSION)
76 # error Version mismatch! Probably this file was generated by an earlier version of nedc: 'make clean' should help.
77 #endif
78
79
80
81
82
83 ModuleInterface( Generator )
84 Machine( default )
85 Parameter( rate, ParType_Numeric ParType_Const )
86 Parameter( random_generator, ParType_Numeric ParType_Const )
87 Gate( out, GateDir_Output )
88 EndInterface
89 Register_ModuleInterface( Generator )
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107