Skip to content

Commit

Permalink
ign -> gz Macro Migration : gz-transport (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
methylDragon authored Jun 18, 2022
1 parent fbde7d7 commit f0ebc57
Show file tree
Hide file tree
Showing 17 changed files with 132 additions and 109 deletions.
31 changes: 18 additions & 13 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,24 @@ release will remove the deprecated code.
Use the `GZ_` prefixed versions instead!
1. `IGN_TRANSPORT_USERNAME` -> `GZ_TRANSPORT_USERNAME`

1. `IGN_TRANSPORT_PASSWORD` -> `GZ_TRANSPORT_PASSWORD`
1. `IGN_PARTITION` -> `GZ_PARTITION`
1. `IGN_IP` -> `GZ_IP`
1. `IGN_TRANSPORT_TOPIC_STATISTICS` -> `GZ_TRANSPORT_TOPIC_STATISTICS`
1. `IGN_DISCOVERY_MSG_PORT` -> `GZ_DISCOVERY_MSG_PORT`
1. `IGN_DISCOVERY_MULTICAST_IP` -> `GZ_DISCOVERY_MULTICAST_IP`
1. `IGN_DISCOVERY_SRV_PORT` -> `GZ_DISCOVERY_SRV_PORT`
1. `IGN_RELAY` -> `GZ_RELAY`
1. `IGN_TRANSPORT_LOG_SQL_PATH` -> `GZ_TRANSPORT_LOG_SQL_PATH`
1. `IGN_TRANSPORT_RCVHWM` -> `GZ_TRANSPORT_RCVHWM`
1. `IGN_TRANSPORT_SNDHWM` -> `GZ_TRANSPORT_SNDHWM`
1. `IGN_VERBOSE` -> `GZ_VERBOSE`

1. `IGN_TRANSPORT_PASSWORD` -> `GZ_TRANSPORT_PASSWORD`
1. `IGN_PARTITION` -> `GZ_PARTITION`
1. `IGN_IP` -> `GZ_IP`
1. `IGN_TRANSPORT_TOPIC_STATISTICS` -> `GZ_TRANSPORT_TOPIC_STATISTICS`
1. `IGN_DISCOVERY_MSG_PORT` -> `GZ_DISCOVERY_MSG_PORT`
1. `IGN_DISCOVERY_MULTICAST_IP` -> `GZ_DISCOVERY_MULTICAST_IP`
1. `IGN_DISCOVERY_SRV_PORT` -> `GZ_DISCOVERY_SRV_PORT`
1. `IGN_RELAY` -> `GZ_RELAY`
1. `IGN_TRANSPORT_LOG_SQL_PATH` -> `GZ_TRANSPORT_LOG_SQL_PATH`
1. `IGN_TRANSPORT_RCVHWM` -> `GZ_TRANSPORT_RCVHWM`
1. `IGN_TRANSPORT_SNDHWM` -> `GZ_TRANSPORT_SNDHWM`
1. `IGN_VERBOSE` -> `GZ_VERBOSE`
1. The following `IGN_` prefixed macros are deprecated and will be removed in future versions.
Additionally, they will only be available when including the corresponding `ignition/...` header.
Use the `GZ_` prefix instead.
1. `IGN_ZMQ_POST_4_3_1`
1. `IGN_CPPZMQ_POST_4_7_0`
1. `ign_strcat`, `ign_strcpy`, `ign_sprintf`, `ign_strdup`

## Gazebo Transport 9.X to 10.X

Expand Down
2 changes: 1 addition & 1 deletion include/gz/transport/CIface.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,5 @@ extern "C" {
}
#endif

// INCLUDE_IGNITION_TRANSPORT_CIFACE_H_
// INCLUDE_GZ_TRANSPORT_CIFACE_H_
#endif
8 changes: 4 additions & 4 deletions include/gz/transport/Clock.hh
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ namespace gz
private: class Implementation;

/// \internal Pointer to the implementation of this class
IGN_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
private: std::unique_ptr<Implementation> dataPtr;
IGN_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
};

//////////////////////////////////////////////////
Expand All @@ -118,9 +118,9 @@ namespace gz
private: class Implementation;

/// \internal Pointer to the implementation of this class
IGN_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
private: std::unique_ptr<Implementation> dataPtr;
IGN_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/gz/transport/Discovery.hh
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ namespace gz
// words, the frame_delimiter contains a value that represents
// the total size of only the frame_body.
//
// It is possible that two incompatible versions of Ignition
// It is possible that two incompatible versions of Gazebo
// Transport exist on the same network. If we receive an
// unexpected size, then we ignore the message.

Expand Down
20 changes: 10 additions & 10 deletions include/gz/transport/Helpers.hh
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@

// Avoid using deprecated message send/receive function when possible.
#if ZMQ_VERSION > ZMQ_MAKE_VERSION(4, 3, 1)
#define IGN_ZMQ_POST_4_3_1
#define GZ_ZMQ_POST_4_3_1
#endif

// Avoid using deprecated set function when possible
#if CPPZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 7, 0)
// Ubuntu Focal (20.04) packages a different "4.7.0"
#ifndef UBUNTU_FOCAL
#define IGN_CPPZMQ_POST_4_7_0
#define GZ_CPPZMQ_POST_4_7_0
#endif
#endif

Expand Down Expand Up @@ -74,15 +74,15 @@ namespace gz

// Use safer functions on Windows
#ifdef _MSC_VER
#define ign_strcat strcat_s
#define ign_strcpy strcpy_s
#define ign_sprintf sprintf_s
#define ign_strdup _strdup
#define gz_strcat strcat_s
#define gz_strcpy strcpy_s
#define gz_sprintf sprintf_s
#define gz_strdup _strdup
#else
#define ign_strcat std::strcat
#define ign_strcpy std::strcpy
#define ign_sprintf std::sprintf
#define ign_strdup strdup
#define gz_strcat std::strcat
#define gz_strcpy std::strcpy
#define gz_sprintf std::sprintf
#define gz_strdup strdup
#endif
}
}
Expand Down
18 changes: 18 additions & 0 deletions include/ignition/transport/Helpers.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,21 @@

#include <gz/transport/Helpers.hh>
#include <ignition/transport/config.hh>

// Avoid using deprecated message send/receive function when possible.
#if ZMQ_VERSION > ZMQ_MAKE_VERSION(4, 3, 1)
#define IGN_ZMQ_POST_4_3_1 GZ_ZMQ_POST_4_3_1
#endif

// Avoid using deprecated set function when possible
#if CPPZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 7, 0)
// Ubuntu Focal (20.04) packages a different "4.7.0"
#ifndef UBUNTU_FOCAL
#define IGN_CPPZMQ_POST_4_7_0 GZ_CPPZMQ_POST_4_7_0
#endif
#endif

#define ign_strcat gz_strcat
#define ign_strcpy gz_strcpy
#define ign_sprintf gz_sprintf
#define ign_strdup gz_strdup
4 changes: 2 additions & 2 deletions log/include/gz/transport/log/Playback.hh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace gz
using PlaybackHandlePtr = std::shared_ptr<PlaybackHandle>;

//////////////////////////////////////////////////
/// \brief Initiates playback of ignition transport topics
/// \brief Initiates playback of Gazebo Transport topics
/// This class makes it easy to play topics from a log file
///
/// Responsibilities: topic name matching and initiating the playback
Expand Down Expand Up @@ -153,7 +153,7 @@ namespace gz
};

//////////////////////////////////////////////////
/// \brief Handles the playback of ignition transport topics.
/// \brief Handles the playback of Gazebo Transport topics.
/// This class allows you to manage a log playback once it has started.
/// You must hang onto the PlaybackHandle or else the playback will end
/// early.
Expand Down
2 changes: 1 addition & 1 deletion log/include/gz/transport/log/Recorder.hh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace gz
ALREADY_SUBSCRIBED_TO_TOPIC = -6,
};

/// \brief Records ignition transport topics
/// \brief Records Gazebo Transport topics
/// This class makes it easy to record topics to a log file.
/// Responsibilities: topic name matching, time received tracking,
/// multiple thread safety, subscribing to topics
Expand Down
16 changes: 8 additions & 8 deletions log/test/integration/playback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ bool ExpectSameMessages(
//////////////////////////////////////////////////
/// \brief Record a log and then play it back. Verify that the playback matches
/// the original.
TEST(playback, IGN_UTILS_TEST_DISABLED_ON_MAC(ReplayLog))
TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(ReplayLog))
{
std::vector<std::string> topics = {"/foo", "/bar", "/baz"};

Expand Down Expand Up @@ -176,7 +176,7 @@ TEST(playback, IGN_UTILS_TEST_DISABLED_ON_MAC(ReplayLog))


//////////////////////////////////////////////////
TEST(playback, IGN_UTILS_TEST_DISABLED_ON_MAC(ReplayNoSuchTopic))
TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(ReplayNoSuchTopic))
{
gz::transport::log::Recorder recorder;
const std::string logName =
Expand All @@ -195,7 +195,7 @@ TEST(playback, IGN_UTILS_TEST_DISABLED_ON_MAC(ReplayNoSuchTopic))
//////////////////////////////////////////////////
/// \brief Record a log and then play it back. Verify that the playback matches
/// the original.
TEST(playback, IGN_UTILS_TEST_DISABLED_ON_MAC(ReplayLogRegex))
TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(ReplayLogRegex))
{
std::vector<std::string> topics = {"/foo", "/bar", "/baz"};

Expand Down Expand Up @@ -262,7 +262,7 @@ TEST(playback, IGN_UTILS_TEST_DISABLED_ON_MAC(ReplayLogRegex))
//////////////////////////////////////////////////
/// \brief Record a log and then play it back after removing some topics. Verify
/// that the playback matches the original.
TEST(playback, IGN_UTILS_TEST_DISABLED_ON_MAC(RemoveTopic))
TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(RemoveTopic))
{
std::vector<std::string> topics = {"/foo", "/bar", "/baz"};

Expand Down Expand Up @@ -371,7 +371,7 @@ TEST(playback, IGN_UTILS_TEST_DISABLED_ON_MAC(RemoveTopic))
//////////////////////////////////////////////////
/// \brief Record a log and then play it back. Verify that the playback matches
/// the original.
TEST(playback, IGN_UTILS_TEST_DISABLED_ON_MAC(ReplayLogMoveInstances))
TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(ReplayLogMoveInstances))
{
std::vector<std::string> topics = {"/foo", "/bar", "/baz"};

Expand Down Expand Up @@ -441,7 +441,7 @@ TEST(playback, IGN_UTILS_TEST_DISABLED_ON_MAC(ReplayLogMoveInstances))
//////////////////////////////////////////////////
/// \brief Record a log and then play it back calling the Pause and Resume
/// methods to control the playback flow.
TEST(playback, IGN_UTILS_TEST_DISABLED_ON_MAC(ReplayPauseResume))
TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(ReplayPauseResume))
{
std::vector<std::string> topics = {"/foo", "/bar", "/baz"};

Expand Down Expand Up @@ -563,7 +563,7 @@ TEST(playback, IGN_UTILS_TEST_DISABLED_ON_MAC(ReplayPauseResume))
//////////////////////////////////////////////////
/// \brief Record a log and then play it back calling the Step method to control
/// the playback workflow.
TEST(playback, IGN_UTILS_TEST_DISABLED_ON_MAC(ReplayStep))
TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(ReplayStep))
{
std::vector<std::string> topics = {"/foo", "/bar", "/baz"};

Expand Down Expand Up @@ -679,7 +679,7 @@ TEST(playback, IGN_UTILS_TEST_DISABLED_ON_MAC(ReplayStep))
//////////////////////////////////////////////////
/// \brief Record a log and then play it back calling the Seek method to control
/// the playback workflow.
TEST(playback, IGN_UTILS_TEST_DISABLED_ON_MAC(ReplaySeek))
TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(ReplaySeek))
{
std::vector<std::string> topics = {"/foo", "/bar", "/baz"};

Expand Down
2 changes: 1 addition & 1 deletion log/test/integration/recorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void VerifyMessage(const gz::transport::log::Message &_msg,
/// \brief Begin recording a set of topics before those topics are advertised
/// or published to.
TEST(recorder,
IGN_UTILS_TEST_DISABLED_ON_MAC(BeginRecordingTopicsBeforeAdvertisement))
GZ_UTILS_TEST_DISABLED_ON_MAC(BeginRecordingTopicsBeforeAdvertisement))
{
// Remember to include a leading slash so that the VerifyTopic lambda below
// will work correctly. ign-transport automatically adds a leading slash to
Expand Down
2 changes: 1 addition & 1 deletion src/NetUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ inline namespace GZ_TRANSPORT_VERSION_NAMESPACE
reinterpret_cast<sockaddr_in*>(unicast->Address.lpSockaddr);
// Make it a dotted quad
char ipv4_str[3*4+3+1];
ign_sprintf(ipv4_str, "%d.%d.%d.%d",
gz_sprintf(ipv4_str, "%d.%d.%d.%d",
sockaddress->sin_addr.S_un.S_un_b.s_b1,
sockaddress->sin_addr.S_un.S_un_b.s_b2,
sockaddress->sin_addr.S_un.S_un_b.s_b3,
Expand Down
2 changes: 1 addition & 1 deletion src/Node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ bool Node::Unsubscribe(const std::string &_topic)
if (!this->dataPtr->shared->localSubscribers
.HasSubscriber(fullyQualifiedTopic))
{
#ifdef IGN_CPPZMQ_POST_4_7_0
#ifdef GZ_CPPZMQ_POST_4_7_0
this->dataPtr->shared->dataPtr->subscriber->set(
zmq::sockopt::unsubscribe, fullyQualifiedTopic);
#else
Expand Down
Loading

0 comments on commit f0ebc57

Please sign in to comment.