Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members  

cnetmod.h

00001 //=========================================================================
00002 //
00003 // CNETMOD.H - part of
00004 //                          OMNeT++
00005 //           Discrete System Simulation in C++
00006 //
00007 //   Written by:  Zoltan Vass, 1996
00008 //
00009 //   Contents:
00010 //      Declaration of class cNetMod:
00011 //            the interface module for distributed simulation.
00012 //
00013 //   Changes/rewrite:
00014 //      Andras Varga  Oct 14 1996 - Aug 1997
00015 //
00016 //=========================================================================
00017 
00018 /*--------------------------------------------------------------*
00019   Copyright (C) 1992-2001 Andras Varga
00020   Technical University of Budapest, Dept. of Telecommunications,
00021   Stoczek u.2, H-1111 Budapest, Hungary.
00022 
00023   This file is distributed WITHOUT ANY WARRANTY. See the file
00024   `license' for details on this and other legal matters.
00025 *--------------------------------------------------------------*/
00026 
00027 #ifndef __CNETMOD_H
00028 #define __CNETMOD_H
00029 
00030 #include "cmodule.h"
00031 
00032 class cSimulation;
00033 class cMessage;
00034 
00035 
00036 // is_started_as_master:
00037 //   called from envir to determine whether this is a master or slave
00038 SIM_API int is_started_as_master();
00039 
00040 //===========================================================================
00041 
00062 class SIM_API cNetMod : public cModule
00063 {
00064     friend class cSimulation;
00065 
00066   protected:
00067     int segments;
00068     cMessage *after_modinit_msg;
00069 
00070   public:
00073 
00077     cNetMod(const cNetMod& m) : cModule(m)
00078             {setName(m.name());after_modinit_msg=NULL;operator=(m);}
00079 
00083     cNetMod();
00084 
00088     virtual ~cNetMod() {}
00089 
00094     virtual cNetMod& operator=(const cNetMod& other);
00096 
00099 
00103     virtual const char *className() const {return "cNetMod";}
00104 
00109     virtual const char *inspectorFactoryName() const {return "cNetModIFC";}
00111 
00114 
00118     virtual bool isSimple() const {return false;}
00119 
00124     virtual void scheduleStart(simtime_t t) {}
00125 
00130     virtual void deleteModule() {}
00131 
00136     virtual bool callInitialize(int stage);
00137 
00142     virtual void callFinish();
00144 
00147 
00151     virtual const char *localhost()=0;
00152 
00158     int isLocalMachineIn(const cArray& m);
00160 
00163 
00167     virtual int net_addgate(cModule *mod, int gate, char tp) {return 0;}
00168 
00172     virtual cGate *ingate(int g)=0;
00173 
00177     virtual cGate *ingate(const char *s)=0;
00178 
00182     virtual int findingate(const char *s)=0;
00183 
00187     virtual cGate *outgate(int g)=0;
00188 
00192     virtual cGate *outgate(const char *s)=0;
00193 
00197     virtual int findoutgate(const char *s)=0;
00199 
00207 
00211     virtual void putmsg_onconsole(const char *s) = 0;
00212 
00216     virtual void puts_onconsole(const char *s) = 0;
00217 
00221     virtual bool gets_onconsole(const char *promptstr, char *buf, int len) = 0;
00222 
00226     virtual bool askyesno_onconsole(const char *question) = 0;
00228 
00231 
00235     virtual short start_segments(cArray& host_list, int ac, char *av[]) = 0;
00236 
00240     virtual void setup_connections()=0;
00241 
00245     virtual void clear() {gatev.clear();}
00246 
00250     virtual void stop_all_segments()=0;
00251 
00255     virtual void request_stopsimulation()=0;
00256 
00260     virtual int receive_runnumber() = 0;
00261 
00265     virtual void send_runnumber(int run_nr) = 0;
00267 
00270 
00274     virtual void restart() {}
00275 
00279     virtual void sync_after_modinits()=0; // sync before processing first 'real' event
00280 
00285     virtual void process_netmsgs()=0;
00286 
00292     virtual void process_netmsg_blocking()=0;
00293 
00297     virtual void send_syncpoint(simtime_t t, int gate) = 0;
00298 
00302     virtual void send_cancelsyncpoint(simtime_t t, int gate) = 0;
00303 
00307     virtual bool block_on_syncpoint(simtime_t t) = 0;
00309 };
00310 
00311 #endif
00312 
00313 

Generated at Sat May 4 15:45:48 2002 for OMNeT++ by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001