Skip to content

Commit

Permalink
Rename Message to McapMessage
Browse files Browse the repository at this point in the history
Signed-off-by: tempate <[email protected]>
  • Loading branch information
Tempate committed May 7, 2024
1 parent 5f09ff9 commit dcc9f62
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@

#include <ddsrecorder_participants/library/library_dll.h>
#include <ddsrecorder_participants/recorder/mcap/McapHandlerConfiguration.hpp>
#include <ddsrecorder_participants/recorder/mcap/McapMessage.hpp>
#include <ddsrecorder_participants/recorder/mcap/McapWriter.hpp>
#include <ddsrecorder_participants/recorder/mcap/Message.hpp>
#include <ddsrecorder_participants/recorder/output/FileTracker.hpp>

#if FASTRTPS_VERSION_MAJOR <= 2 && FASTRTPS_VERSION_MINOR < 13
Expand Down Expand Up @@ -73,7 +73,7 @@ class McapHandler : public ddspipe::participants::ISchemaHandler
{
public:

using pending_list = std::list<std::pair<ddspipe::core::types::DdsTopic, Message>>;
using pending_list = std::list<std::pair<ddspipe::core::types::DdsTopic, McapMessage>>;

/**
* McapHandler constructor by required values.
Expand Down Expand Up @@ -133,7 +133,7 @@ class McapHandler : public ddspipe::participants::ISchemaHandler
* If instance is STOPPED, received data is not processed.
*
* @param [in] topic DDS topic associated to this sample.
* @param [in] data Message to be added.
* @param [in] data McapMessage to be added.
*/
DDSRECORDER_PARTICIPANTS_DllAPI
void add_data(
Expand Down Expand Up @@ -242,11 +242,11 @@ class McapHandler : public ddspipe::participants::ISchemaHandler
* If after adding the new sample (when not directly writing to file) the buffer reaches its maximum size, the
* content is dumped to disk.
*
* @param [in] msg Message to be added
* @param [in] msg McapMessage to be added
* @param [in] direct_write Whether to directly store in MCAP file
*/
void add_data_nts_(
const Message& msg,
const McapMessage& msg,
bool direct_write = false);

/**
Expand All @@ -255,12 +255,12 @@ class McapHandler : public ddspipe::participants::ISchemaHandler
* First, it is attempted to get a channel given \c topic to be associated with the message.
* If this fails, the sample is not added.
*
* @param [in] msg Message to be added
* @param [in] msg McapMessage to be added
* @param [in] topic Topic of message to be added
* @param [in] direct_write Whether to directly store in MCAP file
*/
void add_data_nts_(
Message& msg,
McapMessage& msg,
const ddspipe::core::types::DdsTopic& topic,
bool direct_write = false);

Expand All @@ -269,11 +269,11 @@ class McapHandler : public ddspipe::participants::ISchemaHandler
*
* If pending samples collection is full, the oldest message is popped and written (if only_with_schema not true).
*
* @param [in] msg Message to be added
* @param [in] msg McapMessage to be added
* @param [in] topic Topic of message to be added
*/
void add_to_pending_nts_(
Message& msg,
McapMessage& msg,
const ddspipe::core::types::DdsTopic& topic);

/**
Expand Down Expand Up @@ -465,7 +465,7 @@ class McapHandler : public ddspipe::participants::ISchemaHandler
std::map<ddspipe::core::types::DdsTopic, mcap::Channel> channels_;

//! Samples buffer
std::list<Message> samples_buffer_;
std::list<McapMessage> samples_buffer_;

//! Dynamic types collection
DynamicTypesCollection dynamic_types_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

/**
* @file McapFileTracker.hpp
* @file McapMessage.hpp
*/

#pragma once
Expand All @@ -30,9 +30,9 @@ namespace participants {
/**
* Structure extending \c mcap::Message with Fast DDS payload and its owner (a \c PayloadPool).
*/
struct Message : public mcap::Message
struct McapMessage : public mcap::Message
{
Message() = default;
McapMessage() = default;

/**
* Message copy constructor
Expand All @@ -43,8 +43,8 @@ struct Message : public mcap::Message
* free the newly constructed sample (payload's data attribute), thus rendering the latter useless.
*
*/
Message(
const Message& msg);
McapMessage(
const McapMessage& msg);

/**
* Message destructor
Expand All @@ -55,7 +55,7 @@ struct Message : public mcap::Message
* the situation described in copy constructor's note.
*
*/
~Message();
~McapMessage();

//! Serialized payload
ddspipe::core::types::Payload payload{};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <ddsrecorder_participants/library/library_dll.h>
#include <ddsrecorder_participants/recorder/mcap/McapHandlerConfiguration.hpp>
#include <ddsrecorder_participants/recorder/mcap/McapSizeTracker.hpp>
#include <ddsrecorder_participants/recorder/mcap/Message.hpp>
#include <ddsrecorder_participants/recorder/output/FileTracker.hpp>
#include <ddsrecorder_participants/recorder/output/FullFileException.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@

#include <ddsrecorder_participants/constants.hpp>
#include <ddsrecorder_participants/recorder/mcap/McapHandler.hpp>
#include <ddsrecorder_participants/recorder/mcap/McapMessage.hpp>

namespace eprosima {
namespace ddsrecorder {
Expand Down Expand Up @@ -191,7 +192,7 @@ void McapHandler::add_data(
"Adding data in topic " << topic);

// Add data to channel
Message msg;
McapMessage msg;
msg.sequence = unique_sequence_number_++;
msg.publishTime = fastdds_timestamp_to_mcap_timestamp(data.source_timestamp);
if (configuration_.log_publishTime)
Expand Down Expand Up @@ -475,7 +476,7 @@ mcap::Timestamp McapHandler::now()
}

void McapHandler::add_data_nts_(
const Message& msg,
const McapMessage& msg,
bool direct_write /* false */)
{
if (direct_write)
Expand All @@ -496,7 +497,7 @@ void McapHandler::add_data_nts_(
}

void McapHandler::add_data_nts_(
Message& msg,
McapMessage& msg,
const DdsTopic& topic,
bool direct_write /* false */)
{
Expand All @@ -516,7 +517,7 @@ void McapHandler::add_data_nts_(
}

void McapHandler::add_to_pending_nts_(
Message& msg,
McapMessage& msg,
const DdsTopic& topic)
{
assert(configuration_.max_pending_samples != 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@
// limitations under the License.

/**
* @file Message.cpp
* @file McapMessage.cpp
*/

#include <fastdds/rtps/history/IPayloadPool.h>

#include <ddsrecorder_participants/recorder/mcap/Message.hpp>
#include <ddsrecorder_participants/recorder/mcap/McapMessage.hpp>


namespace eprosima {
namespace ddsrecorder {
namespace participants {

Message::Message(
const Message& msg)
McapMessage::McapMessage(
const McapMessage& msg)
: mcap::Message(msg)
{
auto ipayload_owner = const_cast<fastrtps::rtps::IPayloadPool*>(
Expand All @@ -39,7 +39,7 @@ Message::Message(
this->payload);
}

Message::~Message()
McapMessage::~McapMessage()
{
// If payload owner exists and payload has size, release it correctly in pool
if (payload_owner && payload.length > 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <cpp_utils/time/time_utils.hpp>
#include <cpp_utils/utils.hpp>

#include <ddsrecorder_participants/recorder/mcap/McapMessage.hpp>
#include <ddsrecorder_participants/recorder/mcap/McapWriter.hpp>
#include <ddsrecorder_participants/recorder/monitoring/producers/DdsRecorderStatusMonitorProducer.hpp>
#include <ddsrecorder_participants/recorder/output/FullDiskException.hpp>
Expand Down Expand Up @@ -246,7 +247,7 @@ void McapWriter::write_nts_(

template <>
void McapWriter::write_nts_(
const Message& msg)
const McapMessage& msg)
{
if (!enabled_)
{
Expand Down

0 comments on commit dcc9f62

Please sign in to comment.