OMNeT++ Parallel Simulation Support  5.4.1
cidealsimulationprot.h
1 //=========================================================================
2 // CIDEALSIMULATIONPROT.H - part of
3 //
4 // OMNeT++/OMNEST
5 // Discrete System Simulation in C++
6 //
7 // Author: Andras Varga, 2003
8 // Dept. of Electrical and Computer Systems Engineering,
9 // Monash University, Melbourne, Australia
10 //
11 //=========================================================================
12 
13 /*--------------------------------------------------------------*
14  Copyright (C) 2003-2017 Andras Varga
15  Copyright (C) 2006-2017 OpenSim Ltd.
16 
17  This file is distributed WITHOUT ANY WARRANTY. See the file
18  `license' for details on this and other legal matters.
19 *--------------------------------------------------------------*/
20 
21 #ifndef __OMNETPP_CIDEALSIMULATIONPROT_H
22 #define __OMNETPP_CIDEALSIMULATIONPROT_H
23 
24 #include "cparsimprotocolbase.h"
25 
26 namespace omnetpp {
27 
28 class cCommBuffer;
29 
42 {
43  public:
44  // stores one external event, as needed for the ISP algorithm
45  struct ExternalEvent {
46  simtime_t t; // time of event
47  int srcProcId; // origin of event
48  };
49 
50  protected:
51  bool debug;
52  FILE *fin; // the event log file
53  ExternalEvent nextExternalEvent; // holds the next event
54 
55  // preloaded table of event times
56  ExternalEvent *table; // array to hold values
57  int tableSize; // allocated size of table
58  int numItems; // num in items in table (numItems<tableSize possible)
59  int nextPos; // position of 1st unused item in table
60 
61  protected:
62  // process cMessages received from other partitions; see same method in2
63  // cISPEventLogger for more explanation
64  virtual void processReceivedMessage(cMessage *msg, int destModuleId, int destGateId, int sourceProcId) override;
65 
66  // read an event from event log file
67  virtual void readNextRecordedEvent();
68 
69  public:
74 
78  virtual ~cIdealSimulationProtocol();
79 
83  virtual void startRun() override;
84 
88  virtual void endRun() override;
89 
93  virtual cEvent *takeNextEvent() override;
94 
98  virtual void putBackEvent(cEvent *event) override;
99 };
100 
101 } // namespace omnetpp
102 
103 
104 #endif
105 
SimTime simtime_t
Implements the Ideal Simulation Protocol, described in the paper "Performance Evaluation of Conservat...
Definition: cidealsimulationprot.h:41
Definition: cadvlinkdelaylookahead.h:26
Contains utility functions for implementing parallel simulation protocols.
Definition: cparsimprotocolbase.h:36