2021-04-04 21:04:12 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <atomic>
|
|
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
|
|
#include "src/Helpers/DateTime.hpp"
|
|
|
|
|
|
|
|
|
|
namespace Bloom::Events
|
|
|
|
|
{
|
|
|
|
|
static_assert(std::atomic<int>::is_always_lock_free);
|
|
|
|
|
|
|
|
|
|
class Event
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
static inline std::atomic<int> lastEventId = 0;
|
|
|
|
|
|
|
|
|
|
public:
|
2021-06-22 03:06:20 +01:00
|
|
|
int id = ++(Event::lastEventId);
|
|
|
|
|
QDateTime createdTimestamp = DateTime::currentDateTime();
|
2021-04-04 21:04:12 +01:00
|
|
|
std::optional<int> correlationId;
|
|
|
|
|
|
|
|
|
|
static inline const std::string name = "GenericEvent";
|
|
|
|
|
|
2021-06-22 03:06:20 +01:00
|
|
|
[[nodiscard]] virtual std::string getName() const {
|
2021-04-04 21:04:12 +01:00
|
|
|
return Event::name;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|