Skip to content

Commit

Permalink
Migrate macros
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed Jun 6, 2022
1 parent 915ca32 commit 6d519a1
Show file tree
Hide file tree
Showing 99 changed files with 364 additions and 316 deletions.
29 changes: 21 additions & 8 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,31 @@ release will remove the deprecated code.
4. The logging macros (`ignmsg`, `ignwarn`, `ignerr`, etc.) and logging function macros
(`ignLogInit()`, etc.) are deprecated and will be removed in future versions. Use `gz` instead
(e.g. `gzmsg`, `gzwarn`, `gzLogInit()`)

5. All the plugin APIs are deprecated, use the gz-plugin library instead. See
the [migration guide](https://github.com/ignitionrobotics/ign-plugin/blob/ign-plugin1/MIGRATION.md).

6. The following `IGN_` prefixed environment variables are deprecated and will be removed.
Please use the `GZ_` prefixed versions instead!
1. `IGN_VIDEO_ALLOWED_ENCODERS` -> `GZ_VIDEO_ALLOWED_ENCODERS`
2. `IGN_VIDEO_ENCODER_DEVICE` -> `GZ_VIDEO_ENCODER_DEVICE`
3. `IGN_VIDEO_USE_HW_SURFACE` -> `GZ_VIDEO_USE_HW_SURFACE`
4. `IGN_FILE_PATH` -> `GZ_FILE_PATH`
5. `IGN_LOG_PATH` -> `GZ_LOG_PATH`
6. `IGN_PLUGIN_PATH` -> `GZ_PLUGIN_PATH`
2. `IGN_VIDEO_ENCODER_DEVICE` -> `GZ_VIDEO_ENCODER_DEVICE`
3. `IGN_VIDEO_USE_HW_SURFACE` -> `GZ_VIDEO_USE_HW_SURFACE`
4. `IGN_FILE_PATH` -> `GZ_FILE_PATH`
5. `IGN_LOG_PATH` -> `GZ_LOG_PATH`
6. `IGN_PLUGIN_PATH` -> `GZ_PLUGIN_PATH`
7. The following `IGN_` / `IGNITION_` prefixed macros are deprecated and will be removed in future versions.
Use the `GZ_` prefix instead.
1. `IGN_ENUM`
2. `IGN_HOMEDIR`
3. `IGN_NANO_TO_SEC`, `IGN_SEC_TO_NANO`, `IGN_MS_TO_NANO`, `IGN_US_TO_NANO`
4. `IGN_SPEED_OF_LIGHT`
5. `IGN_SLEEP_S`, `IGN_SLEEP_US`, `IGN_SLEEP_MS`, `IGN_SLEEP_NS`
6. `IGN_SYSTEM_TIME`, `IGN_SYSTEM_TIME_S`, `IGN_SYSTEM_TIME_US`, `IGN_SYSTEM_TIME_MS`, `IGN_SYSTEM_TIME_NS`
7. `IGN_ASSERT`
8. `IGNITION_COMMON_TINYOBJLOADER_IMPLEMENTATION` (`src` local, hard-tocked)
9. `IGN_PROFILER_ENABLE`, `IGN_PROFILE_THREAD_NAME`, `IGN_PROFILE_LOG_TEXT`, `IGN_PROFILE_BEGIN`, `IGN_PROFILE_END`, `IGN_PROFILE_L`, `IGN_PROFILE`, `IGN_PROFILE_VALID`
10. `IGN_CREATE_SPEC_INTERFACE`
11. `IGN_DUMMY_PLUGIN_PATH`
12. `IGNITION_UNITTEST_SPECIALIZED_PLUGIN_ACCESS`



### Additions
Expand Down Expand Up @@ -90,7 +103,7 @@ release will remove the deprecated code.

1. Requires c++17.

1. (New in 3.8.0) On Windows, the value of C++ macro `IGN_HOMEDIR` changed from `HOMEPATH` to `USERPROFILE`. It is usually used to read the path to the user's home from environment. The old value pointed to a path relative to the (a) current drive letter as reported by `pwd`, not the system drive letter. The new value correctly points to an environment variable that contains the full absolute path to the user's profile. If the code did not use the macro in some unexpected way, the new behavior should work either the same or even better (it would work even when the current directory is on a non-system drive). If the code relied on this value to be relative to the current drive letter, it needs to be changed to use `HOMEPATH` directly.
1. (New in 3.8.0) On Windows, the value of C++ macro `GZ_HOMEDIR` changed from `HOMEPATH` to `USERPROFILE`. It is usually used to read the path to the user's home from environment. The old value pointed to a path relative to the (a) current drive letter as reported by `pwd`, not the system drive letter. The new value correctly points to an environment variable that contains the full absolute path to the user's profile. If the code did not use the macro in some unexpected way, the new behavior should work either the same or even better (it would work even when the current directory is on a non-system drive). If the code relied on this value to be relative to the current drive letter, it needs to be changed to use `HOMEPATH` directly.

## Gazebo Common 1.X to 2.X

Expand Down
2 changes: 1 addition & 1 deletion av/include/gz/common/AudioDecoder.hh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace gz
public: int SampleRate();

/// \brief Private data pointer
IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr)
GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion av/include/gz/common/HWEncoder.hh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace gz::common
public: HWEncoderType GetEncoderType() const;

/// \brief Private data pointer
IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr)
GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
};
}

Expand Down
2 changes: 1 addition & 1 deletion av/include/gz/common/HWVideo.hh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace gz::common
_ // For FlagSet to work.
};

IGN_ENUM(HWEncoderTypeParser, HWEncoderType,
GZ_ENUM(HWEncoderTypeParser, HWEncoderType,
HWEncoderType::NONE, HWEncoderType::_,
"NONE",
"NVENC",
Expand Down
2 changes: 1 addition & 1 deletion av/include/gz/common/Video.hh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace gz
private: void Cleanup();

/// \brief Private data pointer
IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr)
GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion av/include/gz/common/VideoEncoder.hh
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ namespace gz
public: void Reset();

/// \brief Private data pointer
IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr)
GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion av/src/AudioDecoder_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ TEST(AudioDecoder, NoCodec)
}

/////////////////////////////////////////////////
TEST(AudioDecoder, IGN_UTILS_TEST_DISABLED_ON_WIN32(CheerFile))
TEST(AudioDecoder, GZ_UTILS_TEST_DISABLED_ON_WIN32(CheerFile))
{
common::AudioDecoder audio;

Expand Down
4 changes: 2 additions & 2 deletions events/include/gz/common/KeyEvent.hh
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ namespace gz
/// \return this
public: KeyEvent& operator=(KeyEvent&& other);

IGN_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
/// \brief Private data pointer
private: std::unique_ptr<KeyEventPrivate> dataPtr;
IGN_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
};
}
}
Expand Down
4 changes: 2 additions & 2 deletions events/include/gz/common/MouseEvent.hh
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ namespace gz
/// \return this
public: MouseEvent &operator=(const MouseEvent &_other);

IGN_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
/// \internal
/// \brief Private data pointer
private: std::unique_ptr<MouseEventPrivate> dataPtr;
IGN_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
};
}
}
Expand Down
4 changes: 2 additions & 2 deletions events/src/Event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ void Event::SetSignaled(bool _sig)
Connection::Connection(Event *_e, int _i)
: event(_e), id(_i)
{
this->creationTime = IGN_SYSTEM_TIME();
this->creationTime = GZ_SYSTEM_TIME();
}

//////////////////////////////////////////////////
Connection::~Connection()
{
auto diffTime = IGN_SYSTEM_TIME() - this->creationTime;
auto diffTime = GZ_SYSTEM_TIME() - this->creationTime;
if ((this->event && !this->event->Signaled()) &&
diffTime < std::chrono::nanoseconds(10000))
{
Expand Down
2 changes: 1 addition & 1 deletion events/src/Event_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ TEST_F(EventTest, DestructionOrder)
evt->Signal();
evt.reset();
// Sleep to avoid warning about deleting a connection right after creation.
IGN_SLEEP_MS(1);
GZ_SLEEP_MS(1);

// Check that this doesn't segfault.
conn.reset();
Expand Down
2 changes: 1 addition & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ target_link_libraries(events_example ignition-common${IGN_COMMON_VER}::events)

add_executable(profiler_example profiler.cc)
target_link_libraries(profiler_example ignition-common${IGN_COMMON_VER}::profiler)
target_compile_definitions(profiler_example PUBLIC "IGN_PROFILER_ENABLE=1")
target_compile_definitions(profiler_example PUBLIC "GZ_PROFILER_ENABLE=1")

add_executable(logging_performance logging_performance.cc)
target_link_libraries(logging_performance ignition-common${IGN_COMMON_VER}::core)
Expand Down
50 changes: 25 additions & 25 deletions examples/profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ std::atomic<bool> running;
void task1()
{
// An example of using scope-based profiling.
IGN_PROFILE("task1");
GZ_PROFILE("task1");
{
IGN_PROFILE("this");
GZ_PROFILE("this");
{
IGN_PROFILE("is");
GZ_PROFILE("is");
{
IGN_PROFILE("a");
GZ_PROFILE("a");
{
IGN_PROFILE("deep");
GZ_PROFILE("deep");
{
IGN_PROFILE("stack");
GZ_PROFILE("stack");
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
}
Expand All @@ -49,54 +49,54 @@ void task1()
void task2()
{
// An example of using scope-based profiling.
IGN_PROFILE("task2");
GZ_PROFILE("task2");
{
IGN_PROFILE("a");
GZ_PROFILE("a");
std::this_thread::sleep_for(std::chrono::milliseconds(2));
}
{
IGN_PROFILE("b");
GZ_PROFILE("b");
std::this_thread::sleep_for(std::chrono::milliseconds(2));
}
{
IGN_PROFILE("c");
GZ_PROFILE("c");
std::this_thread::sleep_for(std::chrono::milliseconds(2));
}
{
IGN_PROFILE("d");
GZ_PROFILE("d");
std::this_thread::sleep_for(std::chrono::milliseconds(2));
}
}

void task3()
{
IGN_PROFILE("task3");
GZ_PROFILE("task3");

// An example of using start/stop profiling.
IGN_PROFILE_BEGIN("a");
GZ_PROFILE_BEGIN("a");
std::this_thread::sleep_for(std::chrono::milliseconds(2));
IGN_PROFILE_END();
GZ_PROFILE_END();

IGN_PROFILE_BEGIN("b");
GZ_PROFILE_BEGIN("b");
std::this_thread::sleep_for(std::chrono::milliseconds(2));
IGN_PROFILE_END();
GZ_PROFILE_END();

IGN_PROFILE_BEGIN("c");
GZ_PROFILE_BEGIN("c");
std::this_thread::sleep_for(std::chrono::milliseconds(2));
IGN_PROFILE_END();
GZ_PROFILE_END();

IGN_PROFILE_BEGIN("d");
GZ_PROFILE_BEGIN("d");
std::this_thread::sleep_for(std::chrono::milliseconds(2));
IGN_PROFILE_END();
GZ_PROFILE_END();
}

void thread(const char *_thread_name)
{
// Sets the name of the thread to appear in the UI
IGN_PROFILE_THREAD_NAME(_thread_name);
GZ_PROFILE_THREAD_NAME(_thread_name);
while (running)
{
IGN_PROFILE("Loop");
GZ_PROFILE("Loop");
// Execute some arbitrary tasks
for (size_t ii = 0; ii < 10; ++ii)
{
Expand All @@ -117,7 +117,7 @@ int main(int argc, char** argv)
{
gz::common::Console::SetVerbosity(4);

IGN_PROFILE_THREAD_NAME("main");
GZ_PROFILE_THREAD_NAME("main");
running = true;

// Connect signal handler
Expand All @@ -134,14 +134,14 @@ int main(int argc, char** argv)
size_t ii = 0;
while(running)
{
IGN_PROFILE("main loop");
GZ_PROFILE("main loop");
std::this_thread::sleep_for(std::chrono::milliseconds(100));

// Throttle to once per second
if (ii++ % 10 == 0)
{
// Example of logging text to the remotery console.
IGN_PROFILE_LOG_TEXT("main loop done");
GZ_PROFILE_LOG_TEXT("main loop done");
}
}

Expand Down
2 changes: 1 addition & 1 deletion geospatial/include/gz/common/geospatial/Dem.hh
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ namespace gz

/// internal
/// \brief Pointer to the private data.
IGN_UTILS_IMPL_PTR(dataPtr)
GZ_UTILS_IMPL_PTR(dataPtr)
};
}
}
Expand Down
8 changes: 4 additions & 4 deletions graphics/include/gz/common/Animation.hh
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ namespace gz
unsigned int &_firstKeyIndex) const;

/// \brief Private data pointer.
IGN_UTILS_IMPL_PTR(dataPtr)
GZ_UTILS_IMPL_PTR(dataPtr)
};

/// \brief A pose animation.
Expand Down Expand Up @@ -142,7 +142,7 @@ namespace gz
protected: void BuildInterpolationSplines();

/// \brief Private data pointer.
IGN_UTILS_IMPL_PTR(dataPtr)
GZ_UTILS_IMPL_PTR(dataPtr)
};

/// \brief A numeric animation.
Expand All @@ -166,7 +166,7 @@ namespace gz
public: void InterpolatedKeyFrame(NumericKeyFrame &_kf) const;

/// \brief Private data pointer.
IGN_UTILS_IMPL_PTR(dataPtr)
GZ_UTILS_IMPL_PTR(dataPtr)
};

/// \brief Information about a trajectory for an animation (e.g., Actor)
Expand Down Expand Up @@ -246,7 +246,7 @@ namespace gz
_waypoints, double _tension = 0.0);

/// \brief Private data pointer.
IGN_UTILS_IMPL_PTR(dataPtr)
GZ_UTILS_IMPL_PTR(dataPtr)
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion graphics/include/gz/common/ColladaExporter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ namespace gz
const std::vector<ColladaLight> &_lights);

/// \brief Pointer to private data.
IGN_UTILS_IMPL_PTR(dataPtr)
GZ_UTILS_IMPL_PTR(dataPtr)
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion graphics/include/gz/common/ColladaLoader.hh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace gz

/// \internal
/// \brief Pointer to private data.
IGN_UTILS_IMPL_PTR(dataPtr)
GZ_UTILS_IMPL_PTR(dataPtr)
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion graphics/include/gz/common/Image.hh
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ namespace gz
}

/// \brief Private data pointer
IGN_UTILS_IMPL_PTR(dataPtr)
GZ_UTILS_IMPL_PTR(dataPtr)
};
}
}
Expand Down
6 changes: 3 additions & 3 deletions graphics/include/gz/common/KeyFrame.hh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace gz
public: double Time() const;

/// \brief Private data pointer.
IGN_UTILS_IMPL_PTR(dataPtr)
GZ_UTILS_IMPL_PTR(dataPtr)
};

/// \brief A keyframe for a PoseAnimation
Expand Down Expand Up @@ -75,7 +75,7 @@ namespace gz
public: const math::Quaterniond &Rotation() const;

/// \brief Private data pointer.
IGN_UTILS_IMPL_PTR(dataPtr)
GZ_UTILS_IMPL_PTR(dataPtr)
};

/// \brief A keyframe for a NumericAnimation
Expand All @@ -97,7 +97,7 @@ namespace gz
public: const double &Value() const;

/// \brief Private data pointer.
IGN_UTILS_IMPL_PTR(dataPtr)
GZ_UTILS_IMPL_PTR(dataPtr)
};
}
}
Expand Down
2 changes: 1 addition & 1 deletion graphics/include/gz/common/Material.hh
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ namespace gz
}

/// \brief Private data pointer.
IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr)
GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
};
}
}
Expand Down
Loading

0 comments on commit 6d519a1

Please sign in to comment.