Skip to content

Commit

Permalink
Greedy macro migration
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <methylDragon@gmail.com>
  • Loading branch information
methylDragon committed May 20, 2022
1 parent 7b2dbbe commit 5d6a873
Show file tree
Hide file tree
Showing 15 changed files with 82 additions and 82 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ign_find_package(DL

#--------------------------------------
# Find ignition-tools
find_program(IGN_TOOLS_PROGRAM ign)
find_program(GZ_TOOLS_PROGRAM ign)


#--------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions core/include/gz/plugin/detail/PluginPtr.hh
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ namespace gz
}

//////////////////////////////////////////////////
#define DETAIL_IGN_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR(op)\
#define DETAIL_GZ_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR(op)\
template <typename PluginType>\
bool TemplatePluginPtr<PluginType>::operator op (\
const TemplatePluginPtr &_other) const\
Expand All @@ -131,12 +131,12 @@ namespace gz
_other.dataPtr->PrivateGetInstancePtr() );\
}

DETAIL_IGN_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( == ) // NOLINT
DETAIL_IGN_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( < ) // NOLINT
DETAIL_IGN_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( > ) // NOLINT
DETAIL_IGN_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( != ) // NOLINT
DETAIL_IGN_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( <= ) // NOLINT
DETAIL_IGN_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( >= ) // NOLINT
DETAIL_GZ_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( == ) // NOLINT
DETAIL_GZ_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( < ) // NOLINT
DETAIL_GZ_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( > ) // NOLINT
DETAIL_GZ_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( != ) // NOLINT
DETAIL_GZ_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( <= ) // NOLINT
DETAIL_GZ_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( >= ) // NOLINT

//////////////////////////////////////////////////
template <typename PluginType>
Expand Down
14 changes: 7 additions & 7 deletions core/include/gz/plugin/detail/SpecializedPlugin.hh
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ namespace gz
/// specializes for the requested Interface, if such a type is availabe
/// within its inheritance structure. Otherwise, we cast to the generic
/// Plugin type.
#define DETAIL_IGN_PLUGIN_COMPOSEPLUGIN_DISPATCH( \
#define DETAIL_GZ_PLUGIN_COMPOSEPLUGIN_DISPATCH( \
ReturnType, Function, Suffix, CastTo, Args) \
public: \
template <class T> \
Expand All @@ -233,20 +233,20 @@ namespace gz
}


DETAIL_IGN_PLUGIN_COMPOSEPLUGIN_DISPATCH(
DETAIL_GZ_PLUGIN_COMPOSEPLUGIN_DISPATCH(
T*, QueryInterface, (), Specializer, ())

DETAIL_IGN_PLUGIN_COMPOSEPLUGIN_DISPATCH(
DETAIL_GZ_PLUGIN_COMPOSEPLUGIN_DISPATCH(
const T*, QueryInterface, () const, const Specializer, ())

DETAIL_IGN_PLUGIN_COMPOSEPLUGIN_DISPATCH(
DETAIL_GZ_PLUGIN_COMPOSEPLUGIN_DISPATCH(
std::shared_ptr<T>, QueryInterfaceSharedPtr, (), Specializer, ())

DETAIL_IGN_PLUGIN_COMPOSEPLUGIN_DISPATCH(
DETAIL_GZ_PLUGIN_COMPOSEPLUGIN_DISPATCH(
std::shared_ptr<const T>, QueryInterfaceSharedPtr,
() const, const Specializer, ())

DETAIL_IGN_PLUGIN_COMPOSEPLUGIN_DISPATCH(
DETAIL_GZ_PLUGIN_COMPOSEPLUGIN_DISPATCH(
bool, HasInterface, () const, const Specializer, ())

// Declare friendship
Expand All @@ -260,7 +260,7 @@ namespace gz
/// \brief ComposePlugin provides a way for a multi-specialized Plugin
/// type to find its specializations within itself each time an
/// interface-querying function is called. The macro
/// DETAIL_IGN_PLUGIN_COMPOSEPLUGIN_DISPATCH accomplishes this for each
/// DETAIL_GZ_PLUGIN_COMPOSEPLUGIN_DISPATCH accomplishes this for each
/// of the different functions by doing a compile-time check on whether
/// Base2 contains the specialization, and then picks Base1 if it does
/// not.
Expand Down
14 changes: 7 additions & 7 deletions loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ign_get_libsources_and_unittests(sources tests)

# Disable ign_TEST if ignition-tools is not found
if (MSVC OR NOT IGN_TOOLS_PROGRAM)
if (MSVC OR NOT GZ_TOOLS_PROGRAM)
list(REMOVE_ITEM tests src/ign_TEST.cc)
endif()

Expand All @@ -25,25 +25,25 @@ ign_build_tests(
foreach(test ${test_targets})

target_compile_definitions(${test} PRIVATE
"IGN_PLUGIN_LIB=\"$<TARGET_FILE:${PROJECT_LIBRARY_TARGET_NAME}>\"")
"GZ_PLUGIN_LIB=\"$<TARGET_FILE:${PROJECT_LIBRARY_TARGET_NAME}>\"")

target_compile_definitions(${test} PRIVATE
"IGN_PLUGIN_SOURCE_DIR=\"${PROJECT_SOURCE_DIR}\"")
"GZ_PLUGIN_SOURCE_DIR=\"${PROJECT_SOURCE_DIR}\"")

target_compile_definitions(${test} PRIVATE
"IGNDummyPlugins_LIB=\"$<TARGET_FILE:IGNDummyPlugins>\"")
"GzDummyPlugins_LIB=\"$<TARGET_FILE:GzDummyPlugins>\"")

target_compile_definitions(${test} PRIVATE
"IGN_PATH=\"${IGN_TOOLS_PROGRAM}\"")
"GZ_PATH=\"${GZ_TOOLS_PROGRAM}\"")

target_compile_definitions(${test} PRIVATE
"IGN_VERSION_FULL=\"${PROJECT_VERSION_FULL}\"")
"GZ_VERSION_FULL=\"${PROJECT_VERSION_FULL}\"")

endforeach()

if(TARGET UNIT_ign_TEST)
set(_env_vars)
list(APPEND _env_vars "IGN_CONFIG_PATH=${CMAKE_BINARY_DIR}/test/conf/$<CONFIG>")
list(APPEND _env_vars "GZ_CONFIG_PATH=${CMAKE_BINARY_DIR}/test/conf/$<CONFIG>")

set_tests_properties(UNIT_ign_TEST PROPERTIES
ENVIRONMENT "${_env_vars}")
Expand Down
14 changes: 7 additions & 7 deletions loader/src/Loader_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ TEST(Loader, LoadNonexistantLibrary)
TEST(Loader, LoadNonLibrary)
{
gz::plugin::Loader loader;
EXPECT_TRUE(loader.LoadLib(std::string(IGN_PLUGIN_SOURCE_DIR)
EXPECT_TRUE(loader.LoadLib(std::string(GZ_PLUGIN_SOURCE_DIR)
+ "/core/src/Plugin.cc").empty());
}

/////////////////////////////////////////////////
TEST(Loader, LoadNonPluginLibrary)
{
gz::plugin::Loader loader;
EXPECT_TRUE(loader.LoadLib(IGN_PLUGIN_LIB).empty());
EXPECT_TRUE(loader.LoadLib(GZ_PLUGIN_LIB).empty());
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -84,11 +84,11 @@ TEST(Loader, DoubleLoad)
// when a user asks for a library to be loaded twice.
gz::plugin::Loader loader;

loader.LoadLib(IGNDummyPlugins_LIB);
loader.LoadLib(GzDummyPlugins_LIB);
const std::size_t interfaceCount = loader.InterfacesImplemented().size();
EXPECT_LT(0u, interfaceCount);

loader.LoadLib(IGNDummyPlugins_LIB);
loader.LoadLib(GzDummyPlugins_LIB);
EXPECT_EQ(interfaceCount, loader.InterfacesImplemented().size());
}

Expand All @@ -101,15 +101,15 @@ TEST(Loader, ForgetUnloadedLibrary)
// 1. A library is not loaded, and
// 2. We tell a loader to forget the library
gz::plugin::Loader loader;
EXPECT_FALSE(loader.ForgetLibrary(IGNDummyPlugins_LIB));
EXPECT_FALSE(loader.ForgetLibrary(GzDummyPlugins_LIB));

// This next test triggers lines for the case that:
// 1. A library is loaded by some loader in the application, and
// 2. We tell a *different* loader to forget the library
gz::plugin::Loader hasTheLibrary;
EXPECT_LT(0u, hasTheLibrary.LoadLib(IGNDummyPlugins_LIB).size());
EXPECT_LT(0u, hasTheLibrary.LoadLib(GzDummyPlugins_LIB).size());

EXPECT_FALSE(loader.ForgetLibrary(IGNDummyPlugins_LIB));
EXPECT_FALSE(loader.ForgetLibrary(GzDummyPlugins_LIB));
}

/////////////////////////////////////////////////
Expand Down
22 changes: 11 additions & 11 deletions loader/src/ign_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
using namespace gz;

static const std::string g_ignVersion("--force-version " + // NOLINT(*)
std::string(IGN_VERSION_FULL));
std::string(GZ_VERSION_FULL));

/////////////////////////////////////////////////
std::string custom_exec_str(std::string _cmd)
Expand Down Expand Up @@ -58,7 +58,7 @@ std::string custom_exec_str(std::string _cmd)
TEST(ignTest, IgnPluginHelp)
{
// Path to ign executable
std::string ign = std::string(IGN_PATH);
std::string ign = std::string(GZ_PATH);
std::string output = custom_exec_str(ign + " plugin --help");
EXPECT_NE(std::string::npos,
output.find("-i,--info Get info about a plugin."))
Expand All @@ -81,7 +81,7 @@ TEST(ignTest, IgnPluginHelp)
TEST(ignTest, PluginInfoNonexistentLibrary)
{
// Path to ign executable
std::string ign = std::string(IGN_PATH);
std::string ign = std::string(GZ_PATH);

std::string output = custom_exec_str(ign + " plugin --info --plugin " +
"/path/to/libDoesNotExist.so");
Expand All @@ -99,10 +99,10 @@ TEST(ignTest, PluginInfoNonexistentLibrary)
TEST(ignTest, PluginInfoNonLibrary)
{
// Path to ign executable
std::string ign = std::string(IGN_PATH);
std::string ign = std::string(GZ_PATH);

std::string output = custom_exec_str(ign + " plugin --info --plugin " +
std::string(IGN_PLUGIN_SOURCE_DIR) + "/core/src/Plugin.cc");
std::string(GZ_PLUGIN_SOURCE_DIR) + "/core/src/Plugin.cc");

EXPECT_NE(std::string::npos, output.find("Error while loading the library"))
<< output;
Expand All @@ -117,10 +117,10 @@ TEST(ignTest, PluginInfoNonLibrary)
TEST(ignTest, PluginInfoNonPluginLibrary)
{
// Path to ign executable
std::string ign = std::string(IGN_PATH);
std::string ign = std::string(GZ_PATH);

std::string output = custom_exec_str(ign + " plugin --info --plugin " +
IGN_PLUGIN_LIB);
GZ_PLUGIN_LIB);

EXPECT_NE(std::string::npos, output.find("does not export any plugins. The "
"symbol [IgnitionPluginHook] is missing, or it is not externally visible."))
Expand All @@ -136,10 +136,10 @@ TEST(ignTest, PluginInfoNonPluginLibrary)
TEST(ignTest, PluginInfoDummyPlugins)
{
// Path to ign executable
std::string ign = std::string(IGN_PATH);
std::string ign = std::string(GZ_PATH);

std::string output = custom_exec_str(ign + " plugin --info --plugin " +
IGNDummyPlugins_LIB);
GzDummyPlugins_LIB);

EXPECT_NE(std::string::npos, output.find("Found 3 plugins in library file"))
<< output;
Expand Down Expand Up @@ -175,10 +175,10 @@ TEST(ignTest, PluginInfoDummyPlugins)
TEST(ignTest, PluginInfoVerboseDummyPlugins)
{
// Path to ign executable
std::string ign = std::string(IGN_PATH);
std::string ign = std::string(GZ_PATH);

std::string output = custom_exec_str(ign + " plugin --info --plugin " +
IGNDummyPlugins_LIB + " --verbose");
GzDummyPlugins_LIB + " --verbose");

EXPECT_NE(std::string::npos, output.find("Known Interfaces: 7"))
<< output;
Expand Down
8 changes: 4 additions & 4 deletions register/include/gz/plugin/Register.hh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
/// the gz/plugin/RegisterMore.hh header in all of the rest of the
/// translation units.
#define IGNITION_ADD_PLUGIN(PluginClass, ...) \
DETAIL_IGNITION_ADD_PLUGIN(PluginClass, __VA_ARGS__)
DETAIL_GZ_ADD_PLUGIN(PluginClass, __VA_ARGS__)

/// \brief Add an alias for one of your plugins.
///
Expand All @@ -72,7 +72,7 @@
/// of another plugin, then the Loader will always prefer to instantiate the
/// plugin whose symbol name matches that string.
#define IGNITION_ADD_PLUGIN_ALIAS(PluginClass, ...) \
DETAIL_IGNITION_ADD_PLUGIN_ALIAS(PluginClass, __VA_ARGS__)
DETAIL_GZ_ADD_PLUGIN_ALIAS(PluginClass, __VA_ARGS__)


/// \brief Add a plugin factory.
Expand Down Expand Up @@ -117,7 +117,7 @@
/// IGNITION_ADD_FACTORY(MyType, MyFactory);
/// \endcode
#define IGNITION_ADD_FACTORY(ProductType, FactoryType) \
DETAIL_IGNITION_ADD_FACTORY(ProductType, FactoryType)
DETAIL_GZ_ADD_FACTORY(ProductType, FactoryType)

/// \brief Add an alias for a factory.
///
Expand All @@ -134,7 +134,7 @@
/// IGNITION_ADD_FACTORY(), but there is nothing wrong with calling both (except
/// it might imperceptibly increase your compile time).
#define IGNITION_ADD_FACTORY_ALIAS(ProductType, FactoryType, ...) \
DETAIL_IGNITION_ADD_FACTORY_ALIAS(ProductType, FactoryType, __VA_ARGS__)
DETAIL_GZ_ADD_FACTORY_ALIAS(ProductType, FactoryType, __VA_ARGS__)


#endif
Loading

0 comments on commit 5d6a873

Please sign in to comment.