Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members

cidealsimulationprot.h

00001 //=========================================================================
00002 //  CIDEALSIMULATIONPROT.H - part of
00003 //
00004 //                  OMNeT++/OMNEST
00005 //           Discrete System Simulation in C++
00006 //
00007 //   Written by:  Andras Varga, 2003
00008 //
00009 //=========================================================================
00010 
00011 /*--------------------------------------------------------------*
00012   Copyright (C) 2003-2005 Andras Varga
00013   Monash University, Dept. of Electrical and Computer Systems Eng.
00014   Melbourne, Australia
00015 
00016   This file is distributed WITHOUT ANY WARRANTY. See the file
00017   `license' for details on this and other legal matters.
00018 *--------------------------------------------------------------*/
00019 
00020 #ifndef __CIDEALSIMULATIONPROT_H__
00021 #define __CIDEALSIMULATIONPROT_H__
00022 
00023 #include "cparsimprotocolbase.h"
00024 
00025 // forward declarations
00026 class cCommBuffer;
00027 
00039 class cIdealSimulationProtocol : public cParsimProtocolBase
00040 {
00041   protected:
00042     // stores one external event, as needed for the ISP algorithm
00043     struct ExternalEvent {
00044         simtime_t t;    // time of event
00045         int srcProcId;  // origin of event
00046     };
00047 
00048     bool debug;
00049     FILE *fin;  // the event log file
00050     ExternalEvent nextExternalEvent; // holds the next event
00051 
00052     // preloaded table of event times
00053     ExternalEvent *table; // array to hold values
00054     int tableSize;        // allocated size of table
00055     int numItems;         // num in items in table (numItems<tableSize possible)
00056     int nextPos;          // position of 1st unused item in table
00057 
00058   protected:
00059     // process cMessages received from other partitions
00060     virtual void processReceivedMessage(cMessage *msg, int destModuleId, int destGateId, int sourceProcId);
00061 
00062     // read an event from event log file
00063     virtual void readNextRecordedEvent();
00064 
00065     // helper function
00066     bool isExternalMessage(cMessage *msg);
00067 
00068   public:
00072     cIdealSimulationProtocol();
00073 
00077     virtual ~cIdealSimulationProtocol();
00078 
00082     virtual void startRun();
00083 
00087     virtual void endRun();
00088 
00092     virtual cMessage *getNextEvent();
00093 };
00094 
00095 #endif
00096 

Generated on Thu Jan 12 16:01:44 2006 for OMNeT++ Parallel Simulation Support by  doxygen 1.4.1