OMNeT++ Parallel Simulation Support 6.1
Discrete Event Simulation Library
cfilecomm.h
1 //=========================================================================
2 // CFILECOMM.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_CFILECOMM_H
18 #define __OMNETPP_CFILECOMM_H
19 
20 #include "omnetpp/cparsimcomm.h"
21 #include "omnetpp/simutil.h"
22 
23 namespace omnetpp {
24 
25 
35 class SIM_API cFileCommunications : public cParsimCommunications
36 {
37  protected:
38  int numPartitions;
39  int myProcId;
40 
41  int seqNum = 0;
42  opp_string commDirPrefix;
43  opp_string readDirPrefix;
44  bool preserveReadFiles;
45 
46  public:
51 
55  virtual ~cFileCommunications() {}
56 
62  virtual void init(int numPartitions) override;
63 
67  virtual void shutdown() override;
68 
72  virtual int getNumPartitions() const override;
73 
77  virtual int getProcId() const override;
78 
82  virtual cCommBuffer *createCommBuffer() override;
83 
87  virtual void recycleCommBuffer(cCommBuffer *buffer) override;
88 
92  virtual void send(cCommBuffer *buffer, int tag, int destination) override;
93 
98  virtual bool receiveBlocking(int filtTag, cCommBuffer *buffer, int& receivedTag, int& sourceProcId) override;
99 
105  virtual bool receiveNonblocking(int filtTag, cCommBuffer *buffer, int& receivedTag, int& sourceProcId) override;
107 };
108 
109 } // namespace omnetpp
110 
111 
112 #endif
113 
114 
omnetpp::cFileCommunications
Implementation of the communications layer which works via files. Every message is created as a file ...
Definition: cfilecomm.h:35
omnetpp::cFileCommunications::~cFileCommunications
virtual ~cFileCommunications()
Definition: cfilecomm.h:55