From 19b2b7ff5f95f14314e4ce151a961b120d382acc Mon Sep 17 00:00:00 2001 From: Kerstin Keller Date: Wed, 19 Jul 2023 14:19:55 +0200 Subject: [PATCH] Core: Final API renaming for 5.12 GetTopicInformation -> GetDataTypeInformation SetTopicInformation -> SetDataTypeInformation SDataTypeInformation --- app/mon/mon_cli/src/ecal_mon_cli.cpp | 6 +- .../src/widgets/models/topic_tree_item.cpp | 16 ++-- ecal/core/CMakeLists.txt | 2 +- ecal/core/include/ecal/ecal_callback.h | 38 ++++----- .../include/ecal/ecal_monitoring_struct.h | 4 +- ecal/core/include/ecal/ecal_publisher.h | 27 +++---- ecal/core/include/ecal/ecal_server.h | 1 + ecal/core/include/ecal/ecal_subscriber.h | 18 ++--- .../topic_information.h => ecal_types.h} | 46 ++++++++++- ecal/core/include/ecal/ecal_util.h | 43 +++++----- .../core/include/ecal/msg/capnproto/dynamic.h | 14 ++-- .../include/ecal/msg/capnproto/publisher.h | 10 +-- .../include/ecal/msg/capnproto/subscriber.h | 16 ++-- .../include/ecal/msg/flatbuffers/publisher.h | 8 +- .../include/ecal/msg/flatbuffers/subscriber.h | 8 +- .../include/ecal/msg/messagepack/publisher.h | 8 +- .../include/ecal/msg/messagepack/subscriber.h | 8 +- .../ecal/msg/protobuf/dynamic_publisher.h | 8 +- .../ecal/msg/protobuf/dynamic_subscriber.h | 6 +- .../include/ecal/msg/protobuf/publisher.h | 22 ++--- .../include/ecal/msg/protobuf/subscriber.h | 10 +-- ecal/core/include/ecal/msg/publisher.h | 24 +++--- ecal/core/include/ecal/msg/string/publisher.h | 10 +-- .../core/include/ecal/msg/string/subscriber.h | 10 +-- ecal/core/include/ecal/msg/subscriber.h | 20 ++--- ecal/core/src/ecal_descgate.cpp | 52 ++++++------ ecal/core/src/ecal_descgate.h | 24 +++--- ecal/core/src/ecal_registration_provider.cpp | 36 +++++---- ecal/core/src/ecal_registration_provider.h | 8 +- ecal/core/src/ecal_sample_to_topicinfo.h | 26 +++--- ecal/core/src/ecal_util.cpp | 20 ++--- ecal/core/src/mon/ecal_monitoring_impl.cpp | 25 +++--- .../src/pubsub/ecal_proto_dyn_json_sub.cpp | 6 +- ecal/core/src/pubsub/ecal_pubgate.cpp | 8 +- ecal/core/src/pubsub/ecal_pubgate.h | 2 +- ecal/core/src/pubsub/ecal_publisher.cpp | 60 +++++++------- ecal/core/src/pubsub/ecal_subgate.cpp | 8 +- ecal/core/src/pubsub/ecal_subgate.h | 2 +- ecal/core/src/pubsub/ecal_subscriber.cpp | 26 +++--- ecal/core/src/readwrite/ecal_reader.cpp | 66 +++++++-------- ecal/core/src/readwrite/ecal_reader.h | 18 ++--- ecal/core/src/readwrite/ecal_writer.cpp | 56 ++++++------- ecal/core/src/readwrite/ecal_writer.h | 16 ++-- ecal/core/src/service/ecal_clientgate.cpp | 21 +++-- ecal/core/src/service/ecal_clientgate.h | 6 +- ecal/core/src/service/ecal_service_server.cpp | 8 +- .../src/service/ecal_service_server_impl.cpp | 40 +++++----- .../src/service/ecal_service_server_impl.h | 8 +- ecal/core_pb/src/ecal/core/pb/topic.proto | 56 ++++++------- .../src/many_connections_rec.cpp | 2 +- .../src/many_connections_snd.cpp | 2 +- .../performance_rec/src/performance_rec.cpp | 4 +- .../src/monitoring_get_services.cpp | 2 +- .../src/monitoring_get_topics.cpp | 2 +- samples/cpp/pubsub/binary/ping/src/ping.cpp | 2 +- samples/cpp/pubsub/binary/pong/src/pong.cpp | 2 +- .../src/person_rec_events.cpp | 4 +- .../src/person_snd_events.cpp | 4 +- .../ecal/pubsub_test/src/pubsub_gettopics.cpp | 38 ++++----- testing/ecal/pubsub_test/src/pubsub_test.cpp | 80 +++++++++---------- 60 files changed, 582 insertions(+), 541 deletions(-) rename ecal/core/include/ecal/{types/topic_information.h => ecal_types.h} (52%) diff --git a/app/mon/mon_cli/src/ecal_mon_cli.cpp b/app/mon/mon_cli/src/ecal_mon_cli.cpp index 166fc0145c..114e3e319e 100644 --- a/app/mon/mon_cli/src/ecal_mon_cli.cpp +++ b/app/mon/mon_cli/src/ecal_mon_cli.cpp @@ -352,9 +352,9 @@ void ProcProto(const std::string& topic_name, int msg_count) std::this_thread::sleep_for(std::chrono::milliseconds(1000)); // get topic type - eCAL::STopicInformation topic_info; - eCAL::Util::GetTopicInformation(topic_name, topic_info); - if(topic_info.type.empty()) + eCAL::SDataTypeInformation topic_info; + eCAL::Util::GetTopicDataTypeInformation(topic_name, topic_info); + if(topic_info.name.empty()) { std::cout << "could not get type for topic " << topic_name << std::endl; return; diff --git a/app/mon/mon_gui/src/widgets/models/topic_tree_item.cpp b/app/mon/mon_gui/src/widgets/models/topic_tree_item.cpp index 6ea5976875..deab1a7cc4 100644 --- a/app/mon/mon_gui/src/widgets/models/topic_tree_item.cpp +++ b/app/mon/mon_gui/src/widgets/models/topic_tree_item.cpp @@ -84,7 +84,7 @@ QVariant TopicTreeItem::data(Columns column, Qt::ItemDataRole role) const { // When the monitor didn't tell us the topic encoding, we ask eCAL::Util instead // Why this logic only for type, not descriptor? (and thus encoding?) - const std::string monitor_topic_encoding = topic_.tinfo().encoding(); + const std::string monitor_topic_encoding = topic_.tdatatype().encoding(); if (!monitor_topic_encoding.empty()) { return monitor_topic_encoding.c_str(); @@ -94,8 +94,8 @@ QVariant TopicTreeItem::data(Columns column, Qt::ItemDataRole role) const const std::string monitor_topic_name = topic_.tname(); if (!monitor_topic_name.empty()) { - eCAL::STopicInformation topic_info; - eCAL::Util::GetTopicInformation(monitor_topic_name, topic_info); + eCAL::SDataTypeInformation topic_info; + eCAL::Util::GetTopicDataTypeInformation(monitor_topic_name, topic_info); return topic_info.encoding.c_str(); } } @@ -104,7 +104,7 @@ QVariant TopicTreeItem::data(Columns column, Qt::ItemDataRole role) const { // When the monitor didn't tell us the topic type, we ask eCAL::Util instead // Why this logic only for type, not descriptor? (and thus encoding?) - const std::string monitor_topic_type = topic_.tinfo().type(); + const std::string monitor_topic_type = topic_.tdatatype().name(); if (!monitor_topic_type.empty()) { return monitor_topic_type.c_str(); @@ -114,15 +114,15 @@ QVariant TopicTreeItem::data(Columns column, Qt::ItemDataRole role) const const std::string monitor_topic_name = topic_.tname(); if (!monitor_topic_name.empty()) { - eCAL::STopicInformation topic_info; - eCAL::Util::GetTopicInformation(monitor_topic_name, topic_info); - return topic_info.type.c_str(); + eCAL::SDataTypeInformation topic_info; + eCAL::Util::GetTopicDataTypeInformation(monitor_topic_name, topic_info); + return topic_info.name.c_str(); } } } else if (column == Columns::TDESC) { - return topic_.tinfo().desc().c_str(); + return topic_.tdatatype().desc().c_str(); } else if (column == Columns::TQOS) { diff --git a/ecal/core/CMakeLists.txt b/ecal/core/CMakeLists.txt index e7c37fde6f..91cf0d38ec 100644 --- a/ecal/core/CMakeLists.txt +++ b/ecal/core/CMakeLists.txt @@ -345,7 +345,7 @@ set(ecal_header_cmn include/ecal/ecal_util.h include/ecal/ecalc.h include/ecal/ecalc_types.h - include/ecal/types/topic_information.h + include/ecal/ecal_types.h ) set(ecal_header_cimpl diff --git a/ecal/core/include/ecal/ecal_callback.h b/ecal/core/include/ecal/ecal_callback.h index 5755e30e8c..4d9f1cc57f 100644 --- a/ecal/core/include/ecal/ecal_callback.h +++ b/ecal/core/include/ecal/ecal_callback.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include @@ -64,15 +64,15 @@ namespace eCAL time = 0; clock = 0; }; - eCAL_Publisher_Event type; //!< publisher event type - long long time; //!< publisher event time in µs - long long clock; //!< publisher event clock - std::string tid; //!< topic id of the of the connected subscriber (for pub_event_update_connection only) - ECAL_DEPRECATE_SINCE_5_13("Use the separate infos encoding and type in member tinfo instead of ttype.") - std::string ttype; //!< topic type information of the connected publisher (for sub_event_update_connection only) - ECAL_DEPRECATE_SINCE_5_13("Use the tinfo.descriptor instead of tdesc.") - std::string tdesc; //!< topic descriptor information of the connected publisher (for sub_event_update_connection only) - STopicInformation tinfo; //!< topic information of the connected subscriber (for pub_event_update_connection only) + eCAL_Publisher_Event type; //!< publisher event type + long long time; //!< publisher event time in µs + long long clock; //!< publisher event clock + std::string tid; //!< topic id of the of the connected subscriber (for pub_event_update_connection only) + ECAL_DEPRECATE_SINCE_5_13("Use the separate infos encoding and type in member tdatatype instead of ttype.") + std::string ttype; //!< topic type information of the connected publisher (for sub_event_update_connection only) + ECAL_DEPRECATE_SINCE_5_13("Use the tdatatype.descriptor instead of tdesc.") + std::string tdesc; //!< topic descriptor information of the connected publisher (for sub_event_update_connection only) + SDataTypeInformation tdatatype; //!< datatype description of the connected subscriber (for pub_event_update_connection only) }; /** @@ -86,15 +86,15 @@ namespace eCAL time = 0; clock = 0; }; - eCAL_Subscriber_Event type; //!< subscriber event type - long long time; //!< subscriber event time in µs - long long clock; //!< subscriber event clock - std::string tid; //!< topic id of the of the connected publisher (for sub_event_update_connection only) - ECAL_DEPRECATE_SINCE_5_13("Use the separate infos encoding and type in member tinfo instead of ttype.") - std::string ttype; //!< topic type information of the connected publisher (for sub_event_update_connection only) - ECAL_DEPRECATE_SINCE_5_13("Use the tinfo.descriptor instead of tdesc.") - std::string tdesc; //!< topic descriptor information of the connected publisher (for sub_event_update_connection only) - STopicInformation tinfo; //!< topic information of the connected subscriber (for pub_event_update_connection only) + eCAL_Subscriber_Event type; //!< subscriber event type + long long time; //!< subscriber event time in µs + long long clock; //!< subscriber event clock + std::string tid; //!< topic id of the of the connected publisher (for sub_event_update_connection only) + ECAL_DEPRECATE_SINCE_5_13("Use the separate infos encoding and type in member tdatatype instead of ttype.") + std::string ttype; //!< topic type information of the connected publisher (for sub_event_update_connection only) + ECAL_DEPRECATE_SINCE_5_13("Use the tdatatype.descriptor instead of tdesc.") + std::string tdesc; //!< topic descriptor information of the connected publisher (for sub_event_update_connection only) + SDataTypeInformation tdatatype; //!< topic information of the connected subscriber (for pub_event_update_connection only) }; /** diff --git a/ecal/core/include/ecal/ecal_monitoring_struct.h b/ecal/core/include/ecal/ecal_monitoring_struct.h index 3867adf775..f8e00a082c 100644 --- a/ecal/core/include/ecal/ecal_monitoring_struct.h +++ b/ecal/core/include/ecal/ecal_monitoring_struct.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include @@ -66,7 +66,7 @@ namespace eCAL std::string tid; //!< topic id std::string tname; //!< topic name std::string direction; //!< direction (publisher, subscriber) - STopicInformation tinfo; //!< topic information (encoding, type, descriptor) + SDataTypeInformation tdatatype; //!< topic datatype description (encoding, type, descriptor) int tsize; //!< topic size bool tlayer_ecal_udp_mc; //!< transport layer udp active diff --git a/ecal/core/include/ecal/ecal_publisher.h b/ecal/core/include/ecal/ecal_publisher.h index e1f5fd36a2..ac0c96f60f 100644 --- a/ecal/core/include/ecal/ecal_publisher.h +++ b/ecal/core/include/ecal/ecal_publisher.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include @@ -86,7 +86,7 @@ namespace eCAL * @param topic_type_ Type name. * @param topic_desc_ Type description (optional). **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the constructor CPublisher(const std::string& topic_name_, const STopicInformation& topic_info_) instead. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use the constructor CPublisher(const std::string& topic_name_, const SDataTypeInformation& topic_info_) instead. This function will be removed in eCAL6.") ECAL_API CPublisher(const std::string& topic_name_, const std::string& topic_type_, const std::string& topic_desc_ = ""); /** @@ -95,7 +95,7 @@ namespace eCAL * @param topic_name_ Unique topic name. * @param topic_info_ Topic information (encoding, type, descriptor) **/ - ECAL_API CPublisher(const std::string& topic_name_, const STopicInformation& topic_info_); + ECAL_API CPublisher(const std::string& topic_name_, const SDataTypeInformation& topic_info_); /** * @brief Constructor. @@ -139,7 +139,7 @@ namespace eCAL * * @return True if it succeeds, false if it fails. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the create method bool Create(const std::string& topic_name_, const STopicInformation& topic_info_) instead. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use the create method bool Create(const std::string& topic_name_, const SDataTypeInformation& topic_info_) instead. This function will be removed in eCAL6.") ECAL_API bool Create(const std::string& topic_name_, const std::string& topic_type_, const std::string& topic_desc_ = ""); /** @@ -150,7 +150,7 @@ namespace eCAL * * @return True if it succeeds, false if it fails. **/ - ECAL_API bool Create(const std::string& topic_name_, const STopicInformation& topic_info_); + ECAL_API bool Create(const std::string& topic_name_, const SDataTypeInformation& topic_info_); /** * @brief Creates this object. @@ -162,10 +162,9 @@ namespace eCAL **/ ECAL_API bool Create(const std::string& topic_name_) { - return Create(topic_name_, STopicInformation()); + return Create(topic_name_, SDataTypeInformation()); } - /** * @brief Destroys this object. * @@ -180,7 +179,7 @@ namespace eCAL * * @return True if it succeeds, false if it fails. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the method bool SetTopicInformation(const STopicInformation& topic_info_) instead. This function will be removed in eCAL6") + ECAL_DEPRECATE_SINCE_5_13("Please use the method bool SetDataTypeInformation(const SDataTypeInformation& topic_info_) instead. This function will be removed in eCAL6") ECAL_API bool SetTypeName(const std::string& topic_type_name_); /** @@ -190,7 +189,7 @@ namespace eCAL * * @return True if it succeeds, false if it fails. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the method bool SetTopicInformation(const STopicInformation& topic_info_) instead. This function will be removed in eCAL6") + ECAL_DEPRECATE_SINCE_5_13("Please use the method bool SetDataTypeInformation(const SDataTypeInformation& topic_info_) instead. This function will be removed in eCAL6") ECAL_API bool SetDescription(const std::string& topic_desc_); /** @@ -200,7 +199,7 @@ namespace eCAL * * @return True if it succeeds, false if it fails. **/ - ECAL_API bool SetTopicInformation(const STopicInformation& topic_info_); + ECAL_API bool SetDataTypeInformation(const SDataTypeInformation& topic_info_); /** * @brief Sets publisher attribute. @@ -507,7 +506,7 @@ namespace eCAL * * @return The type name. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the method STopicInformation GetTopicInformation() instead. You can extract the typename from the STopicInformation variable. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use the method SDataTypeInformation GetDataTypeInformation() instead. You can extract the typename from the STopicInformation variable. This function will be removed in eCAL6.") ECAL_API std::string GetTypeName() const; /** @@ -515,7 +514,7 @@ namespace eCAL * * @return The description. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the method STopicInformation GetTopicInformation() instead. You can extract the descriptor from the STopicInformation variable. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use the method SDataTypeInformation GetDataTypeInformation() instead. You can extract the descriptor from the STopicInformation variable. This function will be removed in eCAL6.") ECAL_API std::string GetDescription() const; /** @@ -523,7 +522,7 @@ namespace eCAL * * @return The topic information. **/ - ECAL_API STopicInformation GetTopicInformation() const; + ECAL_API SDataTypeInformation GetDataTypeInformation() const; /** * @brief Dump the whole class state into a string. @@ -537,7 +536,7 @@ namespace eCAL protected: void InitializeQOS(); void InitializeTLayer(); - bool ApplyTopicToDescGate(const std::string& topic_name_, const STopicInformation& topic_info_); + bool ApplyTopicToDescGate(const std::string& topic_name_, const SDataTypeInformation& topic_info_); // class members std::shared_ptr m_datawriter; diff --git a/ecal/core/include/ecal/ecal_server.h b/ecal/core/include/ecal/ecal_server.h index 3a798f537d..4fb0028d49 100644 --- a/ecal/core/include/ecal/ecal_server.h +++ b/ecal/core/include/ecal/ecal_server.h @@ -24,6 +24,7 @@ #pragma once +#include #include #include #include diff --git a/ecal/core/include/ecal/ecal_subscriber.h b/ecal/core/include/ecal/ecal_subscriber.h index 2d5df538b1..132ff12373 100644 --- a/ecal/core/include/ecal/ecal_subscriber.h +++ b/ecal/core/include/ecal/ecal_subscriber.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include @@ -96,7 +96,7 @@ namespace eCAL * @param topic_type_ Type name (optional for type checking). * @param topic_desc_ Type description (optional for description checking). **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the constructor CSubscriber(const std::string& topic_name_, const STopicInformation& topic_info_) instead. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use the constructor CSubscriber(const std::string& topic_name_, const SDataTypeInformation& topic_info_) instead. This function will be removed in eCAL6.") ECAL_API CSubscriber(const std::string& topic_name_, const std::string& topic_type_, const std::string& topic_desc_ = ""); /** @@ -105,7 +105,7 @@ namespace eCAL * @param topic_name_ Unique topic name. * @param topic_info_ Topic information (encoding, type, descriptor) **/ - ECAL_API CSubscriber(const std::string& topic_name_, const STopicInformation& topic_info_); + ECAL_API CSubscriber(const std::string& topic_name_, const SDataTypeInformation& topic_info_); /** * @brief Constructor. @@ -159,7 +159,7 @@ namespace eCAL * @return True if it succeeds, false if it fails. **/ ECAL_API bool Create(const std::string& topic_name_) { - return Create(topic_name_, STopicInformation{}); + return Create(topic_name_, SDataTypeInformation{}); } /** @@ -170,7 +170,7 @@ namespace eCAL * * @return True if it succeeds, false if it fails. **/ - ECAL_API bool Create(const std::string& topic_name_, const STopicInformation& topic_info_); + ECAL_API bool Create(const std::string& topic_name_, const SDataTypeInformation& topic_info_); /** * @brief Destroys this object. @@ -309,7 +309,7 @@ namespace eCAL * * @return The type name. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the method STopicInformation GetTopicInformation() instead. You can extract the typename from the STopicInformation variable. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use the method SDataTypeInformation GetDataTypeInformation() instead. You can extract the typename from the STopicInformation variable. This function will be removed in eCAL6.") ECAL_API std::string GetTypeName() const; /** @@ -317,7 +317,7 @@ namespace eCAL * * @return The description. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the method STopicInformation GetTopicInformation() instead. You can extract the descriptor from the STopicInformation variable. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use the method SDataTypeInformation GetDataTypeInformation() instead. You can extract the descriptor from the STopicInformation variable. This function will be removed in eCAL6.") ECAL_API std::string GetDescription() const; /** @@ -325,7 +325,7 @@ namespace eCAL * * @return The topic information. **/ - ECAL_API STopicInformation GetTopicInformation() const; + ECAL_API SDataTypeInformation GetDataTypeInformation() const; /** * @brief Set the timeout parameter for triggering @@ -348,7 +348,7 @@ namespace eCAL protected: void InitializeQOS(); - bool ApplyTopicToDescGate(const std::string& topic_name_, const STopicInformation& topic_info_); + bool ApplyTopicToDescGate(const std::string& topic_name_, const SDataTypeInformation& topic_info_); // class members std::shared_ptr m_datareader; diff --git a/ecal/core/include/ecal/types/topic_information.h b/ecal/core/include/ecal/ecal_types.h similarity index 52% rename from ecal/core/include/ecal/types/topic_information.h rename to ecal/core/include/ecal/ecal_types.h index 121dcf7c6f..9a0cda8ab1 100644 --- a/ecal/core/include/ecal/types/topic_information.h +++ b/ecal/core/include/ecal/ecal_types.h @@ -31,15 +31,34 @@ namespace eCAL * @brief Optional compile time information associated with a given topic * (necessary for reflection / runtime type checking) **/ - struct STopicInformation + struct SDataTypeInformation { + std::string name; std::string encoding; - std::string type; std::string descriptor; + bool operator==(const SDataTypeInformation& other) const + { + return name == other.name && encoding == other.encoding && descriptor == other.descriptor; + } + + bool operator!=(const SDataTypeInformation& other) const + { + return !(*this == other); + } + }; + + /** + * @brief Optional compile time information associated with a given topic + * (necessary for reflection / runtime type checking) + **/ + struct STopicInformation + { + SDataTypeInformation topic_type; //!< Data type description of the topic + bool operator==(const STopicInformation& other) const { - return encoding == other.encoding && type == other.type && descriptor == other.descriptor; + return topic_type == other.topic_type; } bool operator!=(const STopicInformation& other) const @@ -47,4 +66,25 @@ namespace eCAL return !(*this == other); } }; + + /** + * @brief Optional compile time information associated with a given service method + * (necessary for reflection / runtime type checking) + **/ + struct SServiceMethodInformation + { + SDataTypeInformation request_type; //!< Data type description of the request + SDataTypeInformation response_type; //!< Data type description of the response + + bool operator==(const SServiceMethodInformation& other) const + { + return request_type == other.request_type && response_type == other.response_type; + } + + bool operator!=(const SServiceMethodInformation& other) const + { + return !(*this == other); + } + }; + } diff --git a/ecal/core/include/ecal/ecal_util.h b/ecal/core/include/ecal/ecal_util.h index 43914c26fe..aaa503a9ef 100644 --- a/ecal/core/include/ecal/ecal_util.h +++ b/ecal/core/include/ecal/ecal_util.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include @@ -146,10 +146,10 @@ namespace eCAL /** * @brief Get complete topic map (including types and descriptions). * - * @param topic_info_map_ Map to store the topic informations. + * @param topic_info_map_ Map to store the datatype descriptions. * Map containing { TopicName -> (Encoding, Type, Description) } mapping of all topics that are currently known. **/ - ECAL_API void GetTopics(std::unordered_map& topic_info_map_); + ECAL_API void GetTopics(std::unordered_map& topic_info_map_); /** * @brief Get all topic names. @@ -166,7 +166,7 @@ namespace eCAL * * @return True if succeeded. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the method bool GetTopicInformation(const std::string& topic_name_, STopicInformation& topic_info_) instead. You can extract the type information from the members encoding and type of the STopicInformation variable. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use the method bool GetDataTypeInformation(const std::string& topic_name_, SDataTypeInformation& topic_info_) instead. You can extract the type information from the members encoding and type of the STopicInformation variable. This function will be removed in eCAL6.") ECAL_API bool GetTopicTypeName(const std::string& topic_name_, std::string& topic_type_); /** @@ -176,7 +176,7 @@ namespace eCAL * * @return Topic type name. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the method bool GetTopicInformation(const std::string& topic_name_, STopicInformation& topic_info_) instead. You can extract the type information from the members encoding and type of the STopicInformation variable. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use the method bool GetDataTypeInformation(const std::string& topic_name_, SDataTypeInformation& topic_info_) instead. You can extract the type information from the members encoding and type of the STopicInformation variable. This function will be removed in eCAL6.") ECAL_API std::string GetTopicTypeName(const std::string& topic_name_); /** @@ -187,7 +187,7 @@ namespace eCAL * * @return True if succeeded. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the method bool GetTopicInformation(const std::string& topic_name_, STopicInformation& topic_info_) instead. You can extract the descriptor from the STopicInformation variable. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use the method bool GetDataTypeInformation(const std::string& topic_name_, SDataTypeInformation& topic_info_) instead. You can extract the descriptor from the STopicInformation variable. This function will be removed in eCAL6.") ECAL_API bool GetTopicDescription(const std::string& topic_name_, std::string& topic_desc_); /** @@ -197,33 +197,26 @@ namespace eCAL * * @return Topic description. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the method bool GetTopicInformation(const std::string& topic_name_, STopicInformation& topic_info_) instead. You can extract the descriptor from the STopicInformation variable. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use the method bool GetDataTypeInformation(const std::string& topic_name_, SDataTypeInformation& topic_info_) instead. You can extract the descriptor from the STopicInformation variable. This function will be removed in eCAL6.") ECAL_API std::string GetTopicDescription(const std::string& topic_name_); /** * @brief Gets description of the specified topic. * * @param topic_name_ Topic name. - * @param topic_info_ STopicInformationStruct to be filled by this function. + * @param topic_info_ SDataTypeInformation to be filled by this function. * * @return True if TopicInformation for specified topic could be retrieved, false otherwise. **/ - ECAL_API bool GetTopicInformation(const std::string& topic_name_, STopicInformation& topic_info_); - - struct SServiceMethodInfo - { - std::string request_type_name; //!< Type name of the request message - std::string request_type_description; //!< Descriptor string of the request description - std::string response_type_name; //!< Type name of the response message - std::string response_type_description; //!< Descriptor string of the response message - }; + ECAL_API bool GetTopicDataTypeInformation(const std::string& topic_name_, SDataTypeInformation& topic_info_); + /** * @brief Get complete service map (including request and response types and descriptions). * - * @param service_info_map_ Map to store the topic informations. + * @param service_info_map_ Map to store the datatype descriptions. * Map { (ServiceName, MethodName) -> ( (ReqType, ReqDescription), (RespType, RespDescription) ) } mapping of all currently known services. **/ - ECAL_API void GetServices(std::map, Util::SServiceMethodInfo>& service_info_map_); + ECAL_API void GetServices(std::map, SServiceMethodInformation>& service_info_map_); /** * @brief Get all service/method names. @@ -266,7 +259,7 @@ namespace eCAL * * @return True if succeeded. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the method bool GetTopicInformation(const std::string& topic_name_, STopicInformation& topic_info_) instead. You can extract the type information from the members encoding and type of the STopicInformation variable. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use the method bool GetDataTypeInformation(const std::string& topic_name_, SDataTypeInformation& topic_info_) instead. You can extract the type information from the members encoding and type of the STopicInformation variable. This function will be removed in eCAL6.") ECAL_API bool GetTypeName(const std::string& topic_name_, std::string& topic_type_); /** @@ -278,32 +271,32 @@ namespace eCAL * * @return Topic type name. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the method bool GetTopicInformation(const std::string& topic_name_, STopicInformation& topic_info_) instead. You can extract the type information from the members encoding and type of the STopicInformation variable. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use the method bool GetDataTypeInformation(const std::string& topic_name_, SDataTypeInformation& topic_info_) instead. You can extract the type information from the members encoding and type of the STopicInformation variable. This function will be removed in eCAL6.") ECAL_API std::string GetTypeName(const std::string& topic_name_); /** * @brief Gets description of the specified topic. * - * This function is deprecated with eCAL 5.10. Please use GetTopicInformation. + * This function is deprecated with eCAL 5.10. Please use GetTopicDataTypeInformation. * * @param topic_name_ Topic name. * @param topic_desc_ String to store description. * * @return True if succeeded. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the method bool GetTopicInformation(const std::string& topic_name_, STopicInformation& topic_info_) instead. You can extract the type information from the members encoding and type of the STopicInformation variable. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use the method bool GetDataTypeInformation(const std::string& topic_name_, SDataTypeInformation& topic_info_) instead. You can extract the type information from the members encoding and type of the STopicInformation variable. This function will be removed in eCAL6.") ECAL_API bool GetDescription(const std::string& topic_name_, std::string& topic_desc_); /** * @brief Gets description of the specified topic. * - * This function is deprecated with eCAL 5.10. Please use GetTopicInformation. + * This function is deprecated with eCAL 5.10. Please use GetTopicDataTypeInformation. * * @param topic_name_ Topic name. * * @return Topic description. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the method bool GetTopicInformation(const std::string& topic_name_, STopicInformation& topic_info_) instead. You can extract the type information from the members encoding and type of the STopicInformation variable. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use the method bool GetDataTypeInformation(const std::string& topic_name_, SDataTypeInformation& topic_info_) instead. You can extract the type information from the members encoding and type of the STopicInformation variable. This function will be removed in eCAL6.") ECAL_API std::string GetDescription(const std::string& topic_name_); /** diff --git a/ecal/core/include/ecal/msg/capnproto/dynamic.h b/ecal/core/include/ecal/msg/capnproto/dynamic.h index 7a880e2ad2..c856afda15 100644 --- a/ecal/core/include/ecal/msg/capnproto/dynamic.h +++ b/ecal/core/include/ecal/msg/capnproto/dynamic.h @@ -60,7 +60,7 @@ namespace eCAL * @param topic_name_ Unique topic name. **/ CDynamicSubscriber(const std::string& topic_name_) - : subscriber(topic_name_, GetTopicInformation()) + : subscriber(topic_name_, GetDataTypeInformation()) , builder() , initialized(false) { @@ -119,8 +119,8 @@ namespace eCAL { if (!initialized) { - STopicInformation topic_info_; - eCAL::Util::GetTopicInformation(topic_name_, topic_info_); + SDataTypeInformation topic_info_; + eCAL::Util::GetTopicDataTypeInformation(topic_name_, topic_info_); std::string topic_desc = topic_info_.descriptor; if (!topic_desc.empty()) { @@ -163,7 +163,7 @@ namespace eCAL **/ bool Create(const std::string& topic_name_) { - return(subscriber.Create(topic_name_, GetTopicInformation())); + return(subscriber.Create(topic_name_, GetDataTypeInformation())); } /** @@ -171,7 +171,7 @@ namespace eCAL * * @return Type name. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the method STopicInformation GetTopicInformation() instead. You can extract the typename from the STopicInformation variable. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use the method SDataTypeInformation GetDataTypeInformation() instead. You can extract the typename from the STopicInformation variable. This function will be removed in eCAL6.") std::string GetTypeName() const { return (""); @@ -182,9 +182,9 @@ namespace eCAL * * @return Topic information. **/ - STopicInformation GetTopicInformation() const + SDataTypeInformation GetDataTypeInformation() const { - STopicInformation topic_info; + SDataTypeInformation topic_info; // this is dynamic information. what should we return now? return topic_info; } diff --git a/ecal/core/include/ecal/msg/capnproto/publisher.h b/ecal/core/include/ecal/msg/capnproto/publisher.h index 150bec4dfe..6d508a183a 100644 --- a/ecal/core/include/ecal/msg/capnproto/publisher.h +++ b/ecal/core/include/ecal/msg/capnproto/publisher.h @@ -101,7 +101,7 @@ namespace eCAL * @param topic_name_ Unique topic name. **/ CPublisher(const std::string& topic_name_) - : eCAL::CPublisher(topic_name_, GetTopicInformation()) + : eCAL::CPublisher(topic_name_, GetDataTypeInformation()) , builder(std::make_unique()) , root_builder(builder->initRoot()) { @@ -150,7 +150,7 @@ namespace eCAL **/ bool Create(const std::string& topic_name_) { - return(eCAL::CPublisher::Create(topic_name_, GetTopicInformation())); + return(eCAL::CPublisher::Create(topic_name_, GetDataTypeInformation())); } typename message_type::Builder GetBuilder() @@ -170,11 +170,11 @@ namespace eCAL * * @return Topic information. **/ - STopicInformation GetTopicInformation() const + SDataTypeInformation GetDataTypeInformation() const { - STopicInformation topic_info; + SDataTypeInformation topic_info; topic_info.encoding = eCAL::capnproto::EncodingAsString(); - topic_info.type = eCAL::capnproto::TypeAsString(); + topic_info.name = eCAL::capnproto::TypeAsString(); topic_info.descriptor = eCAL::capnproto::SchemaAsString(); return topic_info; } diff --git a/ecal/core/include/ecal/msg/capnproto/subscriber.h b/ecal/core/include/ecal/msg/capnproto/subscriber.h index d4039fbd1c..d330700137 100644 --- a/ecal/core/include/ecal/msg/capnproto/subscriber.h +++ b/ecal/core/include/ecal/msg/capnproto/subscriber.h @@ -64,7 +64,7 @@ namespace eCAL * * @param topic_name_ Unique topic name. **/ - CBuilderSubscriber(const std::string& topic_name_, const STopicInformation& topic_info_) : CMsgSubscriber(topic_name_, topic_info_) + CBuilderSubscriber(const std::string& topic_name_, const SDataTypeInformation& topic_info_) : CMsgSubscriber(topic_name_, topic_info_) { } @@ -95,7 +95,7 @@ namespace eCAL * * @return True if it succeeds, false if it fails. **/ - bool Create(const std::string& topic_name_, const STopicInformation& topic_info_) + bool Create(const std::string& topic_name_, const SDataTypeInformation& topic_info_) { return(CMsgSubscriber::Create(topic_name_, topic_info_)); } @@ -147,7 +147,7 @@ namespace eCAL * @param topic_name_ Unique topic name. **/ CSubscriber(const std::string& topic_name_) - : subscriber(topic_name_, GetTopicInformation()) + : subscriber(topic_name_, GetDataTypeInformation()) , builder() , root_builder(builder.getRoot()) { @@ -236,7 +236,7 @@ namespace eCAL **/ bool Create(const std::string& topic_name_) { - return(subscriber.Create(topic_name_, GetTopicInformation())); + return(subscriber.Create(topic_name_, GetDataTypeInformation())); } /** @@ -244,7 +244,7 @@ namespace eCAL * * @return Type name. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use STopicInformation GetTopicInformation() instead. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use SDataTypeInformation GetDataTypeInformation() instead. This function will be removed in eCAL6.") std::string GetTypeName() const { return eCAL::capnproto::TypeAsString(); @@ -256,11 +256,11 @@ namespace eCAL * * @return Topic information. **/ - STopicInformation GetTopicInformation() const + SDataTypeInformation GetDataTypeInformation() const { - STopicInformation topic_info; + SDataTypeInformation topic_info; topic_info.encoding = eCAL::capnproto::EncodingAsString(); - topic_info.type = eCAL::capnproto::TypeAsString(); + topic_info.name = eCAL::capnproto::TypeAsString(); topic_info.descriptor = eCAL::capnproto::SchemaAsString(); return topic_info; } diff --git a/ecal/core/include/ecal/msg/flatbuffers/publisher.h b/ecal/core/include/ecal/msg/flatbuffers/publisher.h index 72f2bdca1d..51479fe71b 100644 --- a/ecal/core/include/ecal/msg/flatbuffers/publisher.h +++ b/ecal/core/include/ecal/msg/flatbuffers/publisher.h @@ -52,7 +52,7 @@ namespace eCAL * * @param topic_name_ Unique topic name. **/ - CPublisher(const std::string& topic_name_) : CMsgPublisher(topic_name_, GetTopicInformation()) + CPublisher(const std::string& topic_name_) : CMsgPublisher(topic_name_, GetDataTypeInformation()) { } @@ -85,7 +85,7 @@ namespace eCAL **/ bool Create(const std::string& topic_name_) { - return(CMsgPublisher::Create(topic_name_, GetTopicInformation())); + return(CMsgPublisher::Create(topic_name_, GetDataTypeInformation())); } private: @@ -94,9 +94,9 @@ namespace eCAL * * @return Topic information. **/ - STopicInformation GetTopicInformation() const override + SDataTypeInformation GetDataTypeInformation() const override { - STopicInformation topic_info; + SDataTypeInformation topic_info; topic_info.encoding = "flatb"; // empty type, empty descriptor return topic_info; diff --git a/ecal/core/include/ecal/msg/flatbuffers/subscriber.h b/ecal/core/include/ecal/msg/flatbuffers/subscriber.h index 9b3f545c81..c0c0acf973 100644 --- a/ecal/core/include/ecal/msg/flatbuffers/subscriber.h +++ b/ecal/core/include/ecal/msg/flatbuffers/subscriber.h @@ -52,7 +52,7 @@ namespace eCAL * * @param topic_name_ Unique topic name. **/ - CSubscriber(const std::string& topic_name_) : CMsgSubscriber(topic_name_, CSubscriber::GetTopicInformation()) + CSubscriber(const std::string& topic_name_) : CMsgSubscriber(topic_name_, CSubscriber::GetDataTypeInformation()) { } @@ -85,7 +85,7 @@ namespace eCAL **/ bool Create(const std::string& topic_name_) { - return(CMsgSubscriber::Create(topic_name_, GetTopicInformation())); + return(CMsgSubscriber::Create(topic_name_, GetDataTypeInformation())); } private: @@ -94,9 +94,9 @@ namespace eCAL * * @return Topic information. **/ - STopicInformation GetTopicInformation() const override + SDataTypeInformation GetDataTypeInformation() const override { - STopicInformation topic_info; + SDataTypeInformation topic_info; topic_info.encoding = "flatb"; // empty type, empty descriptor return topic_info; diff --git a/ecal/core/include/ecal/msg/messagepack/publisher.h b/ecal/core/include/ecal/msg/messagepack/publisher.h index e3756d554a..8886b95244 100644 --- a/ecal/core/include/ecal/msg/messagepack/publisher.h +++ b/ecal/core/include/ecal/msg/messagepack/publisher.h @@ -55,7 +55,7 @@ namespace eCAL * * @param topic_name_ Unique topic name. **/ - CPublisher(const std::string& topic_name_) : CMsgPublisher(topic_name_, GetTopicInformation()) + CPublisher(const std::string& topic_name_) : CMsgPublisher(topic_name_, GetDataTypeInformation()) { } @@ -88,7 +88,7 @@ namespace eCAL **/ bool Create(const std::string& topic_name_) { - return(CMsgPublisher::Create(topic_name_, GetTopicInformation())); + return(CMsgPublisher::Create(topic_name_, GetDataTypeInformation())); } private: @@ -97,9 +97,9 @@ namespace eCAL * * @return Topic information. **/ - STopicInformation GetTopicInformation() const override + SDataTypeInformation GetDataTypeInformation() const override { - STopicInformation topic_info; + SDataTypeInformation topic_info; topic_info.encoding = "mpack"; // empty descriptor, empty descriptor return topic_info; diff --git a/ecal/core/include/ecal/msg/messagepack/subscriber.h b/ecal/core/include/ecal/msg/messagepack/subscriber.h index fb72a6a2cb..d2334c3608 100644 --- a/ecal/core/include/ecal/msg/messagepack/subscriber.h +++ b/ecal/core/include/ecal/msg/messagepack/subscriber.h @@ -55,7 +55,7 @@ namespace eCAL * * @param topic_name_ Unique topic name. **/ - CSubscriber(const std::string& topic_name_) : CMsgSubscriber(topic_name_, GetTopicInformation()) + CSubscriber(const std::string& topic_name_) : CMsgSubscriber(topic_name_, GetDataTypeInformation()) { } @@ -88,7 +88,7 @@ namespace eCAL **/ bool Create(const std::string& topic_name_) { - return(CMsgSubscriber::Create(topic_name_, GetTopicInformation())); + return(CMsgSubscriber::Create(topic_name_, GetDataTypeInformation())); } private: @@ -97,9 +97,9 @@ namespace eCAL * * @return Topic information. **/ - STopicInformation GetTopicInformation() const override + SDataTypeInformation GetDataTypeInformation() const override { - STopicInformation topic_info; + SDataTypeInformation topic_info; topic_info.encoding = "mpack"; // empty descriptor, empty descriptor return topic_info; diff --git a/ecal/core/include/ecal/msg/protobuf/dynamic_publisher.h b/ecal/core/include/ecal/msg/protobuf/dynamic_publisher.h index 0af8d0453b..27d35f5ea6 100644 --- a/ecal/core/include/ecal/msg/protobuf/dynamic_publisher.h +++ b/ecal/core/include/ecal/msg/protobuf/dynamic_publisher.h @@ -105,7 +105,7 @@ namespace eCAL private: size_t Send(const google::protobuf::Message& msg_, long long time_ = -1) = delete; - STopicInformation GetTopicInformation() const override + SDataTypeInformation GetDataTypeInformation() const override { return GetTopicInformationFromMessage(m_msg.get()); } @@ -124,13 +124,13 @@ namespace eCAL return (msg_.SerializeToArray((void*)buffer_, (int)size_)); } - static STopicInformation GetTopicInformationFromMessage(const google::protobuf::Message* msg_ptr_) + static SDataTypeInformation GetTopicInformationFromMessage(const google::protobuf::Message* msg_ptr_) { assert(msg_ptr_); - STopicInformation topic_info; + SDataTypeInformation topic_info; topic_info.encoding = "proto"; - topic_info.type = msg_ptr_->GetTypeName(); + topic_info.name = msg_ptr_->GetTypeName(); topic_info.descriptor = GetDescriptorFromMessage(msg_ptr_); return topic_info; } diff --git a/ecal/core/include/ecal/msg/protobuf/dynamic_subscriber.h b/ecal/core/include/ecal/msg/protobuf/dynamic_subscriber.h index 2a25c45ee5..39dedd38f2 100644 --- a/ecal/core/include/ecal/msg/protobuf/dynamic_subscriber.h +++ b/ecal/core/include/ecal/msg/protobuf/dynamic_subscriber.h @@ -313,9 +313,9 @@ namespace eCAL inline std::shared_ptr CDynamicSubscriber::CreateMessagePointer(const std::string& topic_name_) { // get topic type - STopicInformation topic_info; - eCAL::Util::GetTopicInformation(topic_name, topic_info); - std::string topic_type{ topic_info.type }; + SDataTypeInformation topic_info; + eCAL::Util::GetTopicDataTypeInformation(topic_name, topic_info); + std::string topic_type{ topic_info.name }; topic_type = topic_type.substr(topic_type.find_last_of('.') + 1, topic_type.size()); if (StrEmptyOrNull(topic_type)) { diff --git a/ecal/core/include/ecal/msg/protobuf/publisher.h b/ecal/core/include/ecal/msg/protobuf/publisher.h index fe1b32079e..b3c1e739e0 100644 --- a/ecal/core/include/ecal/msg/protobuf/publisher.h +++ b/ecal/core/include/ecal/msg/protobuf/publisher.h @@ -106,7 +106,7 @@ namespace eCAL // where the vtable is not created yet or it's destructed. // Probably we can handle the Message publishers differently. One message publisher class and then one class for payloads and getting type // descriptor information. - CPublisher(const std::string& topic_name_) : eCAL::CPublisher(topic_name_, CPublisher::GetTopicInformation()) + CPublisher(const std::string& topic_name_) : eCAL::CPublisher(topic_name_, CPublisher::GetDataTypeInformation()) { } @@ -144,7 +144,7 @@ namespace eCAL **/ bool Create(const std::string& topic_name_) { - return(eCAL::CPublisher::Create(topic_name_, GetTopicInformation())); + return(eCAL::CPublisher::Create(topic_name_, GetDataTypeInformation())); } size_t Send(const T& msg_, long long time_ = -1) @@ -176,11 +176,11 @@ namespace eCAL * * @return Type name. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use STopicInformation GetTopicInformation() instead. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use SDataTypeInformation GetDataTypeInformation() instead. This function will be removed in eCAL6.") std::string GetTypeName() const { - STopicInformation topic_info{ GetTopicInformation() }; - return Util::CombinedTopicEncodingAndType(topic_info.encoding, topic_info.type); + SDataTypeInformation topic_info{ GetDataTypeInformation() }; + return Util::CombinedTopicEncodingAndType(topic_info.encoding, topic_info.name); } private: @@ -189,23 +189,23 @@ namespace eCAL * * @return Description string. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use STopicInformation GetTopicInformation() instead. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use SDataTypeInformation GetDataTypeInformation() instead. This function will be removed in eCAL6.") std::string GetDescription() const { - return GetTopicInformation().descriptor; + return GetDataTypeInformation().descriptor; } /** - * @brief Get topic information of the protobuf message. + * @brief Get datatype description of the protobuf message. * * @return Topic information. **/ - STopicInformation GetTopicInformation() const + SDataTypeInformation GetDataTypeInformation() const { - STopicInformation topic_info; + SDataTypeInformation topic_info; static T msg{}; topic_info.encoding = "proto"; - topic_info.type = msg.GetTypeName(); + topic_info.name = msg.GetTypeName(); topic_info.descriptor = protobuf::GetProtoMessageDescription(msg); return topic_info; } diff --git a/ecal/core/include/ecal/msg/protobuf/subscriber.h b/ecal/core/include/ecal/msg/protobuf/subscriber.h index 51703b2e37..3596f3060b 100644 --- a/ecal/core/include/ecal/msg/protobuf/subscriber.h +++ b/ecal/core/include/ecal/msg/protobuf/subscriber.h @@ -70,7 +70,7 @@ namespace eCAL // call the function via its class becase it's a virtual function that is called in constructor/destructor,- // where the vtable is not created yet or it's destructed. - CSubscriber(const std::string& topic_name_) : CMsgSubscriber(topic_name_, CSubscriber::GetTopicInformation()) + CSubscriber(const std::string& topic_name_) : CMsgSubscriber(topic_name_, CSubscriber::GetDataTypeInformation()) { } @@ -103,7 +103,7 @@ namespace eCAL **/ bool Create(const std::string& topic_name_) { - return(CMsgSubscriber::Create(topic_name_, GetTopicInformation())); + return(CMsgSubscriber::Create(topic_name_, GetDataTypeInformation())); } private: @@ -112,12 +112,12 @@ namespace eCAL * * @return Topic information. **/ - STopicInformation GetTopicInformation() const override + SDataTypeInformation GetDataTypeInformation() const override { - STopicInformation topic_info; + SDataTypeInformation topic_info; static T msg{}; topic_info.encoding = "proto"; - topic_info.type = msg.GetTypeName(); + topic_info.name = msg.GetTypeName(); topic_info.descriptor = protobuf::GetProtoMessageDescription(msg); return topic_info; } diff --git a/ecal/core/include/ecal/msg/publisher.h b/ecal/core/include/ecal/msg/publisher.h index 46d06c6613..bcd8026a64 100644 --- a/ecal/core/include/ecal/msg/publisher.h +++ b/ecal/core/include/ecal/msg/publisher.h @@ -60,16 +60,16 @@ namespace eCAL * @param topic_type_ Type name (optional for type checking). * @param topic_desc_ Type description (optional for description checking). **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the constructor CMsgPublisher(const std::string& topic_name_, const STopicInformation& topic_info_) instead. This function will be removed in eCAL6. ") + ECAL_DEPRECATE_SINCE_5_13("Please use the constructor CMsgPublisher(const std::string& topic_name_, const SDataTypeInformation& topic_info_) instead. This function will be removed in eCAL6. ") CMsgPublisher(const std::string& topic_name_, const std::string& topic_type_, const std::string& topic_desc_ = "") : CPublisher(topic_name_, topic_type_, topic_desc_) { } - CMsgPublisher(const std::string& topic_name_, const STopicInformation& topic_info_) : CPublisher(topic_name_, topic_info_) + CMsgPublisher(const std::string& topic_name_, const SDataTypeInformation& topic_info_) : CPublisher(topic_name_, topic_info_) { } - CMsgPublisher(const std::string& topic_name_) : CMsgPublisher(topic_name_, GetTopicInformation()) + CMsgPublisher(const std::string& topic_name_) : CMsgPublisher(topic_name_, GetDataTypeInformation()) { } @@ -106,7 +106,7 @@ namespace eCAL * * @return True if it succeeds, false if it fails. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the method Create(const std::string& topic_name_, const STopicInformation& topic_info_) instead. This function will be removed in eCAL6. ") + ECAL_DEPRECATE_SINCE_5_13("Please use the method Create(const std::string& topic_name_, const SDataTypeInformation& topic_info_) instead. This function will be removed in eCAL6. ") bool Create(const std::string& topic_name_, const std::string& topic_type_ = "", const std::string& topic_desc_ = "") { return(CPublisher::Create(topic_name_, topic_type_, topic_desc_)); @@ -116,11 +116,11 @@ namespace eCAL * @brief Creates this object. * * @param topic_name_ Unique topic name. - * @param topic_info_ Associated topic information. + * @param topic_info_ Associated datatype description. * * @return True if it succeeds, false if it fails. **/ - bool Create(const std::string& topic_name_, const STopicInformation& topic_info_) + bool Create(const std::string& topic_name_, const SDataTypeInformation& topic_info_) { return(CPublisher::Create(topic_name_, topic_info_)); } @@ -192,21 +192,21 @@ namespace eCAL } protected: - ECAL_DEPRECATE_SINCE_5_13("Please use STopicInformation GetTopicInformation() instead. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use SDataTypeInformation GetDataTypeInformation() instead. This function will be removed in eCAL6.") virtual std::string GetTypeName() const { - STopicInformation topic_info{ GetTopicInformation() }; - return Util::CombinedTopicEncodingAndType(topic_info.encoding, topic_info.type); + SDataTypeInformation topic_info{ GetDataTypeInformation() }; + return Util::CombinedTopicEncodingAndType(topic_info.encoding, topic_info.name); }; - ECAL_DEPRECATE_SINCE_5_13("Please use STopicInformation GetTopicInformation() instead. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use SDataTypeInformation GetDataTypeInformation() instead. This function will be removed in eCAL6.") virtual std::string GetDescription() const { - return GetTopicInformation().descriptor; + return GetDataTypeInformation().descriptor; }; // We cannot make it pure virtual, as it would break a bunch of implementations, who are not (yet) implementing this function - virtual STopicInformation GetTopicInformation() const { return STopicInformation{}; } + virtual SDataTypeInformation GetDataTypeInformation() const { return SDataTypeInformation{}; } private: virtual size_t GetSize(const T& msg_) const = 0; virtual bool Serialize(const T& msg_, char* buffer_, size_t size_) const = 0; diff --git a/ecal/core/include/ecal/msg/string/publisher.h b/ecal/core/include/ecal/msg/string/publisher.h index 7300e499cc..d5cb470012 100644 --- a/ecal/core/include/ecal/msg/string/publisher.h +++ b/ecal/core/include/ecal/msg/string/publisher.h @@ -59,7 +59,7 @@ namespace eCAL // call the function via its class becase it's a virtual function that is called in constructor/destructor,- // where the vtable is not created yet or it's destructed. - CPublisher(const std::string& topic_name_) : CMsgPublisher(topic_name_, GetTopicInformation()) + CPublisher(const std::string& topic_name_) : CMsgPublisher(topic_name_, GetDataTypeInformation()) { } @@ -104,7 +104,7 @@ namespace eCAL **/ bool Create(const std::string& topic_name_) { - return(CMsgPublisher::Create(topic_name_, GetTopicInformation())); + return(CMsgPublisher::Create(topic_name_, GetDataTypeInformation())); } private: @@ -113,11 +113,11 @@ namespace eCAL * * @return Topic information. **/ - STopicInformation GetTopicInformation() const override + SDataTypeInformation GetDataTypeInformation() const override { - STopicInformation topic_info; + SDataTypeInformation topic_info; topic_info.encoding = "base"; - topic_info.type = "std::string"; + topic_info.name = "std::string"; // empty descriptor return topic_info; } diff --git a/ecal/core/include/ecal/msg/string/subscriber.h b/ecal/core/include/ecal/msg/string/subscriber.h index acbfadc6d0..694d6025b3 100644 --- a/ecal/core/include/ecal/msg/string/subscriber.h +++ b/ecal/core/include/ecal/msg/string/subscriber.h @@ -58,7 +58,7 @@ namespace eCAL // call the function via its class becase it's a virtual function that is called in constructor/destructor,- // where the vtable is not created yet or it's destructed. - CSubscriber(const std::string& topic_name_) : CMsgSubscriber(topic_name_, CSubscriber::GetTopicInformation()) + CSubscriber(const std::string& topic_name_) : CMsgSubscriber(topic_name_, CSubscriber::GetDataTypeInformation()) { } @@ -91,7 +91,7 @@ namespace eCAL **/ bool Create(const std::string& topic_name_) { - return(CMsgSubscriber::Create(topic_name_, GetTopicInformation())); + return(CMsgSubscriber::Create(topic_name_, GetDataTypeInformation())); } private: @@ -100,11 +100,11 @@ namespace eCAL * * @return Topic information. ("base", "std::string", "") **/ - STopicInformation GetTopicInformation() const override + SDataTypeInformation GetDataTypeInformation() const override { - STopicInformation topic_info; + SDataTypeInformation topic_info; topic_info.encoding = "base"; - topic_info.type = "std::string"; + topic_info.name = "std::string"; // empty descriptor return topic_info; } diff --git a/ecal/core/include/ecal/msg/subscriber.h b/ecal/core/include/ecal/msg/subscriber.h index c3d4cb65b8..3f6980f795 100644 --- a/ecal/core/include/ecal/msg/subscriber.h +++ b/ecal/core/include/ecal/msg/subscriber.h @@ -61,7 +61,7 @@ namespace eCAL * @param topic_type_ Type name (optional for type checking). * @param topic_desc_ Type description (optional for description checking). **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the constructor CMsgSubscriber(const std::string& topic_name_, const STopicInformation& topic_info_) instead. This function will be removed in eCAL6. ") + ECAL_DEPRECATE_SINCE_5_13("Please use the constructor CMsgSubscriber(const std::string& topic_name_, const SDataTypeInformation& topic_info_) instead. This function will be removed in eCAL6. ") CMsgSubscriber(const std::string& topic_name_, const std::string& topic_type_ = "", const std::string& topic_desc_ = "") : CSubscriber(topic_name_, topic_type_, topic_desc_) { } @@ -72,7 +72,7 @@ namespace eCAL * @param topic_name_ Unique topic name. * @param topic_info_ Topic type information (encoding, type, descriptor). **/ - CMsgSubscriber(const std::string& topic_name_, const STopicInformation& topic_info_) : CSubscriber(topic_name_, topic_info_) + CMsgSubscriber(const std::string& topic_name_, const SDataTypeInformation& topic_info_) : CSubscriber(topic_name_, topic_info_) { } @@ -136,7 +136,7 @@ namespace eCAL * * @return true if it succeeds, false if it fails. **/ - ECAL_DEPRECATE_SINCE_5_13("Please use the method CMsgSubscriber(const std::string& topic_name_, const STopicInformation& topic_info_) instead. This function will be removed in eCAL6. ") + ECAL_DEPRECATE_SINCE_5_13("Please use the method CMsgSubscriber(const std::string& topic_name_, const SDataTypeInformation& topic_info_) instead. This function will be removed in eCAL6. ") bool Create(const std::string& topic_name_, const std::string& topic_type_ = "", const std::string& topic_desc_ = "") { return(CSubscriber::Create(topic_name_, topic_type_, topic_desc_)); @@ -150,7 +150,7 @@ namespace eCAL * * @return true if it succeeds, false if it fails. **/ - bool Create(const std::string& topic_name_, const STopicInformation& topic_info_) + bool Create(const std::string& topic_name_, const SDataTypeInformation& topic_info_) { return(CSubscriber::Create(topic_name_, topic_info_)); } @@ -225,21 +225,21 @@ namespace eCAL } protected: - ECAL_DEPRECATE_SINCE_5_13("Please use STopicInformation GetTopicInformation() instead. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use SDataTypeInformation GetDataTypeInformation() instead. This function will be removed in eCAL6.") virtual std::string GetTypeName() const { - STopicInformation topic_info{ GetTopicInformation() }; - return Util::CombinedTopicEncodingAndType(topic_info.encoding, topic_info.type); + SDataTypeInformation topic_info{ GetDataTypeInformation() }; + return Util::CombinedTopicEncodingAndType(topic_info.encoding, topic_info.name); }; - ECAL_DEPRECATE_SINCE_5_13("Please use STopicInformation GetTopicInformation() instead. This function will be removed in eCAL6.") + ECAL_DEPRECATE_SINCE_5_13("Please use SDataTypeInformation GetDataTypeInformation() instead. This function will be removed in eCAL6.") virtual std::string GetDescription() const { - return GetTopicInformation().descriptor; + return GetDataTypeInformation().descriptor; }; // We cannot make it pure virtual, as it would break a bunch of implementations, who are not (yet) implementing this function - virtual STopicInformation GetTopicInformation() const { return STopicInformation{}; } + virtual SDataTypeInformation GetDataTypeInformation() const { return SDataTypeInformation{}; } virtual bool Deserialize(T& msg_, const void* buffer_, size_t size_) const = 0; private: diff --git a/ecal/core/src/ecal_descgate.cpp b/ecal/core/src/ecal_descgate.cpp index 31519c2812..a219ff3684 100644 --- a/ecal/core/src/ecal_descgate.cpp +++ b/ecal/core/src/ecal_descgate.cpp @@ -46,7 +46,7 @@ namespace eCAL { } - bool CDescGate::ApplyTopicDescription(const std::string& topic_name_, const STopicInformation& topic_info_, const QualityFlags description_quality_) + bool CDescGate::ApplyTopicDescription(const std::string& topic_name_, const SDataTypeInformation& topic_info_, const QualityFlags description_quality_) { const std::unique_lock lock(m_topic_info_map.sync); m_topic_info_map.map->remove_deprecated(); @@ -134,13 +134,13 @@ namespace eCAL // topic type name differs // we log the error and update the entry one time - if (!topic_info_.type.empty() - && !topic_info.info.type.empty() - && (topic_info.info.type != topic_info_.type) + if (!topic_info_.name.empty() + && !topic_info.info.name.empty() + && (topic_info.info.name != topic_info_.name) ) { - std::string ttype1 = topic_info.info.type; - std::string ttype2 = topic_info_.type; + std::string ttype1 = topic_info.info.name; + std::string ttype2 = topic_info_.name; std::replace(ttype1.begin(), ttype1.end(), '\0', '?'); std::replace(ttype1.begin(), ttype1.end(), '\t', '?'); std::replace(ttype2.begin(), ttype2.end(), '\0', '?'); @@ -186,9 +186,9 @@ namespace eCAL return false; } - void CDescGate::GetTopics(std::unordered_map& topic_info_map_) + void CDescGate::GetTopics(std::unordered_map& topic_info_map_) { - std::unordered_map map; + std::unordered_map map; const std::shared_lock lock(m_topic_info_map.sync); m_topic_info_map.map->remove_deprecated(); @@ -215,7 +215,7 @@ namespace eCAL } } - bool CDescGate::GetTopicInformation(const std::string& topic_name_, STopicInformation& topic_info_) + bool CDescGate::GetDataTypeInformation(const std::string& topic_name_, SDataTypeInformation& topic_info_) { if (topic_name_.empty()) return(false); @@ -229,10 +229,8 @@ namespace eCAL bool CDescGate::ApplyServiceDescription(const std::string& service_name_ , const std::string& method_name_ - , const std::string& req_type_name_ - , const std::string& req_type_desc_ - , const std::string& resp_type_name_ - , const std::string& resp_type_desc_ + , const SDataTypeInformation& reqest_type_description_ + , const SDataTypeInformation& response_type_description_ , const QualityFlags description_quality_) { std::tuple service_method_tuple = std::make_tuple(service_name_, method_name_); @@ -245,11 +243,9 @@ namespace eCAL { // create a new service entry SServiceMethodInfoQuality& service_info = (*m_service_info_map.map)[service_method_tuple]; - service_info.info.request_type_name = req_type_name_; - service_info.info.request_type_description = req_type_desc_; - service_info.info.response_type_name = resp_type_name_; - service_info.info.response_type_description = resp_type_desc_; - service_info.quality = description_quality_; + service_info.info.request_type = reqest_type_description_; + service_info.info.response_type = response_type_description_; + service_info.quality = description_quality_; return true; } @@ -259,11 +255,9 @@ namespace eCAL SServiceMethodInfoQuality service_info = (*service_info_map_it).second; if (description_quality_ > service_info.quality) { - service_info.info.request_type_name = req_type_name_; - service_info.info.request_type_description = req_type_desc_; - service_info.info.response_type_name = resp_type_name_; - service_info.info.response_type_description = resp_type_desc_; - service_info.quality = description_quality_; + service_info.info.request_type = reqest_type_description_; + service_info.info.response_type = response_type_description_; + service_info.quality = description_quality_; ret_value = true; } @@ -273,9 +267,9 @@ namespace eCAL return ret_value; } - void CDescGate::GetServices(std::map, Util::SServiceMethodInfo>& service_info_map_) + void CDescGate::GetServices(std::map, SServiceMethodInformation>& service_info_map_) { - std::map, Util::SServiceMethodInfo> map; + std::map, SServiceMethodInformation> map; const std::shared_lock lock(m_service_info_map.sync); m_service_info_map.map->remove_deprecated(); @@ -309,8 +303,8 @@ namespace eCAL auto service_info_map_it = m_service_info_map.map->find(service_method_tuple); if (service_info_map_it == m_service_info_map.map->end()) return false; - req_type_name_ = (*service_info_map_it).second.info.request_type_name; - resp_type_name_ = (*service_info_map_it).second.info.response_type_name; + req_type_name_ = (*service_info_map_it).second.info.request_type.name; + resp_type_name_ = (*service_info_map_it).second.info.response_type.name; return true; } @@ -322,8 +316,8 @@ namespace eCAL auto service_info_map_it = m_service_info_map.map->find(service_method_tuple); if (service_info_map_it == m_service_info_map.map->end()) return false; - req_type_desc_ = (*service_info_map_it).second.info.request_type_description; - resp_type_desc_ = (*service_info_map_it).second.info.response_type_description; + req_type_desc_ = (*service_info_map_it).second.info.request_type.descriptor; + resp_type_desc_ = (*service_info_map_it).second.info.response_type.descriptor; return true; } }; diff --git a/ecal/core/src/ecal_descgate.h b/ecal/core/src/ecal_descgate.h index c8ee955808..7236e17f59 100644 --- a/ecal/core/src/ecal_descgate.h +++ b/ecal/core/src/ecal_descgate.h @@ -24,7 +24,7 @@ #pragma once #include -#include +#include #include "ecal_global_accessors.h" #include "ecal_def.h" @@ -66,22 +66,20 @@ namespace eCAL void Destroy(); bool ApplyTopicDescription(const std::string& topic_name_, - const STopicInformation& topic_info_, + const SDataTypeInformation& topic_info_, const QualityFlags description_quality_); - void GetTopics(std::unordered_map& topic_info_map_); + void GetTopics(std::unordered_map& topic_info_map_); void GetTopicNames(std::vector& topic_names_); - bool GetTopicInformation(const std::string& topic_name_, STopicInformation& topic_info_); + bool GetDataTypeInformation(const std::string& topic_name_, SDataTypeInformation& topic_info_); bool ApplyServiceDescription(const std::string& service_name_, const std::string& method_name_, - const std::string& req_type_name_, - const std::string& req_type_desc_, - const std::string& resp_type_name_, - const std::string& resp_type_desc_, + const SDataTypeInformation& reqest_type_description_, + const SDataTypeInformation& response_type_description_, const QualityFlags description_quality_); - void GetServices(std::map, Util::SServiceMethodInfo>& service_info_map_); + void GetServices(std::map, SServiceMethodInformation>& service_info_map_); void GetServiceNames(std::vector>& service_method_names_); bool GetServiceTypeNames(const std::string& service_name_, const std::string& method_name_, std::string& req_type_name_, std::string& resp_type_name_); bool GetServiceDescription(const std::string& service_name_, const std::string& method_name_, std::string& req_type_desc_, std::string& resp_type_desc_); @@ -89,14 +87,14 @@ namespace eCAL protected: struct STopicInfoQuality { - STopicInformation info; //!< Topic info struct with type encoding, name and descriptor. - QualityFlags quality = QualityFlags::NO_QUALITY; //!< QualityFlags to determine whether we may overwrite the current data with better one. E.g. we prefer the description sent by a publisher over one sent by a subscriber. - bool type_missmatch_logged = false; //!< Whether we have already logged a type-missmatch + SDataTypeInformation info; //!< Topic info struct with type encoding, name and descriptor. + QualityFlags quality = QualityFlags::NO_QUALITY; //!< QualityFlags to determine whether we may overwrite the current data with better one. E.g. we prefer the description sent by a publisher over one sent by a subscriber. + bool type_missmatch_logged = false; //!< Whether we have already logged a type-missmatch }; struct SServiceMethodInfoQuality { - Util::SServiceMethodInfo info; //!< Service info struct with type names and descriptors for request and response. + SServiceMethodInformation info; //!< Service info struct with type names and descriptors for request and response. QualityFlags quality = QualityFlags::NO_QUALITY; //!< The Quality of the Info }; diff --git a/ecal/core/src/ecal_registration_provider.cpp b/ecal/core/src/ecal_registration_provider.cpp index a406aad393..fabea73074 100644 --- a/ecal/core/src/ecal_registration_provider.cpp +++ b/ecal/core/src/ecal_registration_provider.cpp @@ -361,7 +361,14 @@ namespace eCAL const auto& ecal_sample_service = iter->second.service(); for (const auto& method : ecal_sample_service.methods()) { - ApplyServiceToDescGate(ecal_sample_service.sname(), method.mname(), method.req_type(), method.req_desc(), method.resp_type(), method.resp_desc()); + SDataTypeInformation request_type; + request_type.name = method.req_type(); + request_type.descriptor = method.req_desc(); + SDataTypeInformation response_type; + response_type.name = method.resp_type(); + response_type.descriptor = method.resp_desc(); + + ApplyServiceToDescGate(ecal_sample_service.sname(), method.mname(), request_type, response_type); } ////////////////////////////////////////////// @@ -403,11 +410,11 @@ namespace eCAL ////////////////////////////////////////////// // read attributes const std::string topic_name(iter->second.topic().tname()); - STopicInformation topic_info; - const auto& pb_topic_info = iter->second.topic().tinfo(); - topic_info.encoding = pb_topic_info.encoding(); - topic_info.type = pb_topic_info.type(); - topic_info.descriptor = pb_topic_info.desc(); + SDataTypeInformation topic_info; + const auto& pb_topic_datatype = iter->second.topic().tdatatype(); + topic_info.encoding = pb_topic_datatype.encoding(); + topic_info.name = pb_topic_datatype.name(); + topic_info.descriptor = pb_topic_datatype.desc(); const bool topic_is_a_publisher(iter->second.cmd_type() == eCAL::pb::eCmdType::bct_reg_publisher); ApplyTopicToDescGate(topic_name, topic_info, topic_is_a_publisher); @@ -502,14 +509,14 @@ namespace eCAL } bool CRegistrationProvider::ApplyTopicToDescGate(const std::string& topic_name_ - , const STopicInformation& topic_info_ + , const SDataTypeInformation& topic_info_ , bool topic_is_a_publisher_) { if (g_descgate() != nullptr) { // calculate the quality of the current info ::eCAL::CDescGate::QualityFlags quality = ::eCAL::CDescGate::QualityFlags::NO_QUALITY; - if (!topic_info_.encoding.empty() || !topic_info_.type.empty()) + if (!topic_info_.encoding.empty() || !topic_info_.name.empty()) quality |= ::eCAL::CDescGate::QualityFlags::TYPE_AVAILABLE; if (!topic_info_.descriptor.empty()) quality |= ::eCAL::CDescGate::QualityFlags::DESCRIPTION_AVAILABLE; @@ -525,22 +532,21 @@ namespace eCAL bool CRegistrationProvider::ApplyServiceToDescGate(const std::string& service_name_ , const std::string& method_name_ - , const std::string& req_type_name_ - , const std::string& req_type_desc_ - , const std::string& resp_type_name_ - , const std::string& resp_type_desc_) + , const SDataTypeInformation& reqest_type_description_ + , const SDataTypeInformation& response_type_description_ + ) { if (g_descgate() != nullptr) { // Calculate the quality of the current info ::eCAL::CDescGate::QualityFlags quality = ::eCAL::CDescGate::QualityFlags::NO_QUALITY; - if (!(req_type_name_.empty() && resp_type_name_.empty())) + if (!(reqest_type_description_.name.empty() && response_type_description_.name.empty())) quality |= ::eCAL::CDescGate::QualityFlags::TYPE_AVAILABLE; - if (!(req_type_desc_.empty() && resp_type_desc_.empty())) + if (!(reqest_type_description_.descriptor.empty() && response_type_description_.descriptor.empty())) quality |= ::eCAL::CDescGate::QualityFlags::DESCRIPTION_AVAILABLE; quality |= ::eCAL::CDescGate::QualityFlags::INFO_COMES_FROM_THIS_PROCESS; - return g_descgate()->ApplyServiceDescription(service_name_, method_name_, req_type_name_, req_type_desc_, resp_type_name_, resp_type_desc_, quality); + return g_descgate()->ApplyServiceDescription(service_name_, method_name_, reqest_type_description_, response_type_description_, quality); } return false; } diff --git a/ecal/core/src/ecal_registration_provider.h b/ecal/core/src/ecal_registration_provider.h index 1bf948d2d6..52a7385c41 100644 --- a/ecal/core/src/ecal_registration_provider.h +++ b/ecal/core/src/ecal_registration_provider.h @@ -82,15 +82,13 @@ namespace eCAL int RegisterSendThread(); bool ApplyTopicToDescGate(const std::string& topic_name_ - , const STopicInformation& topic_info_ + , const SDataTypeInformation& topic_info_ , bool topic_is_a_publisher_); bool ApplyServiceToDescGate(const std::string& service_name_ , const std::string& method_name_ - , const std::string& req_type_name_ - , const std::string& req_type_desc_ - , const std::string& resp_type_name_ - , const std::string& resp_type_desc_); + , const SDataTypeInformation& reqest_type_description_ + , const SDataTypeInformation& response_type_description_); bool SendSampleList(bool reset_sample_list_ = true); diff --git a/ecal/core/src/ecal_sample_to_topicinfo.h b/ecal/core/src/ecal_sample_to_topicinfo.h index e4a7f75151..37da3a9f63 100644 --- a/ecal/core/src/ecal_sample_to_topicinfo.h +++ b/ecal/core/src/ecal_sample_to_topicinfo.h @@ -18,26 +18,26 @@ */ /** - * @brief helper class to copy from eCAL::pb:Sample to STopicInformation + * @brief helper class to copy from eCAL::pb:Sample to SDataTypeInformation **/ #pragma once #include -#include +#include #include namespace eCAL { - inline STopicInformation eCALSampleToTopicInformation(const eCAL::pb::Sample& sample) + inline SDataTypeInformation eCALSampleToTopicInformation(const eCAL::pb::Sample& sample) { - STopicInformation topic; - const auto& tinfo = sample.topic().tinfo(); - topic.encoding = tinfo.encoding(); - topic.type = tinfo.type(); - topic.descriptor = tinfo.desc(); + SDataTypeInformation topic; + const auto& tdatatype = sample.topic().tdatatype(); + topic.encoding = tdatatype.encoding(); + topic.name = tdatatype.name(); + topic.descriptor = tdatatype.desc(); return topic; } @@ -45,13 +45,13 @@ namespace eCAL inline void ModifyIncomingSampleForBackwardsCompatibility(const eCAL::pb::Sample& sample, eCAL::pb::Sample& modified_sample) { modified_sample.CopyFrom(sample); - if (modified_sample.has_topic() && !modified_sample.topic().has_tinfo()) + if (modified_sample.has_topic() && !modified_sample.topic().has_tdatatype()) { - auto* topic_info = modified_sample.mutable_topic()->mutable_tinfo(); + auto* topic_datatype = modified_sample.mutable_topic()->mutable_tdatatype(); auto split_type = Util::SplitCombinedTopicType(modified_sample.topic().ttype()); - topic_info->set_encoding(split_type.first); - topic_info->set_type(split_type.second); - topic_info->set_desc(modified_sample.topic().tdesc()); + topic_datatype->set_name(split_type.second); + topic_datatype->set_encoding(split_type.first); + topic_datatype->set_desc(modified_sample.topic().tdesc()); } } diff --git a/ecal/core/src/ecal_util.cpp b/ecal/core/src/ecal_util.cpp index a00cc06542..b4d72147ff 100644 --- a/ecal/core/src/ecal_util.cpp +++ b/ecal/core/src/ecal_util.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include "ecal_def.h" #include "ecal_descgate.h" @@ -224,7 +224,7 @@ namespace eCAL if (g_pubgate()) g_pubgate()->ShareDescription(state_); } - void GetTopics(std::unordered_map& topic_info_map_) + void GetTopics(std::unordered_map& topic_info_map_) { if (!g_descgate()) return; g_descgate()->GetTopics(topic_info_map_); @@ -253,9 +253,9 @@ namespace eCAL // [[deprecated]] bool GetTopicTypeName(const std::string& topic_name_, std::string& topic_type_) { - STopicInformation topic_info; - auto ret = GetTopicInformation(topic_name_, topic_info); - topic_type_ = Util::CombinedTopicEncodingAndType(topic_info.encoding, topic_info.type); + SDataTypeInformation topic_info; + auto ret = GetTopicDataTypeInformation(topic_name_, topic_info); + topic_type_ = Util::CombinedTopicEncodingAndType(topic_info.encoding, topic_info.name); return ret; } @@ -300,8 +300,8 @@ namespace eCAL // [[deprecated]] bool GetTopicDescription(const std::string& topic_name_, std::string& topic_desc_) { - STopicInformation topic_info; - auto ret = GetTopicInformation(topic_name_, topic_info); + SDataTypeInformation topic_info; + auto ret = GetTopicDataTypeInformation(topic_name_, topic_info); topic_desc_ = topic_info.descriptor; return ret; } @@ -330,10 +330,10 @@ namespace eCAL return(""); } - bool GetTopicInformation(const std::string& topic_name_, STopicInformation& topic_info_) + bool GetTopicDataTypeInformation(const std::string& topic_name_, SDataTypeInformation& topic_info_) { if (g_descgate() == nullptr) return(false); - return(g_descgate()->GetTopicInformation(topic_name_, topic_info_)); + return(g_descgate()->GetDataTypeInformation(topic_name_, topic_info_)); } // [[deprecated]] @@ -377,7 +377,7 @@ namespace eCAL * @param service_info_map_ Map to store the topic informations. * Map { (ServiceName, MethodName) -> ( (ReqType, ReqDescription), (RespType, RespDescription) ) } mapping of all currently known services. **/ - void GetServices(std::map, Util::SServiceMethodInfo>& service_info_map_) + void GetServices(std::map, SServiceMethodInformation>& service_info_map_) { if (!g_descgate()) return; g_descgate()->GetServices(service_info_map_); diff --git a/ecal/core/src/mon/ecal_monitoring_impl.cpp b/ecal/core/src/mon/ecal_monitoring_impl.cpp index 53f21014ae..6d6d0c5a9a 100644 --- a/ecal/core/src/mon/ecal_monitoring_impl.cpp +++ b/ecal/core/src/mon/ecal_monitoring_impl.cpp @@ -279,9 +279,9 @@ namespace eCAL default: break; } - std::string topic_info_encoding = sample_topic.tinfo().encoding(); - std::string topic_info_type = sample_topic.tinfo().type(); - std::string topic_info_descriptor = sample_topic.tinfo().desc(); + std::string topic_datatype_encoding = sample_topic.tdatatype().encoding(); + std::string topic_datatype_name = sample_topic.tdatatype().name(); + std::string topic_datatype_descriptor = sample_topic.tdatatype().desc(); auto attr = sample_topic.attr(); // try to get topic info @@ -301,9 +301,10 @@ namespace eCAL // update flexible content TopicInfo.rclock++; - TopicInfo.tinfo.encoding = std::move(topic_info_encoding); - TopicInfo.tinfo.type = std::move(topic_info_type); - TopicInfo.tinfo.descriptor = std::move(topic_info_descriptor); + TopicInfo.tdatatype.encoding = std::move(topic_datatype_encoding); + TopicInfo.tdatatype.name = std::move(topic_datatype_name); + TopicInfo.tdatatype.descriptor = std::move(topic_datatype_descriptor); + TopicInfo.attr = std::map{attr.begin(), attr.end()}; TopicInfo.tlayer_ecal_udp_mc = topic_tlayer_ecal_udp_mc; TopicInfo.tlayer_ecal_shm = topic_tlayer_ecal_shm; @@ -930,7 +931,7 @@ namespace eCAL // remove with eCAL6 // topic type - pMonTopic->set_ttype(eCAL::Util::CombinedTopicEncodingAndType(topic.second.tinfo.encoding, topic.second.tinfo.type)); + pMonTopic->set_ttype(eCAL::Util::CombinedTopicEncodingAndType(topic.second.tdatatype.encoding, topic.second.tdatatype.name)); // topic transport layers if (topic.second.tlayer_ecal_udp_mc) @@ -960,14 +961,14 @@ namespace eCAL // remove with eCAL6 // topic description - pMonTopic->set_tdesc(topic.second.tinfo.descriptor); + pMonTopic->set_tdesc(topic.second.tdatatype.descriptor); // topic information { - auto *tinfo = pMonTopic->mutable_tinfo(); - tinfo->set_encoding(topic.second.tinfo.encoding); - tinfo->set_type(topic.second.tinfo.type); - tinfo->set_desc(topic.second.tinfo.descriptor); + auto *tdatatype = pMonTopic->mutable_tdatatype(); + tdatatype->set_encoding(topic.second.tdatatype.encoding); + tdatatype->set_name(topic.second.tdatatype.name); + tdatatype->set_desc(topic.second.tdatatype.descriptor); } // topic attributes diff --git a/ecal/core/src/pubsub/ecal_proto_dyn_json_sub.cpp b/ecal/core/src/pubsub/ecal_proto_dyn_json_sub.cpp index 1df9accaf2..085c2c3137 100644 --- a/ecal/core/src/pubsub/ecal_proto_dyn_json_sub.cpp +++ b/ecal/core/src/pubsub/ecal_proto_dyn_json_sub.cpp @@ -122,10 +122,10 @@ namespace eCAL if (msg_string.empty()) { // get topic type - STopicInformation topic_info; + SDataTypeInformation topic_info; //nodiscard??? - eCAL::Util::GetTopicInformation(topic_name_, topic_info); - topic_type_full = topic_info.type; + eCAL::Util::GetTopicDataTypeInformation(topic_name_, topic_info); + topic_type_full = topic_info.name; topic_type = topic_type_full.substr(topic_type_full.find_last_of('.') + 1, topic_type_full.size()); topic_type_full = "/" + topic_type_full; diff --git a/ecal/core/src/pubsub/ecal_pubgate.cpp b/ecal/core/src/pubsub/ecal_pubgate.cpp index f48d938a8f..f6daae705f 100644 --- a/ecal/core/src/pubsub/ecal_pubgate.cpp +++ b/ecal/core/src/pubsub/ecal_pubgate.cpp @@ -115,7 +115,7 @@ namespace eCAL const auto& ecal_sample = ecal_sample_.topic(); const std::string& topic_name = ecal_sample.tname(); const std::string& topic_id = ecal_sample.tid(); - STopicInformation topic_information{ eCALSampleToTopicInformation(ecal_sample_) }; + SDataTypeInformation topic_information{ eCALSampleToTopicInformation(ecal_sample_) }; const std::string process_id = std::to_string(ecal_sample.pid()); std::string reader_par; @@ -165,7 +165,7 @@ namespace eCAL const std::string& host_name = ecal_sample.hname(); const std::string& topic_name = ecal_sample.tname(); const std::string& topic_id = ecal_sample.tid(); - STopicInformation topic_information{ eCALSampleToTopicInformation(ecal_sample_) }; + SDataTypeInformation topic_information{ eCALSampleToTopicInformation(ecal_sample_) }; const std::string process_id = std::to_string(ecal_sample.pid()); std::string reader_par; @@ -220,13 +220,13 @@ namespace eCAL } } - bool CPubGate::ApplyTopicToDescGate(const std::string& topic_name_, const STopicInformation& topic_info_) + bool CPubGate::ApplyTopicToDescGate(const std::string& topic_name_, const SDataTypeInformation& topic_info_) { if (g_descgate() != nullptr) { // Calculate the quality of the current info ::eCAL::CDescGate::QualityFlags quality = ::eCAL::CDescGate::QualityFlags::NO_QUALITY; - if (!topic_info_.type.empty() || !topic_info_.encoding.empty()) + if (!topic_info_.name.empty() || !topic_info_.encoding.empty()) quality |= ::eCAL::CDescGate::QualityFlags::TYPE_AVAILABLE; if (!topic_info_.descriptor.empty()) quality |= ::eCAL::CDescGate::QualityFlags::DESCRIPTION_AVAILABLE; diff --git a/ecal/core/src/pubsub/ecal_pubgate.h b/ecal/core/src/pubsub/ecal_pubgate.h index c6b48c9158..655e37954c 100644 --- a/ecal/core/src/pubsub/ecal_pubgate.h +++ b/ecal/core/src/pubsub/ecal_pubgate.h @@ -60,7 +60,7 @@ namespace eCAL void RefreshRegistrations(); - bool ApplyTopicToDescGate(const std::string& topic_name_, const STopicInformation& topic_info_); + bool ApplyTopicToDescGate(const std::string& topic_name_, const SDataTypeInformation& topic_info_); protected: static std::atomic m_created; diff --git a/ecal/core/src/pubsub/ecal_publisher.cpp b/ecal/core/src/pubsub/ecal_publisher.cpp index 5f2de20934..e95e7e1bd6 100644 --- a/ecal/core/src/pubsub/ecal_publisher.cpp +++ b/ecal/core/src/pubsub/ecal_publisher.cpp @@ -52,14 +52,14 @@ namespace eCAL Create(topic_name_, topic_type_, topic_desc_); } - CPublisher::CPublisher(const std::string& topic_name_, const STopicInformation& topic_info_) + CPublisher::CPublisher(const std::string& topic_name_, const SDataTypeInformation& data_type_info_) : CPublisher() { - Create(topic_name_, topic_info_); + Create(topic_name_, data_type_info_); } CPublisher::CPublisher(const std::string& topic_name_) - : CPublisher(topic_name_, STopicInformation{}) + : CPublisher(topic_name_, SDataTypeInformation{}) {} CPublisher::~CPublisher() @@ -106,15 +106,15 @@ namespace eCAL bool CPublisher::Create(const std::string& topic_name_, const std::string& topic_type_ /* = "" */, const std::string& topic_desc_ /* = "" */) { - STopicInformation info; + SDataTypeInformation info; auto split_type = Util::SplitCombinedTopicType(topic_type_); info.encoding = split_type.first; - info.type = split_type.second; + info.name = split_type.second; info.descriptor = topic_desc_; return Create(topic_name_, info); } - bool CPublisher::Create(const std::string& topic_name_, const STopicInformation& topic_info_) + bool CPublisher::Create(const std::string& topic_name_, const SDataTypeInformation& data_type_info_) { if (m_created) return(false); if (topic_name_.empty()) return(false); @@ -148,7 +148,7 @@ namespace eCAL m_datawriter->SetLayerMode(TLayer::tlayer_tcp, m_tlayer.sm_tcp); m_datawriter->SetLayerMode(TLayer::tlayer_inproc, m_tlayer.sm_inproc); // create it - if (!m_datawriter->Create(topic_name_, topic_info_)) + if (!m_datawriter->Create(topic_name_, data_type_info_)) { #ifndef NDEBUG // log it @@ -164,7 +164,7 @@ namespace eCAL g_pubgate()->Register(topic_name_, m_datawriter); // register to description gateway for type / description checking - ApplyTopicToDescGate(topic_name_, topic_info_); + ApplyTopicToDescGate(topic_name_, data_type_info_); // we made it :-) m_created = true; @@ -209,14 +209,14 @@ namespace eCAL if (m_datawriter == nullptr) return false; // register to description gateway for type / description checking - STopicInformation topic_info = m_datawriter->GetTopicInformation(); + SDataTypeInformation data_type_info = m_datawriter->GetDataTypeInformation(); // split the topic_type_name auto split_type = Util::SplitCombinedTopicType(topic_type_name_); - topic_info.encoding = split_type.first; - topic_info.type = split_type.second; - ApplyTopicToDescGate(m_datawriter->GetTopicName(), topic_info); + data_type_info.encoding = split_type.first; + data_type_info.name = split_type.second; + ApplyTopicToDescGate(m_datawriter->GetTopicName(), data_type_info); - return m_datawriter->SetTopicInformation(topic_info); + return m_datawriter->SetDataTypeInformation(data_type_info); } bool CPublisher::SetDescription(const std::string& topic_desc_) @@ -224,18 +224,18 @@ namespace eCAL if(m_datawriter == nullptr) return false; // register to description gateway for type / description checking - STopicInformation topic_info = m_datawriter->GetTopicInformation(); - topic_info.descriptor = topic_desc_; - ApplyTopicToDescGate(m_datawriter->GetTopicName(), topic_info); + SDataTypeInformation data_type_info = m_datawriter->GetDataTypeInformation(); + data_type_info.descriptor = topic_desc_; + ApplyTopicToDescGate(m_datawriter->GetTopicName(), data_type_info); - return m_datawriter->SetTopicInformation(topic_info); + return m_datawriter->SetDataTypeInformation(data_type_info); } - bool CPublisher::SetTopicInformation(const STopicInformation& topic_info_) + bool CPublisher::SetDataTypeInformation(const SDataTypeInformation& data_type_info_) { if (m_datawriter == nullptr) return false; - ApplyTopicToDescGate(m_datawriter->GetTopicName(), topic_info_); - return m_datawriter->SetTopicInformation(topic_info_); + ApplyTopicToDescGate(m_datawriter->GetTopicName(), data_type_info_); + return m_datawriter->SetDataTypeInformation(data_type_info_); } bool CPublisher::SetAttribute(const std::string& attr_name_, const std::string& attr_value_) @@ -425,19 +425,19 @@ namespace eCAL std::string CPublisher::GetTypeName() const { - STopicInformation info = GetTopicInformation(); - return(Util::CombinedTopicEncodingAndType(info.encoding, info.type)); + SDataTypeInformation info = GetDataTypeInformation(); + return(Util::CombinedTopicEncodingAndType(info.encoding, info.name)); } std::string CPublisher::GetDescription() const { - return(GetTopicInformation().descriptor); + return(GetDataTypeInformation().descriptor); } - STopicInformation CPublisher::GetTopicInformation() const + SDataTypeInformation CPublisher::GetDataTypeInformation() const { - if (m_datawriter == nullptr) return(STopicInformation{}); - return(m_datawriter->GetTopicInformation()); + if (m_datawriter == nullptr) return(SDataTypeInformation{}); + return(m_datawriter->GetDataTypeInformation()); } void CPublisher::InitializeQOS() @@ -450,21 +450,21 @@ namespace eCAL m_tlayer = TLayer::STLayer(); } - bool CPublisher::ApplyTopicToDescGate(const std::string& topic_name_, const STopicInformation& topic_info_) + bool CPublisher::ApplyTopicToDescGate(const std::string& topic_name_, const SDataTypeInformation& data_type_info_) { if (g_descgate() != nullptr) { // Calculate the quality of the current info ::eCAL::CDescGate::QualityFlags quality = ::eCAL::CDescGate::QualityFlags::NO_QUALITY; - if (!topic_info_.type.empty() || !topic_info_.encoding.empty()) + if (!data_type_info_.name.empty() || !data_type_info_.encoding.empty()) quality |= ::eCAL::CDescGate::QualityFlags::TYPE_AVAILABLE; - if (!topic_info_.descriptor.empty()) + if (!data_type_info_.descriptor.empty()) quality |= ::eCAL::CDescGate::QualityFlags::DESCRIPTION_AVAILABLE; quality |= ::eCAL::CDescGate::QualityFlags::INFO_COMES_FROM_THIS_PROCESS; quality |= ::eCAL::CDescGate::QualityFlags::INFO_COMES_FROM_CORRECT_ENTITY; quality |= ::eCAL::CDescGate::QualityFlags::INFO_COMES_FROM_PRODUCER; - return g_descgate()->ApplyTopicDescription(topic_name_, topic_info_, quality); + return g_descgate()->ApplyTopicDescription(topic_name_, data_type_info_, quality); } return false; } diff --git a/ecal/core/src/pubsub/ecal_subgate.cpp b/ecal/core/src/pubsub/ecal_subgate.cpp index f047408bcc..de43f46526 100644 --- a/ecal/core/src/pubsub/ecal_subgate.cpp +++ b/ecal/core/src/pubsub/ecal_subgate.cpp @@ -233,7 +233,7 @@ namespace eCAL if (topic_name.empty()) return; const std::string& topic_id = ecal_sample.tid(); - STopicInformation topic_info{ eCALSampleToTopicInformation(ecal_sample_) }; + SDataTypeInformation topic_info{ eCALSampleToTopicInformation(ecal_sample_) }; // store description ApplyTopicToDescGate(topic_name, topic_info); @@ -312,7 +312,7 @@ namespace eCAL const std::string& host_name = ecal_sample.hname(); const std::string& topic_name = ecal_sample.tname(); const std::string& topic_id = ecal_sample.tid(); - STopicInformation topic_info{ eCALSampleToTopicInformation(ecal_sample_) }; + SDataTypeInformation topic_info{ eCALSampleToTopicInformation(ecal_sample_) }; const std::string process_id = std::to_string(ecal_sample.pid()); // store description @@ -387,13 +387,13 @@ namespace eCAL return(0); } - bool CSubGate::ApplyTopicToDescGate(const std::string& topic_name_, const STopicInformation& topic_info_) + bool CSubGate::ApplyTopicToDescGate(const std::string& topic_name_, const SDataTypeInformation& topic_info_) { if (g_descgate() != nullptr) { // Calculate the quality of the current info ::eCAL::CDescGate::QualityFlags quality = ::eCAL::CDescGate::QualityFlags::NO_QUALITY; - if (!topic_info_.type.empty() || !topic_info_.encoding.empty()) + if (!topic_info_.name.empty() || !topic_info_.encoding.empty()) quality |= ::eCAL::CDescGate::QualityFlags::TYPE_AVAILABLE; if (!topic_info_.descriptor.empty()) quality |= ::eCAL::CDescGate::QualityFlags::DESCRIPTION_AVAILABLE; diff --git a/ecal/core/src/pubsub/ecal_subgate.h b/ecal/core/src/pubsub/ecal_subgate.h index 948b3f31f4..0e03464e5b 100644 --- a/ecal/core/src/pubsub/ecal_subgate.h +++ b/ecal/core/src/pubsub/ecal_subgate.h @@ -60,7 +60,7 @@ namespace eCAL protected: int CheckTimeouts(); - bool ApplyTopicToDescGate(const std::string& topic_name_, const STopicInformation& topic_info_); + bool ApplyTopicToDescGate(const std::string& topic_name_, const SDataTypeInformation& topic_info_); static std::atomic m_created; diff --git a/ecal/core/src/pubsub/ecal_subscriber.cpp b/ecal/core/src/pubsub/ecal_subscriber.cpp index dc297cacc3..f04edf78d4 100644 --- a/ecal/core/src/pubsub/ecal_subscriber.cpp +++ b/ecal/core/src/pubsub/ecal_subscriber.cpp @@ -46,14 +46,14 @@ namespace eCAL Create(topic_name_, topic_type_, topic_desc_); } - CSubscriber::CSubscriber(const std::string& topic_name_, const STopicInformation& topic_info_) + CSubscriber::CSubscriber(const std::string& topic_name_, const SDataTypeInformation& topic_info_) : CSubscriber() { Create(topic_name_, topic_info_); } CSubscriber::CSubscriber(const std::string& topic_name_) - : CSubscriber(topic_name_, STopicInformation{}) + : CSubscriber(topic_name_, SDataTypeInformation{}) {} CSubscriber::~CSubscriber() @@ -90,15 +90,15 @@ namespace eCAL bool CSubscriber::Create(const std::string& topic_name_, const std::string& topic_type_, const std::string& topic_desc_ /* = "" */) { - STopicInformation info; + SDataTypeInformation info; auto split_type = Util::SplitCombinedTopicType(topic_type_); info.encoding = split_type.first; - info.type = split_type.second; + info.name = split_type.second; info.descriptor = topic_desc_; return Create(topic_name_, info); } - bool CSubscriber::Create(const std::string& topic_name_, const STopicInformation& topic_info_) + bool CSubscriber::Create(const std::string& topic_name_, const SDataTypeInformation& topic_info_) { if (m_created) return(false); if (g_globals() == nullptr) return(false); @@ -263,20 +263,20 @@ namespace eCAL std::string CSubscriber::GetTypeName() const { if(m_datareader == nullptr) return(""); - STopicInformation info = m_datareader->GetTopicInformation(); - return(Util::CombinedTopicEncodingAndType(info.encoding, info.type)); + SDataTypeInformation info = m_datareader->GetDataTypeInformation(); + return(Util::CombinedTopicEncodingAndType(info.encoding, info.name)); } std::string CSubscriber::GetDescription() const { if(m_datareader == nullptr) return(""); - return(m_datareader->GetTopicInformation().descriptor); + return(m_datareader->GetDataTypeInformation().descriptor); } - STopicInformation CSubscriber::GetTopicInformation() const + SDataTypeInformation CSubscriber::GetDataTypeInformation() const { - if (m_datareader == nullptr) return(STopicInformation{}); - return(m_datareader->GetTopicInformation()); + if (m_datareader == nullptr) return(SDataTypeInformation{}); + return(m_datareader->GetDataTypeInformation()); } bool CSubscriber::SetTimeout(int timeout_) @@ -291,13 +291,13 @@ namespace eCAL m_qos.reliability = QOS::best_effort_reliability_qos; } - bool CSubscriber::ApplyTopicToDescGate(const std::string& topic_name_, const STopicInformation& topic_info_) + bool CSubscriber::ApplyTopicToDescGate(const std::string& topic_name_, const SDataTypeInformation& topic_info_) { if (g_descgate() != nullptr) { // Calculate the quality of the current info ::eCAL::CDescGate::QualityFlags quality = ::eCAL::CDescGate::QualityFlags::NO_QUALITY; - if (!topic_info_.type.empty() || !topic_info_.encoding.empty()) + if (!topic_info_.name.empty() || !topic_info_.encoding.empty()) quality |= ::eCAL::CDescGate::QualityFlags::TYPE_AVAILABLE; if (!topic_info_.descriptor.empty()) quality |= ::eCAL::CDescGate::QualityFlags::DESCRIPTION_AVAILABLE; diff --git a/ecal/core/src/readwrite/ecal_reader.cpp b/ecal/core/src/readwrite/ecal_reader.cpp index 0437540416..3e5db224e0 100644 --- a/ecal/core/src/readwrite/ecal_reader.cpp +++ b/ecal/core/src/readwrite/ecal_reader.cpp @@ -78,7 +78,7 @@ namespace eCAL Destroy(); } - bool CDataReader::Create(const std::string& topic_name_, const STopicInformation& topic_info_) + bool CDataReader::Create(const std::string& topic_name_, const SDataTypeInformation& topic_info_) { if(m_created) return(false); @@ -226,18 +226,18 @@ namespace eCAL ecal_reg_sample_mutable_topic->set_tid(m_topic_id); // topic_information // Remove eCAL6!! - if (m_use_ttype) ecal_reg_sample_mutable_topic->set_ttype(Util::CombinedTopicEncodingAndType(m_topic_info.encoding, m_topic_info.type)); + if (m_use_ttype) ecal_reg_sample_mutable_topic->set_ttype(Util::CombinedTopicEncodingAndType(m_topic_info.encoding, m_topic_info.name)); if (m_use_tdesc) ecal_reg_sample_mutable_topic->set_tdesc(m_topic_info.descriptor); { - auto* ecal_reg_sample_mutable_tinfo = ecal_reg_sample_mutable_topic->mutable_tinfo(); + auto* ecal_reg_sample_mutable_tdatatype = ecal_reg_sample_mutable_topic->mutable_tdatatype(); if (m_use_ttype) { - ecal_reg_sample_mutable_tinfo->set_encoding(m_topic_info.encoding); - ecal_reg_sample_mutable_tinfo->set_type(m_topic_info.type); + ecal_reg_sample_mutable_tdatatype->set_encoding(m_topic_info.encoding); + ecal_reg_sample_mutable_tdatatype->set_name(m_topic_info.name); } if (m_use_tdesc) { - ecal_reg_sample_mutable_tinfo->set_desc(m_topic_info.descriptor); + ecal_reg_sample_mutable_tdatatype->set_desc(m_topic_info.descriptor); } } *ecal_reg_sample_mutable_topic->mutable_attr() = google::protobuf::Map { m_attr.begin(), m_attr.end() }; @@ -612,7 +612,7 @@ namespace eCAL m_id_set = id_set_; } - void CDataReader::ApplyLocPublication(const std::string& process_id_, const std::string& tid_, const STopicInformation& tinfo_) + void CDataReader::ApplyLocPublication(const std::string& process_id_, const std::string& tid_, const SDataTypeInformation& tinfo_) { Connect(tid_, tinfo_); @@ -636,7 +636,7 @@ namespace eCAL } } - void CDataReader::ApplyExtPublication(const std::string& host_name_, const std::string& process_id_, const std::string& tid_, const STopicInformation& tinfo_) + void CDataReader::ApplyExtPublication(const std::string& host_name_, const std::string& process_id_, const std::string& tid_, const SDataTypeInformation& tinfo_) { Connect(tid_, tinfo_); @@ -714,7 +714,7 @@ namespace eCAL } } - void CDataReader::Connect(const std::string& tid_, const STopicInformation& topic_info_) + void CDataReader::Connect(const std::string& tid_, const SDataTypeInformation& data_type_info_) { SSubEventCallbackData data; data.time = std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count(); @@ -732,9 +732,9 @@ namespace eCAL data.type = sub_event_connected; data.tid = tid_; // Remove with eCAL6 (next two lines) - data.ttype = Util::CombinedTopicEncodingAndType(topic_info_.encoding, topic_info_.type); - data.tdesc = topic_info_.descriptor; - data.tinfo = topic_info_; + data.ttype = Util::CombinedTopicEncodingAndType(data_type_info_.encoding, data_type_info_.name); + data.tdesc = data_type_info_.descriptor; + data.tdatatype = data_type_info_; (iter->second)(m_topic_name.c_str(), &data); } } @@ -746,9 +746,9 @@ namespace eCAL { data.type = sub_event_update_connection; data.tid = tid_; - data.ttype = Util::CombinedTopicEncodingAndType(topic_info_.encoding, topic_info_.type); - data.tdesc = topic_info_.descriptor; - data.tinfo = topic_info_; + data.ttype = Util::CombinedTopicEncodingAndType(data_type_info_.encoding, data_type_info_.name); + data.tdesc = data_type_info_.descriptor; + data.tdatatype = data_type_info_; (iter->second)(m_topic_name.c_str(), &data); } } @@ -980,24 +980,24 @@ namespace eCAL std::stringstream out; out << std::endl; - out << indent_ << "--------------------------------" << std::endl; - out << indent_ << " class CDataReader " << std::endl; - out << indent_ << "--------------------------------" << std::endl; - out << indent_ << "m_host_name: " << m_host_name << std::endl; - out << indent_ << "m_host_group_name: " << m_host_group_name << std::endl; - out << indent_ << "m_host_id: " << m_host_id << std::endl; - out << indent_ << "m_topic_name: " << m_topic_name << std::endl; - out << indent_ << "m_topic_id: " << m_topic_id << std::endl; - out << indent_ << "m_topic_info.encoding: " << m_topic_info.encoding << std::endl; - out << indent_ << "m_topic_info.type: " << m_topic_info.type << std::endl; - out << indent_ << "m_topic_info.descriptor: " << m_topic_info.descriptor << std::endl; - out << indent_ << "m_topic_size: " << m_topic_size << std::endl; - out << indent_ << "m_read_buf.size(): " << m_read_buf.size() << std::endl; - out << indent_ << "m_read_time: " << m_read_time << std::endl; - out << indent_ << "m_clock: " << m_clock << std::endl; - out << indent_ << "m_rec_time: " << std::chrono::duration_cast(m_rec_time.time_since_epoch()).count() << std::endl; - out << indent_ << "m_freq: " << m_freq << std::endl; - out << indent_ << "m_created: " << m_created << std::endl; + out << indent_ << "------------------------------------" << std::endl; + out << indent_ << " class CDataReader " << std::endl; + out << indent_ << "------------------------------------" << std::endl; + out << indent_ << "m_host_name: " << m_host_name << std::endl; + out << indent_ << "m_host_group_name: " << m_host_group_name << std::endl; + out << indent_ << "m_host_id: " << m_host_id << std::endl; + out << indent_ << "m_topic_name: " << m_topic_name << std::endl; + out << indent_ << "m_topic_id: " << m_topic_id << std::endl; + out << indent_ << "m_topic_info.encoding: " << m_topic_info.encoding << std::endl; + out << indent_ << "m_topic_info.name: " << m_topic_info.name << std::endl; + out << indent_ << "m_topic_info.descriptor: " << m_topic_info.descriptor << std::endl; + out << indent_ << "m_topic_size: " << m_topic_size << std::endl; + out << indent_ << "m_read_buf.size(): " << m_read_buf.size() << std::endl; + out << indent_ << "m_read_time: " << m_read_time << std::endl; + out << indent_ << "m_clock: " << m_clock << std::endl; + out << indent_ << "m_rec_time: " << std::chrono::duration_cast(m_rec_time.time_since_epoch()).count() << std::endl; + out << indent_ << "m_freq: " << m_freq << std::endl; + out << indent_ << "m_created: " << m_created << std::endl; out << std::endl; return(out.str()); diff --git a/ecal/core/src/readwrite/ecal_reader.h b/ecal/core/src/readwrite/ecal_reader.h index 723f3f1acf..d36cef2ca7 100644 --- a/ecal/core/src/readwrite/ecal_reader.h +++ b/ecal/core/src/readwrite/ecal_reader.h @@ -25,7 +25,7 @@ #include #include -#include +#include #ifdef _MSC_VER #pragma warning(push, 0) // disable proto warnings @@ -56,7 +56,7 @@ namespace eCAL static void InitializeLayers(); - bool Create(const std::string& topic_name_, const STopicInformation& topic_info_); + bool Create(const std::string& topic_name_, const SDataTypeInformation& topic_info_); bool Destroy(); bool SetQOS(const QOS::SReaderQOS& qos_); @@ -76,10 +76,10 @@ namespace eCAL void SetID(const std::set& id_set_); - void ApplyLocPublication(const std::string& process_id_, const std::string& tid_, const STopicInformation& tinfo_); + void ApplyLocPublication(const std::string& process_id_, const std::string& tid_, const SDataTypeInformation& tinfo_); void RemoveLocPublication(const std::string& process_id_, const std::string& tid_); - void ApplyExtPublication(const std::string& host_name_, const std::string& process_id_, const std::string& tid_, const STopicInformation& tinfo_); + void ApplyExtPublication(const std::string& host_name_, const std::string& process_id_, const std::string& tid_, const SDataTypeInformation& tinfo_); void RemoveExtPublication(const std::string& host_name_, const std::string& process_id_, const std::string& tid_); void ApplyLocLayerParameter(const std::string& process_id_, const std::string& topic_id_, eCAL::pb::eTLayerType type_, const std::string& parameter_); @@ -95,9 +95,9 @@ namespace eCAL return(m_loc_pub_map.size() + m_ext_pub_map.size()); } - std::string GetTopicName() const {return(m_topic_name);} - std::string GetTopicID() const {return(m_topic_id);} - STopicInformation GetTopicInformation() const {return(m_topic_info);} + std::string GetTopicName() const {return(m_topic_name);} + std::string GetTopicID() const {return(m_topic_id);} + SDataTypeInformation GetDataTypeInformation() const {return(m_topic_info);} void RefreshRegistration(); void CheckReceiveTimeout(); @@ -111,7 +111,7 @@ namespace eCAL bool Register(bool force_); bool Unregister(); - void Connect(const std::string& tid_, const STopicInformation& topic_info_); + void Connect(const std::string& tid_, const SDataTypeInformation& topic_info_); void Disconnect(); bool CheckMessageClock(const std::string& tid_, long long current_clock_); @@ -122,7 +122,7 @@ namespace eCAL std::string m_pname; std::string m_topic_name; std::string m_topic_id; - STopicInformation m_topic_info; + SDataTypeInformation m_topic_info; std::map m_attr; std::atomic m_topic_size; diff --git a/ecal/core/src/readwrite/ecal_writer.cpp b/ecal/core/src/readwrite/ecal_writer.cpp index fb00ae8835..fb84a9f1bb 100644 --- a/ecal/core/src/readwrite/ecal_writer.cpp +++ b/ecal/core/src/readwrite/ecal_writer.cpp @@ -100,7 +100,7 @@ namespace eCAL Destroy(); } - bool CDataWriter::Create(const std::string& topic_name_, const STopicInformation& topic_info_) + bool CDataWriter::Create(const std::string& topic_name_, const SDataTypeInformation& topic_info_) { if (m_created) return(false); @@ -219,7 +219,7 @@ namespace eCAL - bool CDataWriter::SetTopicInformation(const STopicInformation& topic_info_) + bool CDataWriter::SetDataTypeInformation(const SDataTypeInformation& topic_info_) { // Does it even make sense to register if the info is the same??? const bool force = m_topic_info != topic_info_; @@ -654,7 +654,7 @@ namespace eCAL else return 0; } - void CDataWriter::ApplyLocSubscription(const std::string& process_id_, const std::string& tid_, const STopicInformation& tinfo_, const std::string& reader_par_) + void CDataWriter::ApplyLocSubscription(const std::string& process_id_, const std::string& tid_, const SDataTypeInformation& tinfo_, const std::string& reader_par_) { Connect(tid_, tinfo_); @@ -696,7 +696,7 @@ namespace eCAL #endif } - void CDataWriter::ApplyExtSubscription(const std::string& host_name_, const std::string& process_id_, const std::string& tid_, const STopicInformation& tinfo_, const std::string& reader_par_) + void CDataWriter::ApplyExtSubscription(const std::string& host_name_, const std::string& process_id_, const std::string& tid_, const SDataTypeInformation& tinfo_, const std::string& reader_par_) { Connect(tid_, tinfo_); @@ -802,22 +802,22 @@ namespace eCAL std::stringstream out; out << std::endl; - out << indent_ << "--------------------------------" << std::endl; - out << indent_ << " class CDataWriter " << std::endl; - out << indent_ << "--------------------------------" << std::endl; - out << indent_ << "m_host_name: " << m_host_name << std::endl; - out << indent_ << "m_host_group_name: " << m_host_group_name << std::endl; - out << indent_ << "m_host_id: " << m_host_id << std::endl; - out << indent_ << "m_topic_name: " << m_topic_name << std::endl; - out << indent_ << "m_topic_id: " << m_topic_id << std::endl; - out << indent_ << "m_topic_info.encoding: " << m_topic_info.encoding << std::endl; - out << indent_ << "m_topic_info.type: " << m_topic_info.type << std::endl; - out << indent_ << "m_topic_info.descriptor: " << m_topic_info.descriptor << std::endl; - out << indent_ << "m_id: " << m_id << std::endl; - out << indent_ << "m_clock: " << m_clock << std::endl; - out << indent_ << "m_created: " << m_created << std::endl; - out << indent_ << "m_loc_subscribed: " << m_loc_subscribed << std::endl; - out << indent_ << "m_ext_subscribed: " << m_ext_subscribed << std::endl; + out << indent_ << "--------------------------" << std::endl; + out << indent_ << " class CDataWriter " << std::endl; + out << indent_ << "--------------------------" << std::endl; + out << indent_ << "m_host_name: " << m_host_name << std::endl; + out << indent_ << "m_host_group_name: " << m_host_group_name << std::endl; + out << indent_ << "m_host_id: " << m_host_id << std::endl; + out << indent_ << "m_topic_name: " << m_topic_name << std::endl; + out << indent_ << "m_topic_id: " << m_topic_id << std::endl; + out << indent_ << "m_topic_info.encoding: " << m_topic_info.encoding << std::endl; + out << indent_ << "m_topic_info.name: " << m_topic_info.name << std::endl; + out << indent_ << "m_topic_info.descriptor: " << m_topic_info.descriptor << std::endl; + out << indent_ << "m_id: " << m_id << std::endl; + out << indent_ << "m_clock: " << m_clock << std::endl; + out << indent_ << "m_created: " << m_created << std::endl; + out << indent_ << "m_loc_subscribed: " << m_loc_subscribed << std::endl; + out << indent_ << "m_ext_subscribed: " << m_ext_subscribed << std::endl; out << std::endl; return(out.str()); @@ -849,19 +849,19 @@ namespace eCAL ecal_reg_sample_mutable_topic->set_hid(m_host_id); ecal_reg_sample_mutable_topic->set_tname(m_topic_name); ecal_reg_sample_mutable_topic->set_tid(m_topic_id); - if (share_ttype) ecal_reg_sample_mutable_topic->set_ttype(Util::CombinedTopicEncodingAndType(m_topic_info.encoding, m_topic_info.type)); + if (share_ttype) ecal_reg_sample_mutable_topic->set_ttype(Util::CombinedTopicEncodingAndType(m_topic_info.encoding, m_topic_info.name)); if (share_tdesc) ecal_reg_sample_mutable_topic->set_tdesc(m_topic_info.descriptor); // topic_information { - auto* ecal_reg_sample_mutable_tinfo = ecal_reg_sample_mutable_topic->mutable_tinfo(); + auto* ecal_reg_sample_mutable_tdatatype = ecal_reg_sample_mutable_topic->mutable_tdatatype(); if (share_ttype) { - ecal_reg_sample_mutable_tinfo->set_encoding(m_topic_info.encoding); - ecal_reg_sample_mutable_tinfo->set_type(m_topic_info.type); + ecal_reg_sample_mutable_tdatatype->set_encoding(m_topic_info.encoding); + ecal_reg_sample_mutable_tdatatype->set_name(m_topic_info.name); } if (share_tdesc) { - ecal_reg_sample_mutable_tinfo->set_desc(m_topic_info.descriptor); + ecal_reg_sample_mutable_tdatatype->set_desc(m_topic_info.descriptor); } } *ecal_reg_sample_mutable_topic->mutable_attr() = google::protobuf::Map { m_attr.begin(), m_attr.end() }; @@ -998,7 +998,7 @@ namespace eCAL return(true); } - void CDataWriter::Connect(const std::string& tid_, const STopicInformation& tinfo_) + void CDataWriter::Connect(const std::string& tid_, const SDataTypeInformation& tinfo_) { SPubEventCallbackData data; data.time = std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count(); @@ -1024,9 +1024,9 @@ namespace eCAL data.type = pub_event_update_connection; data.tid = tid_; // Remove with eCAL6 (next two lines) - data.ttype = Util::CombinedTopicEncodingAndType(tinfo_.encoding, tinfo_.type); + data.ttype = Util::CombinedTopicEncodingAndType(tinfo_.encoding, tinfo_.name); data.tdesc = tinfo_.descriptor; - data.tinfo = tinfo_; + data.tdatatype = tinfo_; (iter->second)(m_topic_name.c_str(), &data); } } diff --git a/ecal/core/src/readwrite/ecal_writer.h b/ecal/core/src/readwrite/ecal_writer.h index b9b604f3df..9cc77c90c2 100644 --- a/ecal/core/src/readwrite/ecal_writer.h +++ b/ecal/core/src/readwrite/ecal_writer.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include "ecal_def.h" #include "ecal_expmap.h" @@ -50,10 +50,10 @@ namespace eCAL CDataWriter(); ~CDataWriter(); - bool Create(const std::string& topic_name_, const STopicInformation& topic_info_); + bool Create(const std::string& topic_name_, const SDataTypeInformation& topic_info_); bool Destroy(); - bool SetTopicInformation(const STopicInformation& topic_info_); + bool SetDataTypeInformation(const SDataTypeInformation& topic_info_); bool SetAttribute(const std::string& attr_name_, const std::string& attr_value_); bool ClearAttribute(const std::string& attr_name_); @@ -77,10 +77,10 @@ namespace eCAL size_t Write(CPayloadWriter& payload_, long long time_, long long id_); - void ApplyLocSubscription(const std::string& process_id_, const std::string& tid_, const STopicInformation& tinfo_, const std::string& reader_par_); + void ApplyLocSubscription(const std::string& process_id_, const std::string& tid_, const SDataTypeInformation& tinfo_, const std::string& reader_par_); void RemoveLocSubscription(const std::string & process_id_, const std::string& tid_); - void ApplyExtSubscription(const std::string& host_name_, const std::string& process_id_, const std::string& tid_, const STopicInformation& tinfo_, const std::string& reader_par_); + void ApplyExtSubscription(const std::string& host_name_, const std::string& process_id_, const std::string& tid_, const SDataTypeInformation& tinfo_, const std::string& reader_par_); void RemoveExtSubscription(const std::string & host_name_, const std::string & process_id_, const std::string& tid_); void RefreshRegistration(); @@ -98,13 +98,13 @@ namespace eCAL } const std::string& GetTopicName() const {return(m_topic_name);} - const STopicInformation& GetTopicInformation() const { return m_topic_info; } + const SDataTypeInformation& GetDataTypeInformation() const { return m_topic_info; } protected: bool Register(bool force_); bool Unregister(); - void Connect(const std::string& tid_, const STopicInformation& tinfo_); + void Connect(const std::string& tid_, const SDataTypeInformation& tinfo_); void Disconnect(); void SetUseUdpMC(TLayer::eSendMode mode_); @@ -124,7 +124,7 @@ namespace eCAL std::string m_pname; std::string m_topic_name; std::string m_topic_id; - STopicInformation m_topic_info; + SDataTypeInformation m_topic_info; std::map m_attr; size_t m_topic_size; diff --git a/ecal/core/src/service/ecal_clientgate.cpp b/ecal/core/src/service/ecal_clientgate.cpp index 87b97fb2fc..094a4b4fdb 100644 --- a/ecal/core/src/service/ecal_clientgate.cpp +++ b/ecal/core/src/service/ecal_clientgate.cpp @@ -111,7 +111,14 @@ namespace eCAL // store description for (const auto& method : ecal_sample_service.methods()) { - ApplyServiceToDescGate(ecal_sample_service.sname(), method.mname(), method.req_type(), method.req_desc(), method.resp_type(), method.resp_desc()); + SDataTypeInformation request_type; + request_type.name = method.req_type(); + request_type.descriptor = method.req_desc(); + SDataTypeInformation response_type{}; + response_type.name = method.resp_type(); + response_type.descriptor = method.resp_desc(); + + ApplyServiceToDescGate(ecal_sample_service.sname(), method.mname(), request_type, response_type); } // create service key @@ -171,21 +178,19 @@ namespace eCAL bool CClientGate::ApplyServiceToDescGate(const std::string& service_name_ , const std::string& method_name_ - , const std::string& req_type_name_ - , const std::string& req_type_desc_ - , const std::string& resp_type_name_ - , const std::string& resp_type_desc_) + , const SDataTypeInformation& reqest_type_description_ + , const SDataTypeInformation& response_type_description_) { if (g_descgate() != nullptr) { // calculate the quality of the current info ::eCAL::CDescGate::QualityFlags quality = ::eCAL::CDescGate::QualityFlags::NO_QUALITY; - if (!(req_type_name_.empty() && resp_type_name_.empty())) + if (!(reqest_type_description_.name.empty() && response_type_description_.name.empty())) quality |= ::eCAL::CDescGate::QualityFlags::TYPE_AVAILABLE; - if (!(req_type_desc_.empty() && resp_type_desc_.empty())) + if (!(reqest_type_description_.descriptor.empty() && response_type_description_.descriptor.empty())) quality |= ::eCAL::CDescGate::QualityFlags::DESCRIPTION_AVAILABLE; - return g_descgate()->ApplyServiceDescription(service_name_, method_name_, req_type_name_, req_type_desc_, resp_type_name_, resp_type_desc_, quality); + return g_descgate()->ApplyServiceDescription(service_name_, method_name_, reqest_type_description_, response_type_description_, quality); } return false; } diff --git a/ecal/core/src/service/ecal_clientgate.h b/ecal/core/src/service/ecal_clientgate.h index ad4f869805..aac4affe30 100644 --- a/ecal/core/src/service/ecal_clientgate.h +++ b/ecal/core/src/service/ecal_clientgate.h @@ -64,10 +64,8 @@ namespace eCAL bool ApplyServiceToDescGate(const std::string& service_name_ , const std::string& method_name_ - , const std::string& req_type_name_ - , const std::string& req_type_desc_ - , const std::string& resp_type_name_ - , const std::string& resp_type_desc_); + , const SDataTypeInformation& reqest_type_description_ + , const SDataTypeInformation& response_type_description_); protected: static std::atomic m_created; diff --git a/ecal/core/src/service/ecal_service_server.cpp b/ecal/core/src/service/ecal_service_server.cpp index dc084bc15d..411980b95f 100644 --- a/ecal/core/src/service/ecal_service_server.cpp +++ b/ecal/core/src/service/ecal_service_server.cpp @@ -116,7 +116,13 @@ namespace eCAL bool CServiceServer::AddDescription(const std::string& method_, const std::string& req_type_, const std::string& req_desc_, const std::string& resp_type_, const std::string& resp_desc_) { if (!m_created) return false; - return m_service_server_impl->AddDescription(method_, req_type_, req_desc_, resp_type_, resp_desc_); + SDataTypeInformation reqest_type_description_; + reqest_type_description_.name = req_type_; + reqest_type_description_.descriptor = req_desc_; + SDataTypeInformation response_type_description_; + reqest_type_description_.name = resp_type_; + reqest_type_description_.descriptor = resp_desc_; + return m_service_server_impl->AddDescription(method_, reqest_type_description_, response_type_description_); } /** diff --git a/ecal/core/src/service/ecal_service_server_impl.cpp b/ecal/core/src/service/ecal_service_server_impl.cpp index 70159f0fc5..4affa7c8f3 100644 --- a/ecal/core/src/service/ecal_service_server_impl.cpp +++ b/ecal/core/src/service/ecal_service_server_impl.cpp @@ -110,7 +110,7 @@ namespace eCAL return(true); } - bool CServiceServerImpl::AddDescription(const std::string& method_, const std::string& req_type_, const std::string& req_desc_, const std::string& resp_type_, const std::string& resp_desc_) + bool CServiceServerImpl::AddDescription(const std::string& method_, const SDataTypeInformation& reqest_type_description_, const SDataTypeInformation& response_type_description_) { { std::lock_guard const lock(m_method_map_sync); @@ -118,25 +118,25 @@ namespace eCAL if (iter != m_method_map.end()) { iter->second.method_pb.set_mname(method_); - iter->second.method_pb.set_req_type(req_type_); - iter->second.method_pb.set_req_desc(req_desc_); - iter->second.method_pb.set_resp_type(resp_type_); - iter->second.method_pb.set_resp_desc(resp_desc_); + iter->second.method_pb.set_req_type(reqest_type_description_.name); + iter->second.method_pb.set_req_desc(reqest_type_description_.descriptor); + iter->second.method_pb.set_resp_type(response_type_description_.name); + iter->second.method_pb.set_resp_desc(response_type_description_.descriptor); } else { SMethod method; method.method_pb.set_mname(method_); - method.method_pb.set_req_type(req_type_); - method.method_pb.set_req_desc(req_desc_); - method.method_pb.set_resp_type(resp_type_); - method.method_pb.set_resp_desc(resp_desc_); + method.method_pb.set_req_type(reqest_type_description_.name); + method.method_pb.set_req_desc(reqest_type_description_.descriptor); + method.method_pb.set_resp_type(response_type_description_.name); + method.method_pb.set_resp_desc(response_type_description_.descriptor); m_method_map[method_] = method; } } // update descgate infos - return ApplyServiceToDescGate(method_, req_type_, req_desc_, resp_type_, resp_desc_); + return ApplyServiceToDescGate(method_, reqest_type_description_, response_type_description_); } // add callback function for server method calls @@ -171,8 +171,14 @@ namespace eCAL } } + SDataTypeInformation request_datatype_description; + request_datatype_description.name = req_type_; + request_datatype_description.descriptor = req_desc; + SDataTypeInformation response_datatype_description; + response_datatype_description.name = resp_type_; + response_datatype_description.descriptor = resp_desc; // update descgate infos - ApplyServiceToDescGate(method_, req_type_, req_desc, resp_type_, resp_desc); + ApplyServiceToDescGate(method_, request_datatype_description, response_datatype_description); return true; } @@ -416,22 +422,20 @@ namespace eCAL } bool CServiceServerImpl::ApplyServiceToDescGate(const std::string& method_name_ - , const std::string& req_type_name_ - , const std::string& req_type_desc_ - , const std::string& resp_type_name_ - , const std::string& resp_type_desc_) + , const SDataTypeInformation& reqest_type_description_ + , const SDataTypeInformation& response_type_description_) { if (g_descgate() != nullptr) { // Calculate the quality of the current info ::eCAL::CDescGate::QualityFlags quality = ::eCAL::CDescGate::QualityFlags::NO_QUALITY; - if (!(req_type_name_.empty() && resp_type_name_.empty())) + if (!(reqest_type_description_.name.empty() && response_type_description_.name.empty())) quality |= ::eCAL::CDescGate::QualityFlags::TYPE_AVAILABLE; - if (!(req_type_desc_.empty() && resp_type_desc_.empty())) + if (!(reqest_type_description_.descriptor.empty() && response_type_description_.descriptor.empty())) quality |= ::eCAL::CDescGate::QualityFlags::DESCRIPTION_AVAILABLE; quality |= ::eCAL::CDescGate::QualityFlags::INFO_COMES_FROM_THIS_PROCESS; - return g_descgate()->ApplyServiceDescription(m_service_name, method_name_, req_type_name_, req_type_desc_, resp_type_name_, resp_type_desc_, quality); + return g_descgate()->ApplyServiceDescription(m_service_name, method_name_, reqest_type_description_, response_type_description_, quality); } return false; } diff --git a/ecal/core/src/service/ecal_service_server_impl.h b/ecal/core/src/service/ecal_service_server_impl.h index 728149c22c..3cf6597366 100644 --- a/ecal/core/src/service/ecal_service_server_impl.h +++ b/ecal/core/src/service/ecal_service_server_impl.h @@ -56,7 +56,7 @@ namespace eCAL bool Destroy(); - bool AddDescription(const std::string& method_, const std::string& req_type_, const std::string& req_desc_, const std::string& resp_type_, const std::string& resp_desc_); + bool AddDescription(const std::string& method_, const SDataTypeInformation& reqest_type_description_, const SDataTypeInformation& response_type_description_); // add and remove callback function for server method calls bool AddMethodCallback(const std::string& method_, const std::string& req_type_, const std::string& resp_type_, const MethodCallbackT& callback_); @@ -96,10 +96,8 @@ namespace eCAL void EventCallback(eCAL_Server_Event event_, const std::string& message_); bool ApplyServiceToDescGate(const std::string& method_name_ - , const std::string& req_type_name_ - , const std::string& req_type_desc_ - , const std::string& resp_type_name_ - , const std::string& resp_type_desc_); + , const SDataTypeInformation& reqest_type_description_ + , const SDataTypeInformation& response_type_description_); CTcpServer m_tcp_server; diff --git a/ecal/core_pb/src/ecal/core/pb/topic.proto b/ecal/core_pb/src/ecal/core/pb/topic.proto index 25aa441333..bf22455f7f 100644 --- a/ecal/core_pb/src/ecal/core/pb/topic.proto +++ b/ecal/core_pb/src/ecal/core/pb/topic.proto @@ -42,41 +42,41 @@ message QOS // quality of service int32 history_depth = 3; // number of samples for history kind "keep last" } -message TopicInformation +message DataTypeInformation { - string encoding = 1; - string type = 2; + string name = 1; + string encoding = 2; bytes desc = 3; } -message Topic // eCAL topic +message Topic // eCAL topic { - int32 rclock = 1; // registration clock (heart beat) - int32 hid = 26; // host id - string hname = 2; // host name - string hgname = 28; // host group name - int32 pid = 3; // process id - string pname = 4; // process name - string uname = 5; // unit name - string tid = 6; // topic id - string tname = 7; // topic name - string direction = 8; // direction (publisher, subscriber) - string ttype = 9; // topic type + topic encoding (deprecated) - bytes tdesc = 10; // topic description (protocol descriptor) (deprecated) + int32 rclock = 1; // registration clock (heart beat) + int32 hid = 26; // host id + string hname = 2; // host name + string hgname = 28; // host group name + int32 pid = 3; // process id + string pname = 4; // process name + string uname = 5; // unit name + string tid = 6; // topic id + string tname = 7; // topic name + string direction = 8; // direction (publisher, subscriber) + string ttype = 9; // topic type + topic encoding (deprecated) + bytes tdesc = 10; // topic description (protocol descriptor) (deprecated) - TopicInformation tinfo = 30; // topic information (encoding & type & description) + DataTypeInformation tdatatype = 30; // topic datatype information (encoding & type & description) - QOS tqos = 11; // topic quality of service - repeated TLayer tlayer = 12; // active topic transport layers and it's specific parameter - int32 tsize = 13; // topic size - - int32 connections_loc = 16; // number of local connected entities - int32 connections_ext = 17; // number of external connected entities - int32 message_drops = 18; // dropped messages - - int64 did = 19; // data send id (publisher setid) - int64 dclock = 20; // data clock (send / receive action) - int32 dfreq = 21; // data frequency (send / receive samples per second) [mHz] + QOS tqos = 11; // topic quality of service + repeated TLayer tlayer = 12; // active topic transport layers and it's specific parameter + int32 tsize = 13; // topic size + + int32 connections_loc = 16; // number of local connected entities + int32 connections_ext = 17; // number of external connected entities + int32 message_drops = 18; // dropped messages + + int64 did = 19; // data send id (publisher setid) + int64 dclock = 20; // data clock (send / receive action) + int32 dfreq = 21; // data frequency (send / receive samples per second) [mHz] map attr = 27; // generic topic description } diff --git a/samples/cpp/benchmarks/many_connections_rec/src/many_connections_rec.cpp b/samples/cpp/benchmarks/many_connections_rec/src/many_connections_rec.cpp index a1f7116341..6f6682a59a 100644 --- a/samples/cpp/benchmarks/many_connections_rec/src/many_connections_rec.cpp +++ b/samples/cpp/benchmarks/many_connections_rec/src/many_connections_rec.cpp @@ -38,7 +38,7 @@ class SubscriberCreator { std::ostringstream tname; tname << std::setw(5) << std::setfill('0') << i; - subscribers.emplace_back("Topic" + tname.str(), eCAL::STopicInformation{ "", ttype, tdesc }); + subscribers.emplace_back("Topic" + tname.str(), eCAL::SDataTypeInformation{ ttype, "", tdesc }); subscribers.at(i).AddReceiveCallback(std::bind(&SubscriberCreator::Receive, this)); } } diff --git a/samples/cpp/benchmarks/many_connections_snd/src/many_connections_snd.cpp b/samples/cpp/benchmarks/many_connections_snd/src/many_connections_snd.cpp index a9215596c1..623d8a4dbf 100644 --- a/samples/cpp/benchmarks/many_connections_snd/src/many_connections_snd.cpp +++ b/samples/cpp/benchmarks/many_connections_snd/src/many_connections_snd.cpp @@ -38,7 +38,7 @@ class PublisherCreator { std::ostringstream tname; tname << std::setw(5) << std::setfill('0') << i; - publishers.emplace_back("Topic" + tname.str(), eCAL::STopicInformation{ "", ttype, tdesc }); + publishers.emplace_back("Topic" + tname.str(), eCAL::SDataTypeInformation{ ttype, "", tdesc }); } } diff --git a/samples/cpp/benchmarks/performance_rec/src/performance_rec.cpp b/samples/cpp/benchmarks/performance_rec/src/performance_rec.cpp index e876de23b2..32a2e3b654 100644 --- a/samples/cpp/benchmarks/performance_rec/src/performance_rec.cpp +++ b/samples/cpp/benchmarks/performance_rec/src/performance_rec.cpp @@ -32,9 +32,9 @@ int main(int argc, char **argv) eCAL::Initialize(argc, argv, "performance_rec"); // create subscriber for topic "Performance" - eCAL::STopicInformation topic_info; + eCAL::SDataTypeInformation topic_info; topic_info.encoding = "base"; - topic_info.type = "std::string"; + topic_info.name = "std::string"; eCAL::CSubscriber sub("Performance", topic_info); // safe the start time diff --git a/samples/cpp/monitoring/monitoring_get_services/src/monitoring_get_services.cpp b/samples/cpp/monitoring/monitoring_get_services/src/monitoring_get_services.cpp index 2ede38f13b..6ebe66fd30 100644 --- a/samples/cpp/monitoring/monitoring_get_services/src/monitoring_get_services.cpp +++ b/samples/cpp/monitoring/monitoring_get_services/src/monitoring_get_services.cpp @@ -38,7 +38,7 @@ int main(int argc, char **argv) { // GetServices { - std::map, eCAL::Util::SServiceMethodInfo> service_info_map; + std::map, eCAL::SServiceMethodInformation> service_info_map; start_time = std::chrono::steady_clock::now(); for (run = 0; run < runs; ++run) diff --git a/samples/cpp/monitoring/monitoring_get_topics/src/monitoring_get_topics.cpp b/samples/cpp/monitoring/monitoring_get_topics/src/monitoring_get_topics.cpp index 2a52be995a..7e7c5acdcf 100644 --- a/samples/cpp/monitoring/monitoring_get_topics/src/monitoring_get_topics.cpp +++ b/samples/cpp/monitoring/monitoring_get_topics/src/monitoring_get_topics.cpp @@ -37,7 +37,7 @@ int main(int argc, char **argv) { // GetTopics { - std::unordered_map topic_info_map; + std::unordered_map topic_info_map; start_time = std::chrono::steady_clock::now(); for (run = 0; run < runs; ++run) diff --git a/samples/cpp/pubsub/binary/ping/src/ping.cpp b/samples/cpp/pubsub/binary/ping/src/ping.cpp index b1dc13a73e..90a931d9b7 100644 --- a/samples/cpp/pubsub/binary/ping/src/ping.cpp +++ b/samples/cpp/pubsub/binary/ping/src/ping.cpp @@ -29,7 +29,7 @@ int main(int argc, char **argv) // initialize eCAL API eCAL::Initialize(argc, argv, "ping"); - eCAL::STopicInformation topic_info{ "", "long long", "" }; + eCAL::SDataTypeInformation topic_info{ "long long", "", "" }; eCAL::CPublisher pub_pulse("pulse_send", topic_info); eCAL::CSubscriber sub_pulse("pulse_reply", topic_info); diff --git a/samples/cpp/pubsub/binary/pong/src/pong.cpp b/samples/cpp/pubsub/binary/pong/src/pong.cpp index 859a8fdc27..31503963d3 100644 --- a/samples/cpp/pubsub/binary/pong/src/pong.cpp +++ b/samples/cpp/pubsub/binary/pong/src/pong.cpp @@ -26,7 +26,7 @@ int main(int argc, char **argv) // initialize eCAL API eCAL::Initialize(argc, argv, "pong"); - eCAL::STopicInformation topic_info{ "", "long long", "" }; + eCAL::SDataTypeInformation topic_info{ "long long", "", "" }; eCAL::CSubscriber sub_pulse("pulse_send", topic_info); eCAL::CPublisher pub_pulse("pulse_reply", topic_info); diff --git a/samples/cpp/pubsub/protobuf/person_rec_events/src/person_rec_events.cpp b/samples/cpp/pubsub/protobuf/person_rec_events/src/person_rec_events.cpp index b843dfc459..dd592e5da9 100644 --- a/samples/cpp/pubsub/protobuf/person_rec_events/src/person_rec_events.cpp +++ b/samples/cpp/pubsub/protobuf/person_rec_events/src/person_rec_events.cpp @@ -48,8 +48,8 @@ void OnEvent(const char* topic_name_, const struct eCAL::SSubEventCallbackData* case sub_event_update_connection: std::cout << "event : " << "sub_event_update_connection" << std::endl; std::cout << " topic_id : " << data_->tid << std::endl; - std::cout << " topic_encoding : " << data_->tinfo.encoding << std::endl; - std::cout << " topic_type : " << data_->tinfo.type << std::endl; + std::cout << " topic_encoding : " << data_->tdatatype.encoding << std::endl; + std::cout << " topic_type : " << data_->tdatatype.name << std::endl; //std::cout << " topic_desc : " << data_->tdesc << std::endl; break; default: diff --git a/samples/cpp/pubsub/protobuf/person_snd_events/src/person_snd_events.cpp b/samples/cpp/pubsub/protobuf/person_snd_events/src/person_snd_events.cpp index fcf6794893..3c70c7767a 100644 --- a/samples/cpp/pubsub/protobuf/person_snd_events/src/person_snd_events.cpp +++ b/samples/cpp/pubsub/protobuf/person_snd_events/src/person_snd_events.cpp @@ -42,8 +42,8 @@ void OnEvent(const char* topic_name_, const struct eCAL::SPubEventCallbackData* case pub_event_update_connection: std::cout << "event : " << "pub_event_update_connection" << std::endl; std::cout << " topic_id : " << data_->tid << std::endl; - std::cout << " topic_encoding : " << data_->tinfo.encoding << std::endl; - std::cout << " topic_type : " << data_->tinfo.type << std::endl; + std::cout << " topic_encoding : " << data_->tdatatype.encoding << std::endl; + std::cout << " topic_type : " << data_->tdatatype.name << std::endl; //std::cout << " topic_desc : " << data_->tdesc << std::endl; break; default: diff --git a/testing/ecal/pubsub_test/src/pubsub_gettopics.cpp b/testing/ecal/pubsub_test/src/pubsub_gettopics.cpp index fa7d876783..b5f6cd1cff 100644 --- a/testing/ecal/pubsub_test/src/pubsub_gettopics.cpp +++ b/testing/ecal/pubsub_test/src/pubsub_gettopics.cpp @@ -31,18 +31,18 @@ TEST(IO, GetTopics) // initialize eCAL API eCAL::Initialize(0, nullptr, "pubsub_gettopics"); - std::unordered_map topic_info_map; + std::unordered_map topic_info_map; // create and check a few pub/sub entities { - eCAL::STopicInformation info_A1 { "", "typeA1" , "descA1" }; - eCAL::STopicInformation info_A1_2{ "", "typeA1.2", "descA1.2" }; - eCAL::STopicInformation info_A2 { "", "typeA2" , "descA2" }; - eCAL::STopicInformation info_A3 { "", "typeA3" , "descA3" }; + eCAL::SDataTypeInformation info_A1 { "typeA1" ,"", "descA1" }; + eCAL::SDataTypeInformation info_A1_2{ "typeA1.2","", "descA1.2" }; + eCAL::SDataTypeInformation info_A2 { "typeA2" ,"", "descA2" }; + eCAL::SDataTypeInformation info_A3 { "typeA3" ,"", "descA3" }; - eCAL::STopicInformation info_B1 { "", "typeB1" , "descB1" }; - eCAL::STopicInformation info_B1_2{ "", "typeB1.2", "descB1.2" }; - eCAL::STopicInformation info_B2 { "", "typeB2" , "descB2" }; + eCAL::SDataTypeInformation info_B1 { "typeB1" ,"", "descB1" }; + eCAL::SDataTypeInformation info_B1_2{ "typeB1.2","", "descB1.2" }; + eCAL::SDataTypeInformation info_B2 { "typeB2" ,"", "descB2" }; // create 3 publisher eCAL::CPublisher pub1("A1", info_A1); @@ -70,9 +70,9 @@ TEST(IO, GetTopics) // check types and descriptions for (auto& topic_info : topic_info_map) { - eCAL::STopicInformation utils_topic_info; - eCAL::Util::GetTopicInformation(topic_info.first, utils_topic_info); - eCAL::STopicInformation expected_topic_info{ "", "type" + topic_info.first, "desc" + topic_info.first }; + eCAL::SDataTypeInformation utils_topic_info; + eCAL::Util::GetTopicDataTypeInformation(topic_info.first, utils_topic_info); + eCAL::SDataTypeInformation expected_topic_info{ "type" + topic_info.first, "", "desc" + topic_info.first }; EXPECT_EQ(utils_topic_info, expected_topic_info); } @@ -93,13 +93,13 @@ TEST(IO, GetTopics) // pub1 and sub1 still exists { - eCAL::STopicInformation utils_topic_info; - eCAL::Util::GetTopicInformation("A1", utils_topic_info); + eCAL::SDataTypeInformation utils_topic_info; + eCAL::Util::GetTopicDataTypeInformation("A1", utils_topic_info); EXPECT_EQ(utils_topic_info, info_A1); } { - eCAL::STopicInformation utils_topic_info; - eCAL::Util::GetTopicInformation("B1", utils_topic_info); + eCAL::SDataTypeInformation utils_topic_info; + eCAL::Util::GetTopicDataTypeInformation("B1", utils_topic_info); EXPECT_EQ(utils_topic_info, info_B1); } @@ -114,13 +114,13 @@ TEST(IO, GetTopics) // check overwritten attributes { - eCAL::STopicInformation utils_topic_info; - eCAL::Util::GetTopicInformation("A1", utils_topic_info); + eCAL::SDataTypeInformation utils_topic_info; + eCAL::Util::GetTopicDataTypeInformation("A1", utils_topic_info); EXPECT_EQ(utils_topic_info, info_A1_2); } { - eCAL::STopicInformation utils_topic_info; - eCAL::Util::GetTopicInformation("B1", utils_topic_info); + eCAL::SDataTypeInformation utils_topic_info; + eCAL::Util::GetTopicDataTypeInformation("B1", utils_topic_info); EXPECT_EQ(utils_topic_info, info_B1_2); } } diff --git a/testing/ecal/pubsub_test/src/pubsub_test.cpp b/testing/ecal/pubsub_test/src/pubsub_test.cpp index d242679a07..ff85053007 100644 --- a/testing/ecal/pubsub_test/src/pubsub_test.cpp +++ b/testing/ecal/pubsub_test/src/pubsub_test.cpp @@ -136,16 +136,16 @@ TEST(IO, TypeDescriptionStatic) // create publisher without type and description eCAL::CPublisher pub("A"); - eCAL::STopicInformation tinfo = pub.GetTopicInformation(); - EXPECT_EQ("", tinfo.encoding); - EXPECT_EQ("", tinfo.type); - EXPECT_EQ("", tinfo.descriptor); + eCAL::SDataTypeInformation tdatatype = pub.GetDataTypeInformation(); + EXPECT_EQ("", tdatatype.encoding); + EXPECT_EQ("", tdatatype.name); + EXPECT_EQ("", tdatatype.descriptor); // check type name - eCAL::Util::GetTopicInformation("A", tinfo); - EXPECT_EQ("", tinfo.encoding); - EXPECT_EQ("", tinfo.type); - EXPECT_EQ("", tinfo.descriptor); + eCAL::Util::GetTopicDataTypeInformation("A", tdatatype); + EXPECT_EQ("", tdatatype.encoding); + EXPECT_EQ("", tdatatype.name); + EXPECT_EQ("", tdatatype.descriptor); // finalize eCAL API eCAL::Finalize(); @@ -157,53 +157,53 @@ TEST(IO, TypeDescriptionDynamic) eCAL::Initialize(0, nullptr, "pubsub_test"); { - eCAL::STopicInformation tinfo{ "encoding_A", "type_A", "desc_A" }; + eCAL::SDataTypeInformation tdatatype{ "encoding_A", "type_A", "desc_A" }; // create publisher with type and description - eCAL::CPublisher pub("A", tinfo); + eCAL::CPublisher pub("A", tdatatype); // check topic information - eCAL::STopicInformation retrieved_info = pub.GetTopicInformation(); - EXPECT_EQ(retrieved_info, tinfo); + eCAL::SDataTypeInformation retrieved_info = pub.GetDataTypeInformation(); + EXPECT_EQ(retrieved_info, tdatatype); // check topic information from eCAL Utils - eCAL::STopicInformation retrieved_util_info; - eCAL::Util::GetTopicInformation("A", retrieved_util_info); - EXPECT_EQ(retrieved_util_info, tinfo); + eCAL::SDataTypeInformation retrieved_util_info; + eCAL::Util::GetTopicDataTypeInformation("A", retrieved_util_info); + EXPECT_EQ(retrieved_util_info, tdatatype); // set topic info - eCAL::STopicInformation tinfo_new(tinfo); + eCAL::SDataTypeInformation tinfo_new(tdatatype); tinfo_new.descriptor = "desc_A_new"; - pub.SetTopicInformation(tinfo_new); // Already set descriptions are not overwritten in the database + pub.SetDataTypeInformation(tinfo_new); // Already set descriptions are not overwritten in the database // check type name (should not be influenced by SetDescription) - eCAL::STopicInformation retrieved_util_info_new; - eCAL::Util::GetTopicInformation("A", retrieved_util_info_new); - EXPECT_EQ(retrieved_util_info_new, tinfo); + eCAL::SDataTypeInformation retrieved_util_info_new; + eCAL::Util::GetTopicDataTypeInformation("A", retrieved_util_info_new); + EXPECT_EQ(retrieved_util_info_new, tdatatype); // check description of publisher - EXPECT_EQ(pub.GetTopicInformation(), tinfo_new); + EXPECT_EQ(pub.GetDataTypeInformation(), tinfo_new); } // Test replace empty description { - eCAL::STopicInformation tinfo_no_desc{ "", "my_type", "" }; - eCAL::STopicInformation tinfo_with_desc{ "", "my_type", "my_description" }; - eCAL::STopicInformation tinfo_with_other_desc{ "", "my_type", "my_description_2" }; + eCAL::SDataTypeInformation tinfo_no_desc{ "my_type", "", "" }; + eCAL::SDataTypeInformation tinfo_with_desc{ "my_type", "", "my_description" }; + eCAL::SDataTypeInformation tinfo_with_other_desc{ "my_type", "", "my_description_2" }; auto pub2 = eCAL::CPublisher("B", tinfo_no_desc); { - eCAL::STopicInformation retrieved_util_info; - eCAL::Util::GetTopicInformation("B", retrieved_util_info); + eCAL::SDataTypeInformation retrieved_util_info; + eCAL::Util::GetTopicDataTypeInformation("B", retrieved_util_info); EXPECT_EQ(retrieved_util_info, tinfo_no_desc); } - pub2.SetTopicInformation(tinfo_with_desc); + pub2.SetDataTypeInformation(tinfo_with_desc); { - eCAL::STopicInformation retrieved_util_info; - eCAL::Util::GetTopicInformation("B", retrieved_util_info); + eCAL::SDataTypeInformation retrieved_util_info; + eCAL::Util::GetTopicDataTypeInformation("B", retrieved_util_info); EXPECT_EQ(retrieved_util_info, tinfo_with_desc); } @@ -211,24 +211,24 @@ TEST(IO, TypeDescriptionDynamic) auto pub3 = eCAL::CPublisher("B", tinfo_with_other_desc); { - eCAL::STopicInformation retrieved_util_info; - eCAL::Util::GetTopicInformation("B", retrieved_util_info); + eCAL::SDataTypeInformation retrieved_util_info; + eCAL::Util::GetTopicDataTypeInformation("B", retrieved_util_info); EXPECT_EQ(retrieved_util_info, tinfo_with_desc); } } // Test Publisher replaces subscriber's description { - eCAL::STopicInformation tinfo_C1{ "", "type1", "desc" }; - eCAL::STopicInformation tinfo_C2{ "", "type2", "" }; - eCAL::STopicInformation tinfo_C3{ "", "type3", "desc3" }; + eCAL::SDataTypeInformation tinfo_C1{ "type1", "", "desc" }; + eCAL::SDataTypeInformation tinfo_C2{ "type2", "", "" }; + eCAL::SDataTypeInformation tinfo_C3{ "type3", "", "desc3" }; auto sub = eCAL::CSubscriber("C", tinfo_C1); { - eCAL::STopicInformation retrieved_util_info; - eCAL::Util::GetTopicInformation("C", retrieved_util_info); + eCAL::SDataTypeInformation retrieved_util_info; + eCAL::Util::GetTopicDataTypeInformation("C", retrieved_util_info); EXPECT_EQ(retrieved_util_info, tinfo_C1); } @@ -236,8 +236,8 @@ TEST(IO, TypeDescriptionDynamic) auto pub1 = eCAL::CPublisher("C", tinfo_C2); { - eCAL::STopicInformation retrieved_util_info; - eCAL::Util::GetTopicInformation("C", retrieved_util_info); + eCAL::SDataTypeInformation retrieved_util_info; + eCAL::Util::GetTopicDataTypeInformation("C", retrieved_util_info); EXPECT_EQ(retrieved_util_info, tinfo_C1); } @@ -245,8 +245,8 @@ TEST(IO, TypeDescriptionDynamic) auto pub2 = eCAL::CPublisher("C", tinfo_C3); { - eCAL::STopicInformation retrieved_util_info; - eCAL::Util::GetTopicInformation("C", retrieved_util_info); + eCAL::SDataTypeInformation retrieved_util_info; + eCAL::Util::GetTopicDataTypeInformation("C", retrieved_util_info); EXPECT_EQ(retrieved_util_info, tinfo_C3); } }