00001 //========================================================================= 00002 // CFILECOMM.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 __CFILECOMM_H__ 00022 #define __CFILECOMM_H__ 00023 00024 #include "cparsimcomm.h" 00025 #include "simutil.h" 00026 00027 NAMESPACE_BEGIN 00028 00029 00039 class SIM_API cFileCommunications : public cParsimCommunications 00040 { 00041 protected: 00042 int numPartitions; 00043 int myProcId; 00044 00045 int seqNum; 00046 opp_string commDirPrefix; 00047 opp_string readDirPrefix; 00048 bool preserveReadFiles; 00049 00050 public: 00054 cFileCommunications(); 00055 00059 virtual ~cFileCommunications(); 00060 00066 virtual void init(); 00067 00071 virtual void shutdown(); 00072 00076 virtual int getNumPartitions() const; 00077 00081 virtual int getProcId() const; 00082 00086 virtual cCommBuffer *createCommBuffer(); 00087 00091 virtual void recycleCommBuffer(cCommBuffer *buffer); 00092 00096 virtual void send(cCommBuffer *buffer, int tag, int destination); 00097 00102 virtual bool receiveBlocking(int filtTag, cCommBuffer *buffer, int& receivedTag, int& sourceProcId); 00103 00109 virtual bool receiveNonblocking(int filtTag, cCommBuffer *buffer, int& receivedTag, int& sourceProcId); 00111 }; 00112 00113 NAMESPACE_END 00114 00115 00116 #endif 00117 00118