Statistics
| Branch: | Revision:

root / src / eventlog / ievent.cc @ 7c7d95e5

History | View | Annotate | Download (1.6 KB)

1
//=========================================================================
2
//  IEVENTLOG.CC - part of
3
//                  OMNeT++/OMNEST
4
//           Discrete System Simulation in C++
5
//
6
//  Author: Levente Meszaros
7
//
8
//=========================================================================
9

    
10
/*--------------------------------------------------------------*
11
  Copyright (C) 2006-2008 OpenSim Ltd.
12

13
  This file is distributed WITHOUT ANY WARRANTY. See the file
14
  `license' for details on this and other legal matters.
15
*--------------------------------------------------------------*/
16

    
17
#include <stdio.h>
18
#include "ievent.h"
19

    
20
USING_NAMESPACE
21

    
22
IEvent::IEvent()
23
{
24
    nextEvent = NULL;
25
    previousEvent = NULL;
26
    criticalPredecessor = NULL;
27
    cachedTimelineCoordinate = -1;
28
    cachedTimelineCoordinateSystemVersion = -1;
29
    _earliestProcessingTime = 0;
30
}
31

    
32
int IEvent::findBeginSendEntryIndex(int messageId)
33
{
34
    // find the "BS" or "SA" line in the cause event
35
    for (int beginSendEntryNumber = 0; beginSendEntryNumber < getNumEventLogEntries(); beginSendEntryNumber++)
36
    {
37
        BeginSendEntry *beginSendEntry = dynamic_cast<BeginSendEntry *>(getEventLogEntry(beginSendEntryNumber));
38

    
39
        if (beginSendEntry && beginSendEntry->messageId == messageId)
40
            return beginSendEntryNumber;
41
    }
42

    
43
    return -1;
44
}
45

    
46
void IEvent::linkEvents(IEvent *previousEvent, IEvent *nextEvent)
47
{
48
    previousEvent->nextEvent = nextEvent;
49
    nextEvent->previousEvent = previousEvent;
50
}
51

    
52
void IEvent::unlinkEvents(IEvent *previousEvent, IEvent *nextEvent)
53
{
54
    previousEvent->nextEvent = NULL;
55
    nextEvent->previousEvent = NULL;
56
}