From bdc8343eb9e553e244221ada18c45bf05209a113 Mon Sep 17 00:00:00 2001 From: rex-schilasky <49162693+rex-schilasky@users.noreply.github.com> Date: Tue, 23 Apr 2024 16:21:59 +0200 Subject: [PATCH] clang-tidy renamings (topic_info -> datatype_info) --- ecal/core/include/ecal/ecal_publisher.h | 20 +++++++++---------- .../include/ecal/msg/capnproto/publisher.h | 10 +++++----- .../include/ecal/msg/flatbuffers/publisher.h | 6 +++--- .../include/ecal/msg/messagepack/publisher.h | 6 +++--- .../ecal/msg/protobuf/dynamic_publisher.h | 10 +++++----- .../include/ecal/msg/protobuf/publisher.h | 10 +++++----- ecal/core/include/ecal/msg/publisher.h | 18 ++++++++--------- ecal/core/include/ecal/msg/string/publisher.h | 12 +++++------ ecal/core/src/pubsub/ecal_publisher.cpp | 8 +++----- ecal/core/src/readwrite/ecal_writer.cpp | 12 ++--------- 10 files changed, 51 insertions(+), 61 deletions(-) diff --git a/ecal/core/include/ecal/ecal_publisher.h b/ecal/core/include/ecal/ecal_publisher.h index 7abf965..6f48682 100644 --- a/ecal/core/include/ecal/ecal_publisher.h +++ b/ecal/core/include/ecal/ecal_publisher.h @@ -112,11 +112,11 @@ namespace eCAL /** * @brief Constructor. * - * @param topic_name_ Unique topic name. - * @param topic_info_ Topic information (encoding, type, descriptor) - * @param config_ Optional configuration parameters. + * @param topic_name_ Unique topic name. + * @param data_type_info_ Topic data type information (encoding, type, descriptor). + * @param config_ Optional configuration parameters. **/ - ECAL_API CPublisher(const std::string& topic_name_, const SDataTypeInformation& topic_info_, const Config& config_ = {}); + ECAL_API CPublisher(const std::string& topic_name_, const SDataTypeInformation& data_type_info_, const Config& config_ = {}); /** * @brief Constructor. @@ -154,13 +154,13 @@ namespace eCAL /** * @brief Creates this object. * - * @param topic_name_ Unique topic name. - * @param topic_info_ Topic information (encoding, type, descriptor) - * @param config_ Optional configuration parameters. + * @param topic_name_ Unique topic name. + * @param data_type_info_ Topic data type information (encoding, type, descriptor). + * @param config_ Optional configuration parameters. * * @return True if it succeeds, false if it fails. **/ - ECAL_API bool Create(const std::string& topic_name_, const SDataTypeInformation& topic_info_, const Config& config_ = {}); + ECAL_API bool Create(const std::string& topic_name_, const SDataTypeInformation& data_type_info_, const Config& config_ = {}); /** * @brief Creates this object. @@ -181,11 +181,11 @@ namespace eCAL /** * @brief Setup topic information. * - * @param topic_info_ Topic information attributes. + * @param data_type_info_ Topic data type information attributes. * * @return True if it succeeds, false if it fails. **/ - ECAL_API bool SetDataTypeInformation(const SDataTypeInformation& topic_info_); + ECAL_API bool SetDataTypeInformation(const SDataTypeInformation& data_type_info_); /** * @brief Sets publisher attribute. diff --git a/ecal/core/include/ecal/msg/capnproto/publisher.h b/ecal/core/include/ecal/msg/capnproto/publisher.h index c13e5a4..6108a2f 100644 --- a/ecal/core/include/ecal/msg/capnproto/publisher.h +++ b/ecal/core/include/ecal/msg/capnproto/publisher.h @@ -174,11 +174,11 @@ namespace eCAL **/ SDataTypeInformation GetDataTypeInformation() const { - SDataTypeInformation topic_info; - topic_info.encoding = eCAL::capnproto::EncodingAsString(); - topic_info.name = eCAL::capnproto::TypeAsString(); - topic_info.descriptor = eCAL::capnproto::SchemaAsString(); - return topic_info; + SDataTypeInformation data_type_info; + data_type_info.encoding = eCAL::capnproto::EncodingAsString(); + data_type_info.name = eCAL::capnproto::TypeAsString(); + data_type_info.descriptor = eCAL::capnproto::SchemaAsString(); + return data_type_info; } std::unique_ptr builder; diff --git a/ecal/core/include/ecal/msg/flatbuffers/publisher.h b/ecal/core/include/ecal/msg/flatbuffers/publisher.h index 8105064..1af1df9 100644 --- a/ecal/core/include/ecal/msg/flatbuffers/publisher.h +++ b/ecal/core/include/ecal/msg/flatbuffers/publisher.h @@ -98,10 +98,10 @@ namespace eCAL **/ SDataTypeInformation GetDataTypeInformation() const override { - SDataTypeInformation topic_info; - topic_info.encoding = "flatb"; + SDataTypeInformation data_type_info; + data_type_info.encoding = "flatb"; // empty type, empty descriptor - return topic_info; + return data_type_info; } /** diff --git a/ecal/core/include/ecal/msg/messagepack/publisher.h b/ecal/core/include/ecal/msg/messagepack/publisher.h index 2947568..c5c859e 100644 --- a/ecal/core/include/ecal/msg/messagepack/publisher.h +++ b/ecal/core/include/ecal/msg/messagepack/publisher.h @@ -101,10 +101,10 @@ namespace eCAL **/ SDataTypeInformation GetDataTypeInformation() const override { - SDataTypeInformation topic_info; - topic_info.encoding = "mpack"; + SDataTypeInformation data_type_info; + data_type_info.encoding = "mpack"; // empty descriptor, empty descriptor - return topic_info; + return data_type_info; } /** diff --git a/ecal/core/include/ecal/msg/protobuf/dynamic_publisher.h b/ecal/core/include/ecal/msg/protobuf/dynamic_publisher.h index 532f7e2..7eedb26 100644 --- a/ecal/core/include/ecal/msg/protobuf/dynamic_publisher.h +++ b/ecal/core/include/ecal/msg/protobuf/dynamic_publisher.h @@ -141,11 +141,11 @@ namespace eCAL assert(msg_ptr_); if(msg_ptr_ == nullptr) return SDataTypeInformation(); - SDataTypeInformation topic_info; - topic_info.encoding = "proto"; - topic_info.name = msg_ptr_->GetTypeName(); - topic_info.descriptor = GetDescriptorFromMessage(msg_ptr_); - return topic_info; + SDataTypeInformation data_type_info; + data_type_info.encoding = "proto"; + data_type_info.name = msg_ptr_->GetTypeName(); + data_type_info.descriptor = GetDescriptorFromMessage(msg_ptr_); + return data_type_info; } static std::string GetDescriptorFromMessage(const google::protobuf::Message* msg_ptr_) diff --git a/ecal/core/include/ecal/msg/protobuf/publisher.h b/ecal/core/include/ecal/msg/protobuf/publisher.h index a22c2fc..cf47130 100644 --- a/ecal/core/include/ecal/msg/protobuf/publisher.h +++ b/ecal/core/include/ecal/msg/protobuf/publisher.h @@ -172,12 +172,12 @@ namespace eCAL **/ struct SDataTypeInformation GetDataTypeInformation() const { - struct SDataTypeInformation topic_info; + struct SDataTypeInformation data_type_info; static T msg{}; - topic_info.encoding = "proto"; - topic_info.name = msg.GetTypeName(); - topic_info.descriptor = protobuf::GetProtoMessageDescription(msg); - return topic_info; + data_type_info.encoding = "proto"; + data_type_info.name = msg.GetTypeName(); + data_type_info.descriptor = protobuf::GetProtoMessageDescription(msg); + return data_type_info; } }; diff --git a/ecal/core/include/ecal/msg/publisher.h b/ecal/core/include/ecal/msg/publisher.h index dbc0c33..8b76f6e 100644 --- a/ecal/core/include/ecal/msg/publisher.h +++ b/ecal/core/include/ecal/msg/publisher.h @@ -59,11 +59,11 @@ namespace eCAL * @brief Constructor, that automatically intializes the Publisher. * This should be the preferred constructor. * - * @param topic_name_ Unique topic name. - * @param topic_info_ Struct that contains information of the datatype (name, encoding, description) of the topic. - * @param config_ Optional configuration parameters. + * @param topic_name_ Unique topic name. + * @param data_type_info_ Topic data type information (encoding, type, descriptor). + * @param config_ Optional configuration parameters. **/ - CMsgPublisher(const std::string& topic_name_, const struct SDataTypeInformation& topic_info_, const Config& config_ = {}) : CPublisher(topic_name_, topic_info_, config_) + CMsgPublisher(const std::string& topic_name_, const struct SDataTypeInformation& data_type_info_, const Config& config_ = {}) : CPublisher(topic_name_, data_type_info_, config_) { } @@ -103,15 +103,15 @@ namespace eCAL /** * @brief Creates this object. * - * @param topic_name_ Unique topic name. - * @param topic_info_ Associated datatype description. - * @param config_ Optional configuration parameters. + * @param topic_name_ Unique topic name. + * @param data_type_info_ Topic data type information (encoding, type, descriptor). + * @param config_ Optional configuration parameters. * * @return True if it succeeds, false if it fails. **/ - bool Create(const std::string& topic_name_, const struct SDataTypeInformation& topic_info_, const Config& config_ = {}) + bool Create(const std::string& topic_name_, const struct SDataTypeInformation& data_type_info_, const Config& config_ = {}) { - return(CPublisher::Create(topic_name_, topic_info_, config_)); + return(CPublisher::Create(topic_name_, data_type_info_, config_)); } /** diff --git a/ecal/core/include/ecal/msg/string/publisher.h b/ecal/core/include/ecal/msg/string/publisher.h index e0c2ed5..629d539 100644 --- a/ecal/core/include/ecal/msg/string/publisher.h +++ b/ecal/core/include/ecal/msg/string/publisher.h @@ -105,11 +105,11 @@ namespace eCAL **/ SDataTypeInformation GetDataTypeInformation() const override { - SDataTypeInformation topic_info; - topic_info.encoding = "base"; - topic_info.name = "std::string"; + SDataTypeInformation data_type_info; + data_type_info.encoding = "base"; + data_type_info.name = "std::string"; // empty descriptor - return topic_info; + return data_type_info; } /** @@ -117,7 +117,7 @@ namespace eCAL * * @param msg_ The message object. * - * @return String site. + * @return String size. **/ size_t GetSize(const T& msg_) const override { @@ -144,7 +144,7 @@ namespace eCAL } }; /** @example minimal_snd.cpp - * This is an example how to use eCAL::CPublisher to send a std::string with eCAL. To receive the strings, see @ref minimal_rec.cpp . + * This is an example how to use eCAL::string::CPublisher to send a std::string with eCAL. To receive the strings, see @ref minimal_rec.cpp . **/ } } diff --git a/ecal/core/src/pubsub/ecal_publisher.cpp b/ecal/core/src/pubsub/ecal_publisher.cpp index a3f7ce0..922cfba 100644 --- a/ecal/core/src/pubsub/ecal_publisher.cpp +++ b/ecal/core/src/pubsub/ecal_publisher.cpp @@ -35,7 +35,9 @@ namespace eCAL { - CPublisher::Config::Config() + CPublisher::Config::Config() : + share_topic_type(eCAL::Config::IsTopicTypeSharingEnabled()), + share_topic_description(eCAL::Config::IsTopicDescriptionSharingEnabled()) { // shm config shm.send_mode = eCAL::Config::GetPublisherShmMode(); @@ -48,10 +50,6 @@ namespace eCAL // tcp config tcp.send_mode = eCAL::Config::GetPublisherTcpMode(); - - // allow to share topic type/description - share_topic_type = eCAL::Config::IsTopicTypeSharingEnabled(); - share_topic_description = eCAL::Config::IsTopicDescriptionSharingEnabled(); } CPublisher::CPublisher() : diff --git a/ecal/core/src/readwrite/ecal_writer.cpp b/ecal/core/src/readwrite/ecal_writer.cpp index 69a4324..c20e95f 100644 --- a/ecal/core/src/readwrite/ecal_writer.cpp +++ b/ecal/core/src/readwrite/ecal_writer.cpp @@ -73,6 +73,8 @@ namespace eCAL m_host_group_name(Process::GetHostGroupName()), m_pid(Process::GetProcessID()), m_pname(Process::GetProcessName()), + m_topic_name(topic_name_), + m_topic_info(topic_info_), m_topic_size(0), m_buffering_shm(PUB_MEMFILE_BUF_COUNT), m_zero_copy(PUB_MEMFILE_ZERO_COPY), @@ -87,16 +89,6 @@ namespace eCAL m_share_tdesc(true), m_created(false) { - // set defaults - m_topic_name = topic_name_; - m_topic_id.clear(); - m_topic_info = topic_info_; - m_id = 0; - m_clock = 0; - m_connected = false; - m_ext_subscribed = false; - m_created = false; - // configure Configure(config_);