Statistics
| Branch: | Revision:

root / src / eventlog / eventlogfacade.h @ e1750c09

History | View | Annotate | Download (4.88 KB)

1
//=========================================================================
2
//  EVENTLOGFACADE.H - 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
#ifndef __EVENTLOGFACADE_H_
18
#define __EVENTLOGFACADE_H_
19

    
20
#include "ievent.h"
21
#include "ieventlog.h"
22

    
23
NAMESPACE_BEGIN
24

    
25
#define PTR(ptr) if (ptr == 0) throw opp_runtime_error("NULL ptr exception");
26
#define IEVENT_PTR(ptr) PTR(ptr) Assert(dynamic_cast<IEvent *>((IEvent *)ptr));
27
#define EVENT_LOG_ENTRY_PTR(ptr) PTR(ptr) Assert(dynamic_cast<EventLogEntry *>((EventLogEntry *)ptr));
28
#define BEGIN_SEND_ENTRY_PTR(ptr) PTR(ptr) Assert(dynamic_cast<BeginSendEntry *>((BeginSendEntry *)ptr));
29
#define END_SEND_ENTRY_PTR(ptr) PTR(ptr) Assert(dynamic_cast<EndSendEntry *>((EndSendEntry *)ptr));
30
#define MODULE_CREATED_ENTRY_PTR(ptr) PTR(ptr) Assert(dynamic_cast<ModuleCreatedEntry *>((ModuleCreatedEntry *)ptr));
31
#define MODULE_METHOD_BEGIN_ENTRY_PTR(ptr) PTR(ptr) Assert(dynamic_cast<ModuleMethodBeginEntry *>((ModuleMethodBeginEntry *)ptr));
32
#define IMESSAGE_DEPENDENCY_PTR(ptr) PTR(ptr) Assert(dynamic_cast<IMessageDependency *>((IMessageDependency *)ptr));
33
#define MESSAGE_DEPENDENCY_PTR(ptr) PTR(ptr) Assert(dynamic_cast<MessageDependency *>((MessageDependency *)ptr));
34
#define FILTERED_MESSAGE_DEPENDENCY_PTR(ptr) PTR(ptr) Assert(dynamic_cast<FilteredMessageDependency *>((FilteredMessageDependency *)ptr));
35

    
36
/**
37
 * A class that makes it possible to extract info about events, without
38
 * returning objects. (Wherever a C++ method returns an object pointer,
39
 * SWIG-generated wrapper creates a corresponding Java object with the
40
 * pointer value inside. This has disastrous effect on performance
41
 * when dealing with huge amounts of data).
42
 */
43
class EVENTLOG_API EventLogFacade
44
{
45
    protected:
46
        IEventLog *eventLog;
47

    
48
    public:
49
        EventLogFacade(IEventLog *eventLog);
50
        virtual ~EventLogFacade() {}
51

    
52
        void setEventLog(IEventLog *eventLog) { Assert(eventLog); this->eventLog = eventLog; }
53
        virtual void synchronize(FileReader::FileChangedState change);
54

    
55
        IEvent* IEvent_getEvent(ptr_t ptr);
56
        ptr_t IEvent_getNonFilteredEvent(ptr_t ptr);
57
        ptr_t IEvent_getEventForEventNumber(eventnumber_t eventNumber);
58
        ptr_t IEvent_getNonFilteredEventForEventNumber(eventnumber_t eventNumber);
59
        ptr_t IEvent_getPreviousEvent(ptr_t ptr);
60
        ptr_t IEvent_getNextEvent(ptr_t ptr);
61
        eventnumber_t IEvent_getEventNumber(ptr_t ptr);
62
        simtime_t IEvent_getSimulationTime(ptr_t ptr);
63
        double IEvent_getSimulationTimeAsDouble(ptr_t ptr);
64
        int IEvent_getModuleId(ptr_t ptr);
65
        int IEvent_getNumCauses(ptr_t ptr);
66
        int IEvent_getNumConsequences(ptr_t ptr);
67
        ptr_t IEvent_getCause(ptr_t ptr, int index);
68
        ptr_t IEvent_getConsequence(ptr_t ptr, int index);
69
        bool IEvent_isSelfMessageProcessingEvent(ptr_t ptr);
70

    
71
        EventLogEntry *EventLogEntry_getEventLogEntry(ptr_t ptr);
72
        ptr_t EventLogEntry_getEvent(ptr_t ptr);
73
        int EventLogEntry_getContextModuleId(ptr_t ptr);
74
        int EventLogEntry_getEntryIndex(ptr_t ptr);
75

    
76
        bool BeginSendEntry_isSelfMessage(ptr_t ptr);
77
        int BeginSendEntry_getMessageId(ptr_t ptr);
78
        ptr_t BeginSendEntry_getEndSendEntry(ptr_t ptr);
79
        simtime_t BeginSendEntry_getTransmissionDelay(ptr_t ptr);
80
        bool EndSendEntry_isReceptionStart(ptr_t ptr);
81

    
82
        const char *ModuleCreatedEntry_getModuleFullPath(ptr_t ptr);
83

    
84
        int ModuleMethodBeginEntry_getFromModuleId(ptr_t ptr);
85
        int ModuleMethodBeginEntry_getToModuleId(ptr_t ptr);
86
        const char *ModuleMethodBeginEntry_getMethod(ptr_t ptr);
87

    
88
        IMessageDependency *IMessageDependency_getMessageDependency(ptr_t ptr);
89
        const char *IMessageDependency_getMessageName(ptr_t ptr);
90
        bool IMessageDependency_isReuse(ptr_t ptr);
91
        bool IMessageDependency_isSelfMessageReuse(ptr_t ptr);
92
        bool IMessageDependency_isStoredMessageReuse(ptr_t ptr);
93
        bool IMessageDependency_isFilteredMessageDependency(ptr_t ptr);
94
        ptr_t IMessageDependency_getCauseEvent(ptr_t ptr);
95
        ptr_t IMessageDependency_getConsequenceEvent(ptr_t ptr);
96
        ptr_t IMessageDependency_getBeginSendEntry(ptr_t ptr);
97
        simtime_t IMessageDependency_getCauseSimulationTime(ptr_t ptr);
98
        simtime_t IMessageDependency_getConsequenceSimulationTime(ptr_t ptr);
99

    
100
        const char *FilteredMessageDependency_getBeginMessageName(ptr_t ptr);
101
        const char *FilteredMessageDependency_getEndMessageName(ptr_t ptr);
102
};
103

    
104
NAMESPACE_END
105

    
106

    
107
#endif