-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathListener.h
122 lines (109 loc) · 2.38 KB
/
Listener.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Listener.h
* Author: cancian
*
* Created on 22 de Junho de 2018, 18:53
*/
#ifndef LISTENER_H
#define LISTENER_H
#include <string>
#include "Util.h"
class Entity;
class ModelComponent;
class TraceEvent {
public:
TraceEvent(Util::TraceLevel tracelevel, std::string text) {
_tracelevel = tracelevel;
_text = text;
}
Util::TraceLevel getTracelevel() const {
return _tracelevel;
}
std::string getText() const {
return _text;
}
private:
Util::TraceLevel _tracelevel;
std::string _text;
};
class TraceErrorEvent: public TraceEvent {
public:
TraceErrorEvent(std::string text,std::exception e): TraceEvent(Util::TL_errors, text) {
_e = e;
}
std::exception getException() const {
return _e;
}
private:
std::exception _e;
};
class TraceSimulationEvent : public TraceEvent {
public:
ModelComponent* getComponent() const {
return _component;
}
Entity* getEntity() const {
return _entity;
}
double getTime() const {
return _time;
}
TraceSimulationEvent(Util::TraceLevel tracelevel, double time, Entity* entity, ModelComponent* component, std::string text) : TraceEvent(tracelevel, text) {
_time = time;
_entity = entity;
_component = component;
}
private:
double _time;
Entity* _entity;
ModelComponent* _component;
};
typedef void (*traceListener)(TraceEvent);
typedef void (*traceErrorListener)(TraceErrorEvent);
typedef void (*traceSimulationListener)(TraceSimulationEvent);
//class Listener {
//public:
// Listener();
// Listener(const Listener& orig);
// virtual ~Listener();
//private:
//
//};
//
//class TraceEvent {
//public:
// TraceEvent(std::string text) {
// _text = text;
// }
// std::string getText() const {
// return _text;
// }
//public:
//private:
// std::string _text;
//};
//
//class TraceListener : public Listener {
//public:
// TraceListener() {}
// virtual void trace(TraceEvent e)=0;
//};
//
//class ReplicationEvent {
//public:
// ReplicationEvent() {}
//private:
//};
//
//class ReplicationListener : public Listener {
// ReplicationListener() {}
// virtual void replicationStart(ReplicationEvent e) = 0;
// virtual void replicationEnd(ReplicationEvent e) = 0;
// virtual void replicationStep(ReplicationEvent e) = 0;
//};
#endif /* LISTENER_H */