Project

General

Profile

Statistics
| Branch: | Revision:

root / src / sim / parsim / cnmplookahead.h @ e1750c09

History | View | Annotate | Download (2.19 KB)

1
//=========================================================================
2
//  CNMPLOOKAHEAD.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 __CNMPLOOKAHEAD_H__
22
#define __CNMPLOOKAHEAD_H__
23

    
24
#include "cobject.h"
25
#include "simtime_t.h"
26

    
27
NAMESPACE_BEGIN
28

    
29
// forward declarations
30
class cMessage;
31
class cSimulation;
32
class cParsimCommunications;
33
class cParsimPartition;
34

    
35

    
36
/**
37
 * Base class of lookahead calculations for cNullMessageProtocol
38
 * which implements the "null message algorithm".
39
 *
40
 * @ingroup Parsim
41
 */
42
class SIM_API cNMPLookahead : public cObject
43
{
44
  protected:
45
    cSimulation *sim;
46
    cParsimCommunications *comm; // TBD this is just to access numPartitions -- optimize out?
47
    cParsimPartition *partition;
48
    // cNullMessageProtocol *nullmsgprot;
49

    
50
  public:
51
    /**
52
     * Constructor.
53
     */
54
    cNMPLookahead() {};
55

    
56
    /**
57
     * Destructor.
58
     */
59
    virtual ~cNMPLookahead() {}
60

    
61
    /**
62
     * Pass objects it has to cooperate with.
63
     */
64
    void setContext(cSimulation *simul, cParsimPartition *seg, cParsimCommunications *co)
65
       {sim = simul; partition = seg; comm = co;}
66

    
67
    /**
68
     * Hook called at start of simulation run.
69
     */
70
    virtual void startRun() = 0;
71

    
72
    /**
73
     * Hook called at end of simulation run.
74
     */
75
    virtual void endRun() = 0;
76

    
77
    /**
78
     * Performs lookahead calculation when a message gets sent out from the partition.
79
     */
80
    virtual simtime_t getCurrentLookahead(cMessage *msg, int procId, void *data) = 0;
81

    
82
    /**
83
     * Returns current lookahead.
84
     */
85
    virtual simtime_t getCurrentLookahead(int procId) = 0;
86

    
87
};
88

    
89
NAMESPACE_END
90

    
91

    
92
#endif