root / src / eventlog / sequencechartfacade.h @ 77a045fa
History  View  Annotate  Download (5.37 KB)
1 
//=========================================================================


2 
// SEQUENCECHARTFACADE.H  part of

3 
// OMNeT++/OMNEST

4 
// Discrete System Simulation in C++

5 
//

6 
// Author: Levente Meszaros

7 
//

8 
//=========================================================================

9  
10 
/**

11 
Copyright (C) 20062008 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 __SEQUENCECHARTFACADE_H_

18 
#define __SEQUENCECHARTFACADE_H_

19  
20 
#include <float.h> 
21 
#include <vector> 
22 
#include <map> 
23 
#include "ievent.h" 
24 
#include "ieventlog.h" 
25 
#include "eventlogfacade.h" 
26  
27 
NAMESPACE_BEGIN 
28  
29 
/**

30 
* A class that makes it possible to extract info about events, without

31 
* returning objects. (Wherever a C++ method returns an object pointer,

32 
* SWIGgenerated wrapper creates a corresponding Java object with the

33 
* pointer value inside. This has disastrous effect on performance

34 
* when dealing with huge amounts of data).

35 
*/

36 
class EVENTLOG_API SequenceChartFacade : public EventLogFacade 
37 
{ 
38 
protected:

39 
long timelineCoordinateSystemVersion;

40 
eventnumber_t timelineCoordinateOriginEventNumber; 
41 
simtime_t timelineCoordinateOriginSimulationTime; 
42 
eventnumber_t timelineCoordinateRangeStartEventNumber; 
43 
eventnumber_t timelineCoordinateRangeEndEventNumber; 
44 
TimelineMode timelineMode; 
45 
double nonLinearMinimumTimelineCoordinateDelta;

46 
double nonLinearFocus;

47  
48 
long smallestComplexity;

49 
long largestComplexity;

50  
51 
public:

52 
SequenceChartFacade(IEventLog *eventLog); 
53 
virtual ~SequenceChartFacade() {} 
54  
55 
double calculateNonLinearFocus();

56 
virtual void synchronize(FileReader::FileChangedState change);

57  
58 
TimelineMode getTimelineMode() { return timelineMode; }

59 
void setTimelineMode(TimelineMode timelineMode);

60  
61 
double getNonLinearMinimumTimelineCoordinateDelta() { return nonLinearMinimumTimelineCoordinateDelta; } 
62 
void setNonLinearMinimumTimelineCoordinateDelta(double value); 
63 
double getNonLinearFocus() { return nonLinearFocus; } 
64 
void setNonLinearFocus(double nonLinearFocus); 
65  
66 
IEvent *getTimelineCoordinateSystemOriginEvent() { return eventLog>getEventForEventNumber(timelineCoordinateOriginEventNumber); }

67 
eventnumber_t getTimelineCoordinateSystemOriginEventNumber() { return timelineCoordinateOriginEventNumber; }

68 
double getTimelineCoordinateDelta(double simulationTimeDelta); 
69 
/**

70 
* Calculates the timeline coordinate for the given event. Returns value from the cache if already there or calculates it

71 
* while taking care about the calculation limits.

72 
*/

73 
double getTimelineCoordinate(ptr_t ptr, double lowerTimelineCoordinateCalculationLimit = DBL_MAX, double upperTimelineCoordinateCalculationLimit = DBL_MAX); 
74 
double getTimelineCoordinate(IEvent *event, double lowerTimelineCoordinateCalculationLimit = DBL_MAX, double upperTimelineCoordinateCalculationLimit = DBL_MAX); 
75 
double getCachedTimelineCoordinate(IEvent *event);

76 
double IEvent_getTimelineCoordinate(ptr_t ptr);

77 
void undefineTimelineCoordinateSystem();

78 
void relocateTimelineCoordinateSystem(IEvent *event);

79  
80 
IEvent *getEventForNonLinearTimelineCoordinate(double timelineCoordinate, bool &forward); 
81 
IEvent *getLastEventNotAfterTimelineCoordinate(double timelineCoordinate);

82 
IEvent *getFirstEventNotBeforeTimelineCoordinate(double timelineCoordinate);

83  
84 
/*

85 
* returns smallest event complexity in the event log

86 
*/

87 
long getSmallestEventComplexity();

88 
/*

89 
* returns largest event complexity in the event log

90 
*/

91 
long getLargestEventComplexity();

92  
93 
/**

94 
* Timeline coordinate can be given in the range (infinity, +infinity).

95 
* Simulation time will be in the range [0, lastEventSimulationTime].

96 
*/

97 
simtime_t getSimulationTimeForTimelineCoordinate(double timelineCoordinate, bool upperLimit = false); 
98 
/**

99 
* Simulation time must be in the range [0, lastEventSimulationTime].

100 
* Timeline coordinate will be in the range [0, lastEventTimelineCoordinate] if the

101 
* timeline origin is at the first event.

102 
*/

103 
double getTimelineCoordinateForSimulationTime(simtime_t simulationTime, bool upperLimit = false); 
104 
double getTimelineCoordinateForSimulationTimeAndEventInModule(simtime_t simulationTime, int moduleId); 
105  
106 
std::vector<ptr_t> *getModuleMethodBeginEntries(ptr_t startEventPtr, ptr_t endEventPtr); 
107  
108 
std::vector<ptr_t> *getIntersectingMessageDependencies(ptr_t startEventPtr, ptr_t endEventPtr); 
109 
std::vector<int> getApproximateMessageDependencyCountAdjacencyMatrix(std::map<int, int> *moduleIdToAxisIdMap, int numberOfSamples, int messageSendWeight = 1, int messageReuseWeight = 0); 
110 
protected:

111 
void extractSimulationTimesAndTimelineCoordinates(

112 
IEvent *event, IEvent *&nextEvent, 
113 
simtime_t &eventSimulationTime, double &eventTimelineCoordinate,

114 
simtime_t &nextEventSimulationTime, double &nextEventTimelineCoordinate,

115 
simtime_t &simulationTimeDelta, double &timelineCoordinateDelta);

116 
}; 
117  
118 
NAMESPACE_END 
119  
120  
121 
#endif
