-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevent.h
35 lines (30 loc) · 942 Bytes
/
event.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
#ifndef SPRAWL_PSYCAL_EVENT_H_
#define SPRAWL_PSYCAL_EVENT_H_
#include <chrono>
#include <functional>
#include <string>
#include <vector>
namespace psy::psycal {
class Event {
/**
* format:
* - current is a form of an accumulator, which is a min heap
* - past is pruning the heap, storing, and compressing the
* information if possible for future inquiries
*/
public:
Event(std::tm&&, std::string&&);
std::uint64_t GetUnixTimestamp() const;
inline const std::tm& GetRawTime() const { return tm_; }
std::vector<std::uint8_t> GetEncodedMessage() const;
inline const std::string& GetMessage() const { return message_; }
static bool SoonerCmp(const Event& a, const Event& b) {
return a.GetUnixTimestamp() > b.GetUnixTimestamp();
};
typedef std::function<bool(const Event&, const Event&)> Comparator;
private:
std::tm tm_;
std::string message_;
};
}
#endif