Skip to content

Commit

Permalink
Uncrustify
Browse files Browse the repository at this point in the history
Signed-off-by: Lucia Echevarria <[email protected]>
  • Loading branch information
LuciaEchevarria99 committed Sep 17, 2024
1 parent 7d3a546 commit b8da53c
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ option::ArgStatus Arg::Readable_File(
}
if (msg)
{
EPROSIMA_LOG_ERROR(DDSRECORDER_ARGS, "Option '" << option << "' requires an existing readable file as argument.");
EPROSIMA_LOG_ERROR(DDSRECORDER_ARGS,
"Option '" << option << "' requires an existing readable file as argument.");
}
return option::ARG_ILLEGAL;
}
Expand Down
9 changes: 5 additions & 4 deletions ddsrecorder/test/blackbox/mcap/McapFileCreationTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,21 +137,22 @@ void create_publisher(
eprosima::fastdds::dds::xtypes::TypeObjectPair dyn_type_objects;
if (eprosima::fastdds::dds::RETCODE_OK !=
eprosima::fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_objects(
type_name,
dyn_type_objects))
type_name,
dyn_type_objects))
{
EPROSIMA_LOG_WARNING(DDSRECORDER_TEST, "Failed to get TypeObjects for type with name " << type_name);
return;
}

test::dynamic_type_ = eprosima::fastdds::dds::DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object(
dyn_type_objects.complete_type_object)->build();
dyn_type_objects.complete_type_object)->build();

// Create the Publisher
eprosima::fastdds::dds::Publisher* publisher_ = participant_->create_publisher(PUBLISHER_QOS_DEFAULT, nullptr);

// Register the (dynamic) type support in the Participant
eprosima::fastdds::dds::TypeSupport dyn_type_support(new eprosima::fastdds::dds::DynamicPubSubType(test::dynamic_type_));
eprosima::fastdds::dds::TypeSupport dyn_type_support(new eprosima::fastdds::dds::DynamicPubSubType(test::
dynamic_type_));
participant_->register_type(dyn_type_support);

// Create the DDS Topic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ void McapWriter::write(
}
catch (const FullDiskException& e)
{
EPROSIMA_LOG_ERROR(DDSRECORDER_MCAP_HANDLER, "FAIL_MCAP_WRITE | Disk is full. Error message:\n " << e.what());
EPROSIMA_LOG_ERROR(DDSRECORDER_MCAP_HANDLER,
"FAIL_MCAP_WRITE | Disk is full. Error message:\n " << e.what());
on_disk_full_();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
#include <ddsrecorder_participants/library/library_dll.h>

#include <ddsrecorder_participants/common/types/monitoring/ddsrecorder_status/DdsRecorderMonitoringStatus.hpp>
#include <ddsrecorder_participants/common/types/monitoring/ddsrecorder_status/DdsRecorderMonitoringStatusPubSubTypes.hpp>
#include <ddsrecorder_participants/common/types/monitoring/ddsrecorder_status/DdsRecorderMonitoringStatusTypeObjectSupport.hpp>
#include \
<ddsrecorder_participants/common/types/monitoring/ddsrecorder_status/DdsRecorderMonitoringStatusPubSubTypes.hpp>
#include \
<ddsrecorder_participants/common/types/monitoring/ddsrecorder_status/DdsRecorderMonitoringStatusTypeObjectSupport.hpp>

namespace eprosima {
namespace ddsrecorder {
Expand Down
44 changes: 25 additions & 19 deletions ddsrecorder_participants/src/cpp/recorder/mcap/McapHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ void McapHandler::add_schema(
if (ret != fastdds::dds::RETCODE_OK)
{
EPROSIMA_LOG_ERROR(
DDSRECORDER_MCAP_HANDLER, "MCAP_WRITE | Failed to serialize DynamicType to idl for type with name: " << type_name);
DDSRECORDER_MCAP_HANDLER,
"MCAP_WRITE | Failed to serialize DynamicType to idl for type with name: " << type_name);
return;
}
data = idl.str();
Expand Down Expand Up @@ -879,12 +880,14 @@ bool McapHandler::store_dynamic_type_(
type_identifiers.type_identifier1(type_identifier);

fastdds::dds::xtypes::TypeInformation type_info;
if (fastdds::dds::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information(
type_identifiers,
type_info,
true))
if (fastdds::dds::RETCODE_OK !=
fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_information(
type_identifiers,
type_info,
true))
{
EPROSIMA_LOG_WARNING(DDSRECORDER_MCAP_HANDLER, "MCAP_WRITE | Error getting TypeInformation for type " << type_name);
EPROSIMA_LOG_WARNING(DDSRECORDER_MCAP_HANDLER,
"MCAP_WRITE | Error getting TypeInformation for type " << type_name);
return false;
}

Expand All @@ -897,12 +900,13 @@ bool McapHandler::store_dynamic_type_(
dependency_type_identifier = dependency.type_id();

fastdds::dds::xtypes::TypeObject dependency_type_object;
if (fastdds::dds::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object(
dependency_type_identifier,
dependency_type_object))
if (fastdds::dds::RETCODE_OK !=
fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object(
dependency_type_identifier,
dependency_type_object))
{
EPROSIMA_LOG_WARNING(DDSRECORDER_MCAP_HANDLER, "MCAP_WRITE | Error getting TypeObject of dependency "
<< "for type " << type_name);
<< "for type " << type_name);
return false;
}

Expand All @@ -916,9 +920,10 @@ bool McapHandler::store_dynamic_type_(
}

fastdds::dds::xtypes::TypeObject type_object;
if (fastdds::dds::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object(
type_identifier,
type_object))
if (fastdds::dds::RETCODE_OK !=
fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object(
type_identifier,
type_object))
{
EPROSIMA_LOG_WARNING(DDSRECORDER_MCAP_HANDLER, "MCAP_WRITE | Error getting TypeObject for type " << type_name);
return false;
Expand Down Expand Up @@ -1029,7 +1034,7 @@ std::string McapHandler::serialize_type_data_(
fastcdr::CdrSizeCalculator calculator(fastcdr::CdrVersion::XCDRv2);
size_t current_alignment {0};
size_t size = calculator.calculate_serialized_size(type_data, current_alignment) +
fastdds::rtps::SerializedPayload_t::representation_header_size;
fastdds::rtps::SerializedPayload_t::representation_header_size;

fastdds::rtps::SerializedPayload_t payload(static_cast<uint32_t>(size));
fastcdr::FastBuffer fastbuffer((char*) payload.data, payload.max_size);
Expand All @@ -1049,22 +1054,23 @@ std::string McapHandler::serialize_type_data_(
std::unique_ptr<fastdds::rtps::CDRMessage_t> cdr_message = std::make_unique<fastdds::rtps::CDRMessage_t>(payload);

// Add data
if (!(cdr_message && (cdr_message->pos + payload.length <= cdr_message->max_size))|| (payload.length > 0 && !payload.data))
if (!(cdr_message && (cdr_message->pos + payload.length <= cdr_message->max_size)) ||
(payload.length > 0 && !payload.data))
{
if (!cdr_message)
{
throw utils::InconsistencyException(
"Error adding data -> cdr_message is null.");
"Error adding data -> cdr_message is null.");
}
else if (cdr_message->pos + payload.length > cdr_message->max_size)
{
throw utils::InconsistencyException(
"Error adding data -> not enough space in cdr_message buffer.");
"Error adding data -> not enough space in cdr_message buffer.");
}
else if (payload.length > 0 && !payload.data)
{
throw utils::InconsistencyException(
"Error adding data -> payload length is greater than 0, but payload data is null.");
"Error adding data -> payload length is greater than 0, but payload data is null.");
}
}

Expand All @@ -1079,7 +1085,7 @@ std::string McapHandler::serialize_type_data_(
if (!(cdr_message && (cdr_message->pos + size_octet <= cdr_message->max_size)))
{
throw utils::InconsistencyException(
"Not enough space in cdr_message buffer.");
"Not enough space in cdr_message buffer.");
}
for (uint32_t i = 0; i < size_octet; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
#include <ddsrecorder_participants/recorder/monitoring/producers/DdsRecorderStatusMonitorProducer.hpp>

#include <ddsrecorder_participants/common/types/monitoring/ddsrecorder_status/DdsRecorderMonitoringStatus.hpp>
#include <ddsrecorder_participants/common/types/monitoring/ddsrecorder_status/DdsRecorderMonitoringStatusPubSubTypes.hpp>
#include \
<ddsrecorder_participants/common/types/monitoring/ddsrecorder_status/DdsRecorderMonitoringStatusPubSubTypes.hpp>

#include <ddsrecorder_participants/recorder/monitoring/DdsRecorderMonitor.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ void DdsRecorderStatusMonitorProducer::register_consumer(
{
if (!enabled_)
{
EPROSIMA_LOG_WARNING(DDSRECORDER_MONITOR, "MONITOR | Not registering consumer " << consumer->get_name() << " on "
EPROSIMA_LOG_WARNING(DDSRECORDER_MONITOR,
"MONITOR | Not registering consumer " << consumer->get_name() << " on "
"DdsRecorderStatusMonitorProducer since the DdsRecorderStatusMonitorProducer is disabled.");

return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ std::shared_ptr<IReader> McapReaderParticipant::create_reader(
{
if (!utils::can_cast<DdsTopic>(topic))
{
EPROSIMA_LOG_WARNING(DDSREPLAYER_MCAP_READER_PARTICIPANT, "Not creating Writer for topic " << topic.topic_name());
EPROSIMA_LOG_WARNING(DDSREPLAYER_MCAP_READER_PARTICIPANT,
"Not creating Writer for topic " << topic.topic_name());
return std::make_shared<BlankReader>();
}

Expand Down Expand Up @@ -148,7 +149,8 @@ void McapReaderParticipant::process_mcap()
}
else
{
EPROSIMA_LOG_WARNING(DDSREPLAYER_MCAP_READER_PARTICIPANT, "Provided input file contains no messages in the given range.");
EPROSIMA_LOG_WARNING(DDSREPLAYER_MCAP_READER_PARTICIPANT,
"Provided input file contains no messages in the given range.");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
#include <ddsrecorder_participants/recorder/monitoring/producers/DdsRecorderStatusMonitorProducer.hpp>

#include <ddsrecorder_participants/common/types/monitoring/ddsrecorder_status/DdsRecorderMonitoringStatus.hpp>
#include <ddsrecorder_participants/common/types/monitoring/ddsrecorder_status/DdsRecorderMonitoringStatusPubSubTypes.hpp>
#include \
<ddsrecorder_participants/common/types/monitoring/ddsrecorder_status/DdsRecorderMonitoringStatusPubSubTypes.hpp>

#include "../../constants.hpp"

Expand Down
11 changes: 6 additions & 5 deletions ddsreplayer/src/cpp/tool/DdsReplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ void DdsReplayer::register_dynamic_type_(
type_identifiers.type_identifier1(type_identifier);

// Register in factory
if (fastdds::dds::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().register_type_object(
if (fastdds::dds::RETCODE_OK !=
fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().register_type_object(
type_object, type_identifiers))
{
EPROSIMA_LOG_WARNING(DDSREPLAYER_REPLAYER,
Expand Down Expand Up @@ -352,28 +353,28 @@ DynamicTypeData DdsReplayer::deserialize_type_data_(
if (!cdr_message)
{
throw utils::InconsistencyException(
"Error reading data -> cdr_message is null.");
"Error reading data -> cdr_message is null.");
}

// Check enough space in buffer
if (!(cdr_message->length >= cdr_message->pos + parameter_length))
{
throw utils::InconsistencyException(
"Error reading data -> not enough space in cdr_message buffer.");
"Error reading data -> not enough space in cdr_message buffer.");
}

// Check length is consistent
if (!(parameter_length > 0))
{
throw utils::InconsistencyException(
"Error reading data -> payload length is greater than 0.");
"Error reading data -> payload length is greater than 0.");
}

// Check payload is valid
if (!payload.data)
{
throw utils::InconsistencyException(
"Error reading data -> payload data is null.");
"Error reading data -> payload data is null.");
}

// Copy data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ option::ArgStatus Arg::Readable_File(
}
if (msg)
{
EPROSIMA_LOG_ERROR(DDSREPLAYER_ARGS, "Option '" << option << "' requires an existing readable file as argument.");
EPROSIMA_LOG_ERROR(DDSREPLAYER_ARGS,
"Option '" << option << "' requires an existing readable file as argument.");
}
return option::ARG_ILLEGAL;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void ConfigurationDynTypesSubscriber::on_data_available(
{
// Dynamic DataType
eprosima::fastdds::dds::DynamicData::_ref_type new_data =
eprosima::fastdds::dds::DynamicDataFactory::get_instance()->create_data(dynamic_type_);
eprosima::fastdds::dds::DynamicDataFactory::get_instance()->create_data(dynamic_type_);

SampleInfo info;

Expand Down Expand Up @@ -175,9 +175,9 @@ void ConfigurationDynTypesSubscriber::on_data_writer_discovery(
}

void ConfigurationDynTypesSubscriber::notify_type_discovered_(
const fastdds::dds::xtypes::TypeInformation& type_info,
const fastcdr::string_255& type_name,
const fastcdr::string_255& topic_name)
const fastdds::dds::xtypes::TypeInformation& type_info,
const fastcdr::string_255& type_name,
const fastcdr::string_255& topic_name)
{
// First check if the topic received is the one we are expecting
if (topic_name.to_string() != topic_name_)
Expand All @@ -198,16 +198,18 @@ void ConfigurationDynTypesSubscriber::notify_type_discovered_(

const auto type_identifier = type_info.complete().typeid_with_size().type_id();
fastdds::dds::xtypes::TypeObject dyn_type_object;
if (fastdds::dds::RETCODE_OK != fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object(
type_identifier,
dyn_type_object))
if (fastdds::dds::RETCODE_OK !=
fastdds::dds::DomainParticipantFactory::get_instance()->type_object_registry().get_type_object(
type_identifier,
dyn_type_object))
{
return;
}

// Create Dynamic Type
fastdds::dds::DynamicType::_ref_type dyn_type = fastdds::dds::DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object(
dyn_type_object)->build();
fastdds::dds::DynamicType::_ref_type dyn_type =
fastdds::dds::DynamicTypeBuilderFactory::get_instance()->create_type_w_type_object(
dyn_type_object)->build();
if (!dyn_type)
{
return;
Expand Down

0 comments on commit b8da53c

Please sign in to comment.