Line |
Branch |
Exec |
Source |
1 |
|
|
/***************************************************************************** |
2 |
|
|
* |
3 |
|
|
* Copyright 2010 Richard Hacker (lerichi at gmx dot net) |
4 |
|
|
* |
5 |
|
|
* This file is part of the pdserv library. |
6 |
|
|
* |
7 |
|
|
* The pdserv library is free software: you can redistribute it and/or modify |
8 |
|
|
* it under the terms of the GNU Lesser General Public License as published |
9 |
|
|
* by the Free Software Foundation, either version 3 of the License, or (at |
10 |
|
|
* your option) any later version. |
11 |
|
|
* |
12 |
|
|
* The pdserv library is distributed in the hope that it will be useful, but |
13 |
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
14 |
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
15 |
|
|
* License for more details. |
16 |
|
|
* |
17 |
|
|
* You should have received a copy of the GNU Lesser General Public License |
18 |
|
|
* along with the pdserv library. If not, see <http://www.gnu.org/licenses/>. |
19 |
|
|
* |
20 |
|
|
****************************************************************************/ |
21 |
|
|
|
22 |
|
|
#ifndef EVENT_H |
23 |
|
|
#define EVENT_H |
24 |
|
|
|
25 |
|
|
#include <cstdint> |
26 |
|
|
#include <ctime> |
27 |
|
|
#include <string> |
28 |
|
|
#include <vector> |
29 |
|
|
|
30 |
|
|
namespace PdServ { |
31 |
|
|
|
32 |
|
|
class Event { |
33 |
|
|
public: |
34 |
|
|
enum Priority { |
35 |
|
|
Reset, Emergency, Alert, Critical, Error, Warning, Notice, Info, |
36 |
|
|
Debug |
37 |
|
|
}; |
38 |
|
|
|
39 |
|
|
Event(const char *path, size_t nelem); |
40 |
|
|
Event() = delete; |
41 |
|
|
~Event(); |
42 |
|
|
|
43 |
|
|
void setTexts(const char * const *messages); |
44 |
|
|
|
45 |
|
|
const std::string path; |
46 |
|
|
|
47 |
|
399 |
size_t nelem() const { |
48 |
|
399 |
return messages.size(); |
49 |
|
|
} |
50 |
|
|
std::vector<std::string> messages; |
51 |
|
|
}; |
52 |
|
|
|
53 |
|
|
struct EventData { |
54 |
|
|
const Event* event; |
55 |
|
|
uint32_t seqNo; |
56 |
|
|
size_t index; |
57 |
|
|
Event::Priority priority; |
58 |
|
|
bool state; |
59 |
|
|
struct timespec time; |
60 |
|
|
}; |
61 |
|
|
|
62 |
|
|
} |
63 |
|
|
|
64 |
|
|
#endif //EVENT_H |
65 |
|
|
|