cidealsimulationprot.h Source File

Parallel Simulation API: cidealsimulationprot.h Source File
Parallel Simulation API
cidealsimulationprot.h
1//=========================================================================
2// CIDEALSIMULATIONPROT.H - part of
3//
4// OMNeT++/OMNEST
5// Discrete System Simulation in C++
6//
7//=========================================================================
8
9/*--------------------------------------------------------------*
10 Copyright (C) 1992-2017 Andras Varga
11 Copyright (C) 2006-2017 OpenSim Ltd.
12
13 This file is distributed WITHOUT ANY WARRANTY. See the file
14 `license' for details on this and other legal matters.
15*--------------------------------------------------------------*/
16
17#ifndef __OMNETPP_CIDEALSIMULATIONPROT_H
18#define __OMNETPP_CIDEALSIMULATIONPROT_H
19
20#include "cparsimprotocolbase.h"
21
22namespace omnetpp {
23
24class cCommBuffer;
25
38{
39 public:
40 // stores one external event, as needed for the ISP algorithm
41 struct ExternalEvent {
42 simtime_t t; // time of event
43 int srcProcId; // origin of event
44 };
45
46 protected:
47 bool debug;
48 FILE *fin = nullptr; // the event log file
49 ExternalEvent nextExternalEvent; // holds the next event
50
51 // preloaded table of event times
52 ExternalEvent *table; // array to hold values
53 int tableSize; // allocated size of table
54 int numItems = 0; // num in items in table (numItems<tableSize possible)
55 int nextPos = 0; // position of 1st unused item in table
56
57 protected:
58 // process cMessages received from other partitions; see same method in2
59 // cISPEventLogger for more explanation
60 virtual void processReceivedMessage(cMessage *msg, const SendOptions& options, int destModuleId, int destGateId, int sourceProcId) override;
61
62 // read an event from event log file
63 virtual void readNextRecordedEvent();
64
65 public:
70
75
79 virtual void startRun() override;
80
84 virtual void endRun() override;
85
89 virtual cEvent *takeNextEvent() override;
90
94 virtual void putBackEvent(cEvent *event) override;
95};
96
97} // namespace omnetpp
98
99
100#endif
101
virtual void endRun() override
virtual cEvent * takeNextEvent() override
virtual void putBackEvent(cEvent *event) override
virtual void startRun() override
cParsimProtocolBase()
Definition cparsimprotocolbase.h:56