Академический Документы
Профессиональный Документы
Культура Документы
com Page 1 of 5
1
2 // This code is done by Nailah Madi
3 // Copyright (C) 2011 Nailah Madi
4 //
5 // Nailah AlMadi
6 // Computer Science Dept.
7 // North Dakota State University
8 //
9 // nailah.almadi@my.ndsu.edu
10 //
11 //
12 // This program is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation, either version 3 of the License, any
15 // later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program. If not, see <http://www.gnu.org/licenses/>.
24 //
25
26
27
//-----------------------------------------
28
//
29
// Generated by nedtool, version 3.3
30
// date: Sun Dec 28 22:19:10 2008
31
//
32
//-----------------------------------------
33
34
35
#include <math.h>
36
#include "omnetpp.h"
37
38
// NEDC version check
39
#define NEDC_VERSION 0x0303
40
#if (NEDC_VERSION!=OMNETPP_VERSION)
# error Version mismatch! Probably this file was generated by an earlier version of nedc: 'make clean' should help.
41
#endif
42
43
// Disable warnings about unused variables. For MSVC and BC only:
44
// GCC has no way to turn on its -Wunused option in a source file :(
45
#ifdef _MSC_VER
46
# pragma warning(disable:4101)
47
48 #endif
49 #ifdef __BORLANDC__
50 # pragma warn -waus
51 # pragma warn -wuse
52 #endif
53
54 static cModuleType *_getModuleType(const char *modname)
55 {
56
57 cModuleType *modtype = findModuleType(modname);
58 if (!modtype)
throw new cRuntimeError("Module type definition %s not found (Define_Module() missing from C++ code?)",
modname); 0.0 1 point PEGASIS Protocol in Omnet++.ra Favorite Share
Please input your comme Submit
59
http://www.codeforge.com/read/251393/node_n.cc__html 11/1/2017
node_n.cc - Free Open Source Codes - CodeForge.com Page 2 of 5
60 return modtype;
61
62
}
63
64
static void _checkModuleVectorSize(int vectorsize, const char *mod)
65
{
66
67
68 if (vectorsize<0)
69 throw new cRuntimeError("Negative module vector size %s[%d]", mod, vectorsize);
70
71 }
72
73 static void _readModuleParameters(cModule *mod)
74 {
75
76 int n = mod->params();
77 for (int k=0; k<n; k++)
78 if (mod->par(k).isInput())
79 mod->par(k).read();
80
81 }
82
83 static int _checkModuleIndex(int index, int vectorsize, const char *modname)
84 {
85
if (index<0 || index>=vectorsize)
86 throw new cRuntimeError("Submodule index %s[%d] out of range, sizeof(%s) is %d", modname, index, modname,
87 vectorsize);
88 return index;
89
90 }
91
92 static cGate *_checkGate(cModule *mod, const char *gatename)
93 {
94
95 cGate *g = mod->gate(gatename);
96 if (!g)
97 throw new cRuntimeError("%s has no gate named %s",mod->fullPath().c_str(), gatename);
98 return g;
99
100 }
101
102 static cGate *_checkGate(cModule *mod, const char *gatename, int gateindex)
103 {
104
105 cGate *g = mod->gate(gatename, gateindex);
106 if (!g)
107 throw new cRuntimeError("%s has no gate %s[%d]",mod->fullPath().c_str(), gatename, gateindex);
108 return g;
109
110 }
111
112 static cGate *_getFirstUnusedParentModGate(cModule *mod, const char *gatename)
113 {
114
115 int baseId = mod->findGate(gatename);
116 if (baseId<0)
117 throw new cRuntimeError("%s has no %s[] gate",mod->fullPath().c_str(), gatename);
118 int n = mod->gate(baseId)->size();
119 for (int i=0; i<n; i++)
120 if (!mod->gate(baseId+i)->isConnectedInside())
return mod->gate(baseId+i);
121 throw new cRuntimeError("%s[] gates are all connected, no gate left for `++' operator",mod->fullPath().c_str(),
122 gatename);
123
124 }
125
126 static cGate *_getFirstUnusedSubmodGate(cModule *mod, const char *gatename)
127 {
128
129 int baseId = mod->findGate(gatename);
130 if (baseId<0)
131 throw new cRuntimeError("%s has no %s[] gate",mod->fullPath().c_str(), gatename);
132 int n = mod->gate(baseId)->size();
0.0 1 point PEGASIS Protocol in Omnet++.ra Favorite Share
133 input your comme Submit
Please
http://www.codeforge.com/read/251393/node_n.cc__html 11/1/2017
node_n.cc - Free Open Source Codes - CodeForge.com Page 3 of 5
http://www.codeforge.com/read/251393/node_n.cc__html 11/1/2017
node_n.cc - Free Open Source Codes - CodeForge.com Page 4 of 5
208
209 };
210 //
211 // Define_Module(Node);
212 //
213 // void Node::activity()
214 // {
215
216 // // Put code for simple module activity here!
//
}
//
Download
Sponsored links
File list Tips: You can preview the content of files by clicking file names^_^
1 2
Sponsored links
http://www.codeforge.com/read/251393/node_n.cc__html 11/1/2017
node_n.cc - Free Open Source Codes - CodeForge.com Page 5 of 5
Elapsed:40.698ms 5.199
http://www.codeforge.com/read/251393/node_n.cc__html 11/1/2017