www.pudn.com > adHocSimtest.rar > simple_n.cc, change:2004-05-27,size:8589b


//----------------------------------------- 
// 
// Generated by NEDC version 2.3 
// date:	Thu May 27 14:29:04 2004 
// 
// Input file:	simple.ned 
// Output file:	simple_n.cc 
//----------------------------------------- 
 
 
#include <math.h> 
#include "omnetpp.h" 
 
#define check_error() \ 
    {(void)0;} 
#define check_memory() \ 
    {if (memoryIsLow()) {throw new cException(eNOMEM); }} 
#define check_module_count(num, mod, parentmod) \ 
    {if ((int)num<=0) {throw new cException("Negative or zero module vector size %s[%d] in compound module %s", \ 
                          mod,(int)num,parentmod);}} 
#define check_gate_count(num, mod, gate, parentmod) \ 
    {if ((int)num<0) {throw new cException("Negative gate vector size %s.%s[%d] in compound module %s", \ 
                          mod,gate,(int)num,parentmod);}} 
#define check_loop_bounds(lower, upper, parentmod) \ 
    {if ((int)lower<0) \ 
        {throw new cException("Bad loop bounds (%d..%d) in compound module %s", \ 
                 (int)lower,(int)upper,parentmod);}} 
#define check_module_index(index,modvar,modname,parentmod) \ 
    {if (index<0 || index>=modvar[0]->size()) {throw new cException("Bad submodule index %s[%d] in compound module %s", \ 
          modname,(int)index,parentmod);}} 
#define check_channel_params(delay, err, channel) \ 
    {if ((double)delay<0.0) \ 
        {throw new cException("Negative delay value %lf in channel %s",(double)delay,channel);} \ 
     if ((double)err<0.0 || (double)err>1.0) \ 
        {throw new cException("Incorrect error value %lf in channel %s",(double)err,channel);}} 
#define check_modtype(modtype, modname) \ 
    {if ((modtype)==NULL) {throw new cException("Simple module type definition %s not found", \ 
                                     modname);}} 
#define check_function(funcptr, funcname) \ 
    {if ((funcptr)==NULL) {throw new cException("Function %s not found", \ 
                                     funcname);}} 
#define check_function_retnull(funcptr, funcname) \ 
    {if ((funcptr)==NULL) {throw new cException("Function %s not found", \ 
                                     funcname);return NULL;}} 
#define check_gate(gateindex, modname, gatename) \ 
    {if ((int)gateindex==-1) {throw new cException("Gate %s.%s not found",modname,gatename);}} 
#define check_anc_param(ptr,parname,compoundmod) \ 
    {if ((ptr)==NULL) {throw new cException("Unknown ancestor parameter named %s in compound module %s", \ 
                                parname,compoundmod);}} 
#define check_param(ptr,parname) \ 
    {if ((ptr)==NULL) {throw new cException("Unknown parameter named %s", \ 
                                parname);}} 
#ifndef __cplusplus 
#  error Compile as C++! 
#endif 
#ifdef __BORLANDC__ 
#  if !defined(__FLAT__) && !defined(__LARGE__) 
#    error Compile as 16-bit LARGE model or 32-bit DPMI! 
#  endif 
#endif 
 
// Disable warnings about unused variables: 
#ifdef _MSC_VER 
#  pragma warning(disable:4101) 
#endif 
#ifdef __BORLANDC__ 
#  pragma warn -waus 
#  pragma warn -wuse 
#endif 
// for GCC, seemingly there's no way to emulate the -Wunused command-line 
// flag from a source file... 
 
// Version check 
#define NEDC_VERSION 0x0203 
#if (NEDC_VERSION!=OMNETPP_VERSION) 
#    error Version mismatch! Probably this file was generated by an earlier version of nedc: 'make clean' should help. 
#endif 
 
//-------------------------------------------- 
// Following code generated from: simple.ned 
//-------------------------------------------- 
 
ModuleInterface( Mobility ) 
	Machine( default ) 
	Parameter( minSpeed, ParType_Numeric ) 
	Parameter( maxSpeed, ParType_Numeric ) 
	Parameter( movKind, ParType_Numeric ) 
	Parameter( XRange, ParType_Numeric ) 
	Parameter( YRange, ParType_Numeric ) 
	Parameter( pauseTime, ParType_Numeric ) 
	Parameter( moveInterval, ParType_Numeric ) 
	Parameter( distance, ParType_Numeric ) 
	Parameter( target, ParType_Numeric ) 
	Parameter( speedVariator, ParType_Numeric ) 
	Gate( out, GateDir_Output ) 
EndInterface 
 
Register_ModuleInterface( Mobility ) 
 
// class Mobility : public cSimpleModule 
// { 
//     Module_Class_Members(Mobility,cSimpleModule,8192) 
//     virtual void activity(); 
//     // Add you own member functions here! 
// }; 
// 
// Define_Module( Mobility ) 
// 
// void Mobility::activity() 
// { 
//     // Put code for simple module activity here! 
// } 
// 
 
ModuleInterface( Physic ) 
	Machine( default ) 
	Parameter( txPower, ParType_Numeric ) 
	Parameter( rxThreshold, ParType_Numeric ) 
	Gate( fromMobility, GateDir_Input ) 
	Gate( fromMac, GateDir_Input ) 
	Gate( toMac, GateDir_Output ) 
EndInterface 
 
Register_ModuleInterface( Physic ) 
 
// class Physic : public cSimpleModule 
// { 
//     Module_Class_Members(Physic,cSimpleModule,8192) 
//     virtual void activity(); 
//     // Add you own member functions here! 
// }; 
// 
// Define_Module( Physic ) 
// 
// void Physic::activity() 
// { 
//     // Put code for simple module activity here! 
// } 
// 
 
ModuleInterface( Mac ) 
	Machine( default ) 
	Parameter( inBufferSize, ParType_Numeric ) 
	Parameter( promisqueMode, ParType_Bool ) 
	Gate( fromPh, GateDir_Input ) 
	Gate( fromRoute, GateDir_Input ) 
	Gate( toRoute, GateDir_Output ) 
	Gate( toPh, GateDir_Output ) 
EndInterface 
 
Register_ModuleInterface( Mac ) 
 
// class Mac : public cSimpleModule 
// { 
//     Module_Class_Members(Mac,cSimpleModule,8192) 
//     virtual void activity(); 
//     // Add you own member functions here! 
// }; 
// 
// Define_Module( Mac ) 
// 
// void Mac::activity() 
// { 
//     // Put code for simple module activity here! 
// } 
// 
 
ModuleInterface( Application ) 
	Machine( default ) 
	Parameter( rate, ParType_Numeric ) 
	Parameter( pktSize, ParType_Numeric ) 
	Parameter( hostNum, ParType_Numeric ) 
	Parameter( active, ParType_Numeric ) 
	Parameter( burstInterval, ParType_Numeric ) 
	Gate( out, GateDir_Output ) 
EndInterface 
 
Register_ModuleInterface( Application ) 
 
// class Application : public cSimpleModule 
// { 
//     Module_Class_Members(Application,cSimpleModule,8192) 
//     virtual void activity(); 
//     // Add you own member functions here! 
// }; 
// 
// Define_Module( Application ) 
// 
// void Application::activity() 
// { 
//     // Put code for simple module activity here! 
// } 
// 
 
ModuleInterface( Routing ) 
	Machine( default ) 
	Gate( fromMac, GateDir_Input ) 
	Gate( fromApp, GateDir_Input ) 
	Gate( toMac, GateDir_Output ) 
EndInterface 
 
Register_ModuleInterface( Routing ) 
 
// class Routing : public cSimpleModule 
// { 
//     Module_Class_Members(Routing,cSimpleModule,8192) 
//     virtual void activity(); 
//     // Add you own member functions here! 
// }; 
// 
// Define_Module( Routing ) 
// 
// void Routing::activity() 
// { 
//     // Put code for simple module activity here! 
// } 
// 
 
//------------------------------------- 
// channel definition: etere 
//------------------------------------- 
 
static cPar *etere__delay() 
{ 
	// temporary variables: 
	cPar value, *par; 
	cPar::ExprElem *expr_tab; int k; 
	cFunctionType *functype; 
	const char *type_name; 
	char b1[64], b2[64]; 
	cArray machines; 
	bool islocal, do_this_block; 
	int n; 
 
	cPar *p = new cPar("etere delay"); 
	*p = 0.0001; 
	return p; 
} 
 
static cPar *etere__error() 
{ 
	// temporary variables: 
	cPar value, *par; 
	cPar::ExprElem *expr_tab; int k; 
	cFunctionType *functype; 
	const char *type_name; 
	char b1[64], b2[64]; 
	cArray machines; 
	bool islocal, do_this_block; 
	int n; 
 
	cPar *p = new cPar("etere error"); 
	*p = 0.000001; 
	return p; 
} 
 
static cPar *etere__datarate() 
{ 
	// temporary variables: 
	cPar value, *par; 
	cPar::ExprElem *expr_tab; int k; 
	cFunctionType *functype; 
	const char *type_name; 
	char b1[64], b2[64]; 
	cArray machines; 
	bool islocal, do_this_block; 
	int n; 
 
	cPar *p = new cPar("etere datarate"); 
	*p = 11.04858e+6; 
	return p; 
} 
 
Define_Link( etere, etere__delay, etere__error, etere__datarate); 
 
ModuleInterface( Inspector ) 
	Machine( default ) 
	Parameter( snapshotInterval, ParType_Numeric ) 
	Parameter( active, ParType_Numeric ) 
	Parameter( fileName, ParType_String ) 
EndInterface 
 
Register_ModuleInterface( Inspector ) 
 
// class Inspector : public cSimpleModule 
// { 
//     Module_Class_Members(Inspector,cSimpleModule,8192) 
//     virtual void activity(); 
//     // Add you own member functions here! 
// }; 
// 
// Define_Module( Inspector ) 
// 
// void Inspector::activity() 
// { 
//     // Put code for simple module activity here! 
// } 
//