|
Last change
on this file since 170 was 165, checked in by ogrimm, 16 years ago |
|
Improved C++ unhandled exception handling
|
-
Property svn:keywords
set to
Revision
|
|
File size:
1.4 KB
|
| Line | |
|---|
| 1 | #ifndef EVIDENCE_H_SEEN
|
|---|
| 2 | #define EVIDENCE_H_SEEN
|
|---|
| 3 |
|
|---|
| 4 | #include <stdio.h>
|
|---|
| 5 | #include <stdarg.h>
|
|---|
| 6 | #include <string>
|
|---|
| 7 | #include <errno.h>
|
|---|
| 8 | #include <vector>
|
|---|
| 9 | #include <exception>
|
|---|
| 10 | #include <cxxabi.h>
|
|---|
| 11 |
|
|---|
| 12 | #include "dis.hxx"
|
|---|
| 13 | #include "dic.hxx"
|
|---|
| 14 |
|
|---|
| 15 | #define NO_LINK (char *) "__&DIM&NOLINK&__" // Data if no link available
|
|---|
| 16 | #define STATUS_SIZE 1000 // Bytes for status service string
|
|---|
| 17 | #define EVIDENCE_REVISION "$Revision: 165 $"
|
|---|
| 18 |
|
|---|
| 19 | // Class declation of Evidence server
|
|---|
| 20 | class EvidenceServer: public DimServer {
|
|---|
| 21 |
|
|---|
| 22 | private:
|
|---|
| 23 | struct ConfigItem {
|
|---|
| 24 | char *Name;
|
|---|
| 25 | char *Value;
|
|---|
| 26 | int Time;
|
|---|
| 27 | };
|
|---|
| 28 | std::vector<struct ConfigItem> ConfigList;
|
|---|
| 29 |
|
|---|
| 30 | DimService *Status;
|
|---|
| 31 | char *InitMsg;
|
|---|
| 32 |
|
|---|
| 33 | static void SignalHandler(int); // static for signal()
|
|---|
| 34 | static void Terminate(); // static for set_terminate()
|
|---|
| 35 | void errorHandler(int, int, char *);
|
|---|
| 36 | void exitHandler(int);
|
|---|
| 37 |
|
|---|
| 38 | public:
|
|---|
| 39 | EvidenceServer(const char *);
|
|---|
| 40 | ~EvidenceServer();
|
|---|
| 41 |
|
|---|
| 42 | enum StateType {INFO=0, WARN=1, ERROR=2, FATAL=3};
|
|---|
| 43 |
|
|---|
| 44 | void State(StateType, const char *, ...);
|
|---|
| 45 | char* GetConfig(const char *, const char * = NULL);
|
|---|
| 46 | static char* ToString(DimInfo *);
|
|---|
| 47 | static bool ServiceOK(DimInfo *);
|
|---|
| 48 |
|
|---|
| 49 | bool ExitRequest;
|
|---|
| 50 | };
|
|---|
| 51 |
|
|---|
| 52 | class EvidenceHistory: public DimClient {
|
|---|
| 53 |
|
|---|
| 54 | static const int WrapMark[];
|
|---|
| 55 | static const int EndMark[];
|
|---|
| 56 |
|
|---|
| 57 | std::string HistoryName;
|
|---|
| 58 | char *Buffer;
|
|---|
| 59 | int BufferSize;
|
|---|
| 60 | int Offset;
|
|---|
| 61 |
|
|---|
| 62 | public:
|
|---|
| 63 | EvidenceHistory();
|
|---|
| 64 | ~EvidenceHistory();
|
|---|
| 65 |
|
|---|
| 66 | bool GetHistory(char *);
|
|---|
| 67 | bool Next(int &, int &, void *&);
|
|---|
| 68 | };
|
|---|
| 69 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.