# cparsimcomm.h

    00001 //=========================================================================
    00002 //  CPARSIMCOMM.H - part of
    00003 //
    00004 //                  OMNeT++/OMNEST
    00005 //           Discrete System Simulation in C++
    00006 //
    00007 //   Written by:  Andras Varga, 2003
    00008 //
    00009 //=========================================================================
    00010
    00011 /*--------------------------------------------------------------*
    00012   Copyright (C) 2003-2005 Andras Varga
    00013   Monash University, Dept. of Electrical and Computer Systems Eng.
    00014   Melbourne, Australia
    00015
    00016   This file is distributed WITHOUT ANY WARRANTY. See the file
    00017   `license' for details on this and other legal matters.
    00018 *--------------------------------------------------------------*/
    00019
    00020
    00021 #ifndef __CPARSIMCOMM_H__
    00022 #define __CPARSIMCOMM_H__
    00023
    00024 #include "cpolymorphic.h"
    00025
    00026 // forward declaration:
    00027 class cCommBuffer;
    00028
    00029 #define PARSIM_ANY_TAG  -1
    00030
    00031
    00038 #define MAX_PARSIM_PARTITIONS  255   // because srcprocid in cMessage is 8-bit
    00039
    00040
    00051 class SIM_API cParsimCommunications : public cPolymorphic
    00052 {
    00053   public:
    00057     virtual ~cParsimCommunications() {}
    00058
    00070     virtual void init() = 0;
    00071
    00075     virtual void shutdown() = 0;
    00077
    00079
    00082     virtual int getNumPartitions() = 0;
    00083
    00087     virtual int getProcId() = 0;
    00088
    00094     virtual cCommBuffer *createCommBuffer() = 0;
    00095
    00099     virtual void recycleCommBuffer(cCommBuffer *buffer) = 0;
    00100
    00104     virtual void send(cCommBuffer *buffer, int tag, int destination) = 0;
    00105
    00110     virtual void broadcast(cCommBuffer *buffer, int tag);
    00111
    00116     virtual bool receiveBlocking(int filtTag, cCommBuffer *buffer, int& receivedTag, int& sourceProcId) = 0;
    00117
    00123     virtual bool receiveNonblocking(int filtTag, cCommBuffer *buffer, int& receivedTag, int& sourceProcId) = 0;
    00125 };
    00126
    00127 #endif
    00128