Project

General

Profile

Statistics
| Branch: | Revision:

root / src / sim / parsim / cparsimprotocolbase.h @ 81ad8b66

History | View | Annotate | Download (2.04 KB)

1
//=========================================================================
2
//  CPARSIMPROTOCOLBASE.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-2008 Andras Varga
15
  Copyright (C) 2006-2008 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 __CPARSIMPROTOCOLBASE_H__
22
#define __CPARSIMPROTOCOLBASE_H__
23

    
24
#include "cparsimsynchr.h"
25

    
26
NAMESPACE_BEGIN
27

    
28
// forward declarations
29
class cCommBuffer;
30

    
31
/**
32
 * Contains utility functions for implementing parallel simulation
33
 * protocols.
34
 *
35
 * @ingroup Parsim
36
 */
37
class SIM_API cParsimProtocolBase : public cParsimSynchronizer
38
{
39
  protected:
40
    // process whatever comes from other partitions -- nonblocking
41
    virtual void receiveNonblocking();
42

    
43
    // process whatever comes from other partitions -- blocking
44
    // (normally returns true; false is returned if blocking was interrupted by the user)
45
    virtual bool receiveBlocking();
46

    
47
    // process buffers coming from other partitions
48
    virtual void processReceivedBuffer(cCommBuffer *buffer, int tag, int sourceProcId);
49

    
50
    // process cMessages received from other partitions
51
    virtual void processReceivedMessage(cMessage *msg, int destModuleId, int destGateId, int sourceProcId);
52

    
53
  public:
54
    /**
55
     * Constructor.
56
     */
57
    cParsimProtocolBase();
58

    
59
    /**
60
     * Destructor.
61
     */
62
    virtual ~cParsimProtocolBase();
63

    
64
    /**
65
     * Performs no optimization, just sends out the cMessage to the given partition.
66
     */
67
    virtual void processOutgoingMessage(cMessage *msg, int procId, int moduleId, int gateId, void *data);
68
};
69

    
70
NAMESPACE_END
71

    
72

    
73
#endif
74