Statistics
| Branch: | Revision:

root / src / eventlog / ievent.cc @ 0596ce67

History | View | Annotate | Download (1.57 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
}
30

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

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

    
42
    return -1;
43
}
44

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

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