39 copyInto(m_topic,
topic);
40 copyInto(m_type,
type);
91 static_assert(std::is_trivially_copyable_v<T>,
"T must be trivially copyable to be stored in an Event");
92 static_assert(
sizeof(
T) <=
CONTENT_SIZE,
"content is bigger than reserved size for content");
93 std::memcpy(m_content, &
content,
sizeof(
T));
94 m_contentLength =
sizeof(
T);
104 static_assert(std::is_trivially_copyable_v<T>,
"T must be trivially copyable to be read from an Event");
105 static_assert(
sizeof(
T) <=
CONTENT_SIZE,
"content is bigger than reserved size for content");
107 std::memcpy(&
result, m_content,
sizeof(
T));
115 [[
nodiscard]]
const std::byte *
content()
const {
return reinterpret_cast<const std::byte *
>(m_content); }
124 std::size_t m_contentLength = 0;
125 std::int64_t m_sequence = 0;
126 std::int64_t m_timestamp = 0;
136static_assert(std::is_trivially_copyable_v<Event>,
"Event must stay trivially copyable for the lock-free queues");
std::int64_t sequence() const
Definition Event.h:62
Event(const std::string &topic, const std::string &type)
Definition Event.h:37
const std::byte * content() const
Definition Event.h:115
void setType(const std::string &type)
Definition Event.h:49
void assign(const T &content)
Definition Event.h:89
std::int64_t timestamp() const
Definition Event.h:69
std::size_t contentLength() const
Definition Event.h:112
void setTimestamp(std::int64_t timestamp)
Definition Event.h:66
static constexpr std::size_t CONTENT_SIZE
Definition Event.h:27
const char * topic() const
Definition Event.h:52
void setSequence(std::int64_t sequence)
Definition Event.h:59
static constexpr std::size_t NAME_SIZE
Definition Event.h:25
void setContent(const std::byte *data, std::size_t size)
Definition Event.h:76
const char * type() const
Definition Event.h:55
bool isContentEmpty() const
Definition Event.h:118
void setTopic(const std::string &topic)
Definition Event.h:45
T as() const
Definition Event.h:102
Definition BaseFeature.h:6
constexpr std::string_view type_name()
Definition TypeName.h:9