- Main Page
- Modules
- Classes
- Files
- Directories

# 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   public:
    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   protected:
    00049     bool debug;
    00050     FILE *fin;  // the event log file
    00051     ExternalEvent nextExternalEvent; // holds the next event
    00052
    00053     // preloaded table of event times
    00054     ExternalEvent *table; // array to hold values
    00055     int tableSize;        // allocated size of table
    00056     int numItems;         // num in items in table (numItems<tableSize possible)
    00057     int nextPos;          // position of 1st unused item in table
    00058
    00059   protected:
    00060     // process cMessages received from other partitions; see same method in2
    00061     // cISPEventLogger for more explanation
    00062     virtual void processReceivedMessage(cMessage *msg, int destModuleId, int destGateId, int sourceProcId);
    00063
    00064     // read an event from event log file
    00065     virtual void readNextRecordedEvent();
    00066
    00067   public:
    00071     cIdealSimulationProtocol();
    00072
    00076     virtual ~cIdealSimulationProtocol();
    00077
    00081     virtual void startRun();
    00082
    00086     virtual void endRun();
    00087
    00091     virtual cMessage *getNextEvent();
    00092 };
    00093
    00094 #endif
    00095