Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

EtherAppCli_n.cc

Go to the documentation of this file.
00001 //-----------------------------------------
00002 //
00003 // Generated by nedtool, version 3.0a3
00004 // date: Thu May 13 22:19:38 2004
00005 //
00006 //-----------------------------------------
00007 
00008 
00009 #include <math.h>
00010 #include "omnetpp.h"
00011 
00012 // NEDC version check
00013 #define NEDC_VERSION 0x02F1
00014 #if (NEDC_VERSION!=OMNETPP_VERSION)
00015 #    error Version mismatch! Probably this file was generated by an earlier version of nedc: 'make clean' should help.
00016 #endif
00017 
00018 // Disable warnings about unused variables. For MSVC and BC only:
00019 // GCC has no way to turn on its -Wunused option in a source file :(
00020 #ifdef _MSC_VER
00021 #  pragma warning(disable:4101)
00022 #endif
00023 #ifdef __BORLANDC__
00024 #  pragma warn -waus
00025 #  pragma warn -wuse
00026 #endif
00027 
00028 static cModuleType *_getModuleType(const char *modname)
00029 {
00030     cModuleType *modtype = findModuleType(modname);
00031     if (!modtype)
00032         throw new cException("Module type definition %s not found (Define_Module() missing from C++ code?)", modname);
00033     return modtype;
00034 }
00035 
00036 static void _checkModuleVectorSize(int vectorsize, const char *mod)
00037 {
00038     if (vectorsize<0)
00039         throw new cException("Negative module vector size %s[%d]", mod, vectorsize);
00040 }
00041 
00042 static void _readModuleParameters(cModule *mod)
00043 {
00044     int n = mod->params();
00045     for (int k=0; k<n; k++)
00046         if (mod->par(k).isInput())
00047             mod->par(k).read();
00048 }
00049 
00050 static int _checkModuleIndex(int index, int vectorsize, const char *modname)
00051 {
00052     if (index<0 || index>=vectorsize)
00053         throw new cException("Submodule index %s[%d] out of range, sizeof(%s) is %d", modname, index, modname, vectorsize);
00054     return index;
00055 }
00056 
00057 static cGate *_checkGate(cModule *mod, const char *gatename)
00058 {
00059     cGate *g = mod->gate(gatename);
00060     if (!g)
00061         throw new cException("%s has no gate named %s",mod->fullPath(), gatename);
00062     return g;
00063 }
00064 
00065 static cGate *_checkGate(cModule *mod, const char *gatename, int gateindex)
00066 {
00067     cGate *g = mod->gate(gatename, gateindex);
00068     if (!g)
00069         throw new cException("%s has no gate %s[%d]",mod->fullPath(), gatename, gateindex);
00070     return g;
00071 }
00072 
00073 static cGate *_getFirstUnusedParentModGate(cModule *mod, const char *gatename)
00074 {
00075     int baseId = mod->findGate(gatename);
00076     if (baseId<0)
00077         throw new cException("%s has no %s[] gate",mod->fullPath(), gatename);
00078     int n = mod->gate(baseId)->size();
00079     for (int i=0; i<n; i++)
00080         if (!mod->gate(baseId+i)->isConnectedInside())
00081             return mod->gate(baseId+i);
00082     throw new cException("%s[] gates are all connected, no gate left for `++' operator",mod->fullPath(), gatename);
00083 }
00084 
00085 static cGate *_getFirstUnusedSubmodGate(cModule *mod, const char *gatename)
00086 {
00087     int baseId = mod->findGate(gatename);
00088     if (baseId<0)
00089         throw new cException("%s has no %s[] gate",mod->fullPath(), gatename);
00090     int n = mod->gate(baseId)->size();
00091     for (int i=0; i<n; i++)
00092         if (!mod->gate(baseId+i)->isConnectedOutside())
00093             return mod->gate(baseId+i);
00094     int newBaseId = mod->setGateSize(gatename,n+1);
00095     return mod->gate(newBaseId+n);
00096 }
00097 
00098 static cFunctionType *_getFunction(const char *funcname, int argcount)
00099 {
00100     cFunctionType *functype = findFunction(funcname,argcount);
00101     if (!functype)
00102         throw new cException("Function %s with %d args not found", funcname, argcount);
00103     return functype;
00104 }
00105 
00106 static cChannel *_createChannel(const char *channeltypename)
00107 {
00108     cChannelType *channeltype = findChannelType(channeltypename);
00109     if (!channeltype)
00110         throw new cException("Channel type %s not found", channeltypename);
00111     cChannel *channel = channeltype->create("channel");
00112     return channel;
00113 }
00114 
00115 static cChannel *_createNonTypedSimpleChannel(double delay, double error, double datarate)
00116 {
00117     cSimpleChannel *channel = new cSimpleChannel("channel");
00118     if (delay!=0) channel->setDelay(delay);
00119     if (error!=0) channel->setError(error);
00120     if (datarate!=0) channel->setDatarate(datarate);
00121     return channel;
00122 }
00123 
00124 ModuleInterface(EtherAppCli)
00125     // parameters:
00126     Parameter(destStation, ParType_Any)
00127     Parameter(destAddress, ParType_Any)
00128     Parameter(waitTime, ParType_Any)
00129     Parameter(reqLength, ParType_Any)
00130     Parameter(respLength, ParType_Any)
00131     Parameter(writeScalars, ParType_Any)
00132     // gates:
00133     Gate(in, GateDir_Input)
00134     Gate(out, GateDir_Output)
00135 EndInterface
00136 
00137 Register_ModuleInterface(EtherAppCli)
00138 
00139 
00140 // class EtherAppCli : public cSimpleModule
00141 // {
00142 //     Module_Class_Members(EtherAppCli,cSimpleModule,16384)
00143 //     virtual void activity();
00144 //     // Add you own member functions here!
00145 // };
00146 //
00147 // Define_Module(EtherAppCli);
00148 //
00149 // void EtherAppCli::activity()
00150 // {
00151 //     // Put code for simple module activity here!
00152 // }
00153 //
00154 

Generated on Sat May 15 20:30:42 2004 for Ethernet by doxygen1.2.17