-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExceptionMonitor.h
86 lines (73 loc) · 2.48 KB
/
ExceptionMonitor.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
#ifndef SystemManager_ExceptionMonitor_IsIncluded
#define SystemManager_ExceptionMonitor_IsIncluded
#include"SystemManager/IncludeExtLibs.h"
#include<map>
#include<fstream>
namespace SystemManagerSpace
{
// --------------------------------------------------------
// class ExceptionMonitor
// --------------------------------------------------------
/**
* ExceptionMonitor's main functionality:
* - Receive exceptions that occured on components
* - Store exceptions and make available for SystemManagerGUI
*/
class ExceptionMonitor : public ExceptionMulticastInterface,
public Thread
{
private:
typedef map<long long, ExceptionMessage> MapTimeStampExceptionMessage;
typedef vector<ExceptionMessage> VectorTimeStampExceptionMessage;
private:
//MapTimeStampExceptionMessage mapTimeStampExceptionMessage;
VectorTimeStampExceptionMessage vectorTimeStampExceptionMessage;
Mutex updateLock;
ExceptionMulticastSubscriber *exceptionSubscriber;
bool stopExceptionMonitor;
/**
* Main thread-loop for the ExceptionMonitor.
*/
virtual void run();
/**
* Returns InterfaceHandle for ExceptionMonitor. Dummy implementation.
*
* @return InterfaceHandle The SystemManager's InterfaceHandle (Port, Host).
*/
inline virtual InterfaceHandle GetInterfaceHandle() { return InterfaceHandle(); }
public:
/**
* Constructor for ExceptionMonitor.
*
* @param name The ExceptionMonitor name is only used by Component class.
*/
ExceptionMonitor(string name);
/**
* Shuts down ExceptionMonitor.
*/
~ExceptionMonitor();
/**
* Prints the ExceptionMonitor's database.
*/
void PrintAll(std::ostream &ostr);
/**
* Clears ExceptionMonitor's database.
*/
void ClearAll();
/**
* SystemManager receives exceptions that occured on components implemented in LightweightMiddleware.
*
* @param exceptionMessage Contains the HostInformation of the component where the exception occured,
* and a message that describes the exception.
*/
virtual void PostException(ExceptionMessage &exceptionMessage);
/**
* Returns middleware exceptions that have been multicast by components and received by SystemManager.
*
* @param lastTimeStamp Timestamp of last received exception message, can be empty if no previously received exception message.
* @return map containing middleware exceptions received by SystemManager, organized by timestamp.
*/
MapTimeStampExceptionMessage GetMiddlewareExceptions(long long &lastTimeStamp);
};
} // namespace SystemManagerSpace
#endif // EXCEPTION_MONITOR_H