Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (2.34 KB)

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

    
24
#include "cnmplookahead.h"
25

    
26
NAMESPACE_BEGIN
27

    
28
/**
29
 * Lookahead calculation based on inter-partition link delays only.
30
 *
31
 * @ingroup Parsim
32
 */
33
class SIM_API cAdvancedLinkDelayLookahead : public cNMPLookahead
34
{
35
  protected:
36
    struct LinkOut
37
    {
38
        simtime_t lookahead; // lookahead on this link (currently the link delay)
39
        simtime_t eot;       // current EOT on this link (last msg sent + lookahead)
40
    };
41
    struct PartitionInfo
42
    {
43
        int numLinks;        // size of links[] array
44
        LinkOut **links;     // information on outgoing links (needed for EOT calculation)
45
        simtime_t lookahead; // lookahead to partition (minimum of all link lookaheads)
46
    };
47

    
48
    // partition information
49
    int numSeg;              // number of partitions
50
    PartitionInfo *segInfo;  // partition info array, size numSeg
51

    
52
  public:
53
    /**
54
     * Constructor.
55
     */
56
    cAdvancedLinkDelayLookahead();
57

    
58
    /**
59
     * Destructor.
60
     */
61
    virtual ~cAdvancedLinkDelayLookahead();
62

    
63
    /**
64
     * Sets up algorithm for new simulation run.
65
     */
66
    virtual void startRun();
67

    
68
    /**
69
     * Called at end of simulation run.
70
     */
71
    virtual void endRun();
72

    
73
    /**
74
     * Updates lookahead information, based on the delay of the link
75
     * where message is sent out. Returns EOT.
76
     */
77
    virtual simtime_t getCurrentLookahead(cMessage *msg, int procId, void *data);
78

    
79
    /**
80
     * Returns minimum of link delays toward the given partition.
81
     */
82
    virtual simtime_t getCurrentLookahead(int procId);
83
};
84

    
85
NAMESPACE_END
86

    
87

    
88
#endif
89

    
90