cidealsimulationprot.h

00001 //=========================================================================
00002 //  CIDEALSIMULATIONPROT.H - part of
00003 //
00004 //                  OMNeT++/OMNEST
00005 //           Discrete System Simulation in C++
00006 //
00007 //  Author: Andras Varga, 2003
00008 //          Dept. of Electrical and Computer Systems Engineering,
00009 //          Monash University, Melbourne, Australia
00010 //
00011 //=========================================================================
00012 
00013 /*--------------------------------------------------------------*
00014   Copyright (C) 2003-2008 Andras Varga
00015   Copyright (C) 2006-2008 OpenSim Ltd.
00016 
00017   This file is distributed WITHOUT ANY WARRANTY. See the file
00018   `license' for details on this and other legal matters.
00019 *--------------------------------------------------------------*/
00020 
00021 #ifndef __CIDEALSIMULATIONPROT_H__
00022 #define __CIDEALSIMULATIONPROT_H__
00023 
00024 #include "cparsimprotocolbase.h"
00025 
00026 NAMESPACE_BEGIN
00027 
00028 // forward declarations
00029 class cCommBuffer;
00030 
00042 class SIM_API cIdealSimulationProtocol : public cParsimProtocolBase
00043 {
00044   public:
00045     // stores one external event, as needed for the ISP algorithm
00046     struct ExternalEvent {
00047         simtime_t t;    // time of event
00048         int srcProcId;  // origin of event
00049     };
00050 
00051   protected:
00052     bool debug;
00053     FILE *fin;  // the event log file
00054     ExternalEvent nextExternalEvent; // holds the next event
00055 
00056     // preloaded table of event times
00057     ExternalEvent *table; // array to hold values
00058     int tableSize;        // allocated size of table
00059     int numItems;         // num in items in table (numItems<tableSize possible)
00060     int nextPos;          // position of 1st unused item in table
00061 
00062   protected:
00063     // process cMessages received from other partitions; see same method in2
00064     // cISPEventLogger for more explanation
00065     virtual void processReceivedMessage(cMessage *msg, int destModuleId, int destGateId, int sourceProcId);
00066 
00067     // read an event from event log file
00068     virtual void readNextRecordedEvent();
00069 
00070   public:
00074     cIdealSimulationProtocol();
00075 
00079     virtual ~cIdealSimulationProtocol();
00080 
00084     virtual void startRun();
00085 
00089     virtual void endRun();
00090 
00094     virtual cMessage *getNextEvent();
00095 };
00096 
00097 NAMESPACE_END
00098 
00099 
00100 #endif
00101 
Generated on Tue Dec 2 11:16:32 2014 for OMNeT++ Parallel Simulation Support by  doxygen 1.6.3