Skip to content

Commit

Permalink
Topic header copy constructor and copy assignment operator.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehpor committed Dec 23, 2024
1 parent 0cf607e commit 28d5f4b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions catkit_core/MessageBroker.cpp
Original file line number Diff line number Diff line change
@@ -1,2 +1,28 @@
#include "MessageBroker.h"

#include "Util.h"
#include "Timing.h"
#include "HostName.h"

#include <algorithm>

TopicHeader::TopicHeader(const TopicHeader &header)
{
CopyFrom(header);
}

TopicHeader &TopicHeader::operator=(const TopicHeader &header)
{
CopyFrom(header);

return *this;
}

void TopicHeader::CopyFrom(const TopicHeader &header)
{
next_frame_id.store(header.next_frame_id.load(std::memory_order_relaxed), std::memory_order_relaxed);
synchronization = header.synchronization;

std::copy(header.message_offsets, header.message_offsets + TOPIC_MAX_NUM_MESSAGES, message_offsets);
std::copy((char *)header.metadata_keys, (char *)header.metadata_keys + sizeof(metadata_keys), (char *)metadata_keys);
}

0 comments on commit 28d5f4b

Please sign in to comment.