From 47df55ca704e17df9d73aaf20bb8c35a5be91ea4 Mon Sep 17 00:00:00 2001 From: Nate Koenig Date: Fri, 11 Aug 2023 05:46:22 -0700 Subject: [PATCH] Remove ignition (#367) Signed-off-by: Nate Koenig --- NEWS | 2 +- include/gz/msgs/Factory.hh | 22 ++----------- src/CMakeLists.txt | 2 +- src/Factory.cc | 63 +++++++------------------------------- src/Generator.cc | 2 +- 5 files changed, 17 insertions(+), 74 deletions(-) diff --git a/NEWS b/NEWS index 6b7be6e1..a73d9b7c 100644 --- a/NEWS +++ b/NEWS @@ -1 +1 @@ -http://ignition_robotics.org +http://gazebosim.org diff --git a/include/gz/msgs/Factory.hh b/include/gz/msgs/Factory.hh index 75fdd113..840e022a 100644 --- a/include/gz/msgs/Factory.hh +++ b/include/gz/msgs/Factory.hh @@ -64,16 +64,8 @@ namespace gz public: template static std::unique_ptr New(const std::string &_msgType) { - auto msgType = _msgType; - if (msgType.find("ignition") == 0) - { - msgType.replace(0, 8, "gz"); - std::cerr << "Trying to create deprecated message type [" - << _msgType << "]. Using [" << msgType - << "] instead." << std::endl; - } - return std::unique_ptr( - static_cast(New(msgType).release())); + return std::unique_ptr( + static_cast(New(_msgType).release())); } /// \brief Create a new instance of a message. @@ -85,16 +77,8 @@ namespace gz static std::unique_ptr New(const std::string &_msgType, const std::string &_args) { - auto msgType = _msgType; - if (msgType.find("ignition") == 0) - { - msgType.replace(0, 8, "gz"); - std::cerr << "Trying to create deprecated message type [" - << _msgType << "]. Using [" << msgType - << "] instead." << std::endl; - } return std::unique_ptr( - static_cast(New(msgType, _args).release())); + static_cast(New(_msgType, _args).release())); } /// \brief Create a new instance of a message. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8a62751d..9a1739f4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -204,7 +204,7 @@ gz_install_includes( # Install gz/msgs/details gz_install_includes( - "${GZ_INCLUDE_INSTALL_DIR_POSTFIX}/gz/${IGN_DESIGNATION}/details" + "${GZ_INCLUDE_INSTALL_DIR_POSTFIX}/gz/${GZ_DESIGNATION}/details" ${gen_detail_headers}) ################################################## diff --git a/src/Factory.cc b/src/Factory.cc index b8a10c06..c6c84e02 100644 --- a/src/Factory.cc +++ b/src/Factory.cc @@ -83,21 +83,7 @@ class DynamicFactory // Try to get the list of paths from an environment variable. const char *descPaths = std::getenv("GZ_DESCRIPTOR_PATH"); if (!descPaths) - { - // TODO(CH3): Deprecated. Remove on tock. - // Remember to still return !! - descPaths = std::getenv("IGN_DESCRIPTOR_PATH"); - - if (!descPaths) - { - return; - } - else - { - std::cerr << "IGN_DESCRIPTOR_PATH is deprecated and will be removed! " - << "Use GZ_DESCRIPTOR_PATH instead!" << std::endl; - } - } + return; // Load all the descriptors found in the paths set with GZ_DESCRIPTOR_PATH. this->LoadDescriptors(descPaths); @@ -161,25 +147,16 @@ class DynamicFactory /// type could not be handled. public: static ProtoUniquePtr New(const std::string &_msgType) { - auto msgType = _msgType; - if (msgType.find("ignition") == 0) - { - msgType.replace(0, 8, "gz"); - std::cerr << "Trying to create deprecated message type [" - << _msgType << "]. Using [" << msgType << "] instead." - << std::endl; - } - // Shortcut if the type has been already registered. std::map>::iterator msgF = - dynamicMsgMap.find(msgType); + dynamicMsgMap.find(_msgType); if (msgF != dynamicMsgMap.end()) return msgF->second(); // Nothing to do if we don't know about this type in the descriptor map. const google::protobuf::Descriptor *descriptor = - pool.FindMessageTypeByName(msgType); + pool.FindMessageTypeByName(_msgType); if (!descriptor) return nullptr; @@ -236,34 +213,25 @@ void Factory::Register(const std::string &_msgType, std::unique_ptr Factory::New( const std::string &_msgType) { - auto msgType = _msgType; - if (msgType.find("ignition") == 0) - { - msgType.replace(0, 8, "gz"); - std::cerr << "Trying to create deprecated message type [" - << _msgType << "]. Using [" << msgType << "] instead." - << std::endl; - } - std::unique_ptr msg; std::string type; // Convert "gz.msgs." to "gz_msgs.". - if (msgType.find("gz.msgs.") == 0) + if (_msgType.find("gz.msgs.") == 0) { - type = "gz_msgs." + msgType.substr(8); + type = "gz_msgs." + _msgType.substr(8); } // Convert ".gz.msgs." to "gz_msgs.". - else if (msgType.find(".gz.msgs.") == 0) + else if (_msgType.find(".gz.msgs.") == 0) { - type = "gz_msgs." + msgType.substr(9); + type = "gz_msgs." + _msgType.substr(9); } else { // Fix typenames that are missing "gz_msgs." at the beginning. - if (msgType.find("gz_msgs.") != 0) + if (_msgType.find("gz_msgs.") != 0) type = "gz_msgs."; - type += msgType; + type += _msgType; } // Create a new message if a FactoryFn has been assigned to the message type @@ -271,7 +239,7 @@ std::unique_ptr Factory::New( return ((*msgMap)[type]) (); // Check if we have the message descriptor. - msg = dynamicFactory.New(msgType); + msg = dynamicFactory.New(_msgType); return msg; } @@ -280,16 +248,7 @@ std::unique_ptr Factory::New( std::unique_ptr Factory::New( const std::string &_msgType, const std::string &_args) { - auto msgType = _msgType; - if (msgType.find("ignition") == 0) - { - msgType.replace(0, 8, "gz"); - std::cerr << "Trying to create deprecated message type [" - << _msgType << "]. Using [" << msgType << "] instead." - << std::endl; - } - - std::unique_ptr msg = New(msgType); + std::unique_ptr msg = New(_msgType); if (msg) { google::protobuf::TextFormat::ParseFromString(_args, msg.get()); diff --git a/src/Generator.cc b/src/Generator.cc index afa3b0a8..09254708 100644 --- a/src/Generator.cc +++ b/src/Generator.cc @@ -89,7 +89,7 @@ bool Generator::Generate(const FileDescriptor *_file, auto parent_path = filePath.parent_path(); auto fileStem = filePath.stem().string(); - // protoc generates ignition/msgs/msg.pb.cc and ignition/msgs/msg.pb.hh + // protoc generates gz/msgs/msg.pb.cc and gz/msgs/msg.pb.hh // This generator injects code into the msg.pb.cc file, but generates // a completely new header that wraps the original protobuf header //