Statistics
| Branch: | Revision:

root / src / envir / eventlogfilemgr.h @ 2f5cc443

History | View | Annotate | Download (3.28 KB)

1
//==========================================================================
2
//  EVENTLOGFILEMGR.H - part of
3
//                     OMNeT++/OMNEST
4
//            Discrete System Simulation in C++
5
//
6
//  Author: Andras Varga, Levente Meszaros
7
//
8
//==========================================================================
9

    
10
/*--------------------------------------------------------------*
11
  Copyright (C) 1992-2008 Andras Varga
12
  Copyright (C) 2006-2008 OpenSim Ltd.
13

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

    
18
#ifndef __EVENTLOGFILEMGR_H
19
#define __EVENTLOGFILEMGR_H
20

    
21
#include "simkerneldefs.h"
22
#include "envirdefs.h"
23
#include "opp_string.h"
24
#include "objectprinter.h"
25
#include "intervals.h"
26

    
27
class cModule;
28
class cMessage;
29
class cGate;
30
class cComponent;
31

    
32
NAMESPACE_BEGIN
33

    
34
/**
35
 * Responsible for writing the eventlog file.
36
 */
37
class ENVIR_API EventlogFileManager
38
{
39
  private:
40
    opp_string filename;
41
    FILE *feventlog;
42
    ObjectPrinter *objectPrinter;
43
    Intervals *recordingIntervals;
44
    bool isEventLogRecordingEnabled;
45
    bool isModuleEventLogRecordingEnabled;
46
    bool isIntervalEventLogRecordingEnabled;
47

    
48
    //Buffering
49
    eventnumber_t log_eventNumber;
50
    simtime_t log_simtime;
51
    int log_modid;
52
    eventnumber_t log_previd;
53
    long log_msgid;
54
    simtime_t log_duration;
55

    
56
  public:
57
    EventlogFileManager();
58
    virtual ~EventlogFileManager();
59

    
60
    virtual void configure();
61
    virtual void open();
62
    virtual void startRun();
63
    virtual void endRun();
64

    
65
    virtual bool hasRecordingIntervals() const;
66
    virtual void clearRecordingIntervals();
67

    
68
    virtual void recordSimulation();
69
    virtual void recordMessages();
70
    virtual void recordModules(cModule *module);
71
    virtual void recordConnections(cModule *module);
72

    
73
    virtual void flush();
74

    
75
    /** @name Functions called from cEnvir's similar functions */
76
    //@{
77
    virtual void simulationEvent(cMessage *msg);
78
    virtual void simulationEventEnd(double complexity);
79
    virtual void bubble(cComponent *component, const char *text);
80
    virtual void messageScheduled(cMessage *msg);
81
    virtual void messageCancelled(cMessage *msg);
82
    virtual void beginSend(cMessage *msg);
83
    virtual void messageSendDirect(cMessage *msg, cGate *toGate, simtime_t propagationDelay, simtime_t transmissionDelay);
84
    virtual void messageSendHop(cMessage *msg, cGate *srcGate);
85
    virtual void messageSendHop(cMessage *msg, cGate *srcGate, simtime_t propagationDelay, simtime_t transmissionDelay);
86
    virtual void endSend(cMessage *msg);
87
    virtual void messageDeleted(cMessage *msg);
88
    virtual void moduleReparented(cModule *module, cModule *oldparent);
89
    virtual void componentMethodBegin(cComponent *from, cComponent *to, const char *methodFmt, va_list va);
90
    virtual void componentMethodEnd();
91
    virtual void moduleCreated(cModule *newmodule);
92
    virtual void moduleDeleted(cModule *module);
93
    virtual void gateCreated(cGate *newgate);
94
    virtual void gateDeleted(cGate *gate);
95
    virtual void connectionCreated(cGate *srcgate);
96
    virtual void connectionDeleted(cGate *srcgate);
97
    virtual void displayStringChanged(cComponent *component);
98
    virtual void sputn(const char *s, int n);
99
    //@}
100
};
101

    
102
NAMESPACE_END
103

    
104
#endif