From a448272ec8153266b64d972107fc0e0ed9144c80 Mon Sep 17 00:00:00 2001 From: Jeremie Deray Date: Mon, 6 Oct 2025 10:01:45 +0200 Subject: [PATCH 1/2] Add ros2plugin (#165) Signed-off-by: artivis Signed-off-by: Alejandro Hernandez Cordero Co-authored-by: Alejandro Hernandez Cordero (cherry picked from commit 1a596d6be3740308810f11aed61914e23f3ddbd8) # Conflicts: # pluginlib/include/pluginlib/class_desc.hpp # pluginlib/include/pluginlib/class_list_macros.hpp # pluginlib/include/pluginlib/impl/split.hpp # pluginlib/src/list_plugins.cpp # pluginlib/test/include/test_base.hpp # pluginlib/test/include/test_plugins.hpp # pluginlib/test/include/visibility_control.hpp # pluginlib/test/test_plugins.cpp --- pluginlib/include/pluginlib/class_desc.hpp | 30 +++++++ .../include/pluginlib/class_list_macros.hpp | 30 +++++++ pluginlib/include/pluginlib/impl/split.hpp | 30 +++++++ pluginlib/src/list_plugins.cpp | 49 +++++++++++ pluginlib/test/include/test_base.hpp | 47 +++++++++++ pluginlib/test/include/test_plugins.hpp | 83 +++++++++++++++++++ pluginlib/test/include/visibility_control.hpp | 37 +++++++++ pluginlib/test/test_plugins.cpp | 34 ++++++++ ros2plugin/package.xml | 26 ++++++ ros2plugin/resource/ros2plugin | 0 ros2plugin/ros2plugin/__init__.py | 0 ros2plugin/ros2plugin/api/__init__.py | 81 ++++++++++++++++++ ros2plugin/ros2plugin/command/__init__.py | 0 ros2plugin/ros2plugin/command/plugin.py | 37 +++++++++ ros2plugin/ros2plugin/verb/__init__.py | 44 ++++++++++ ros2plugin/ros2plugin/verb/list.py | 82 ++++++++++++++++++ ros2plugin/setup.py | 49 +++++++++++ ros2plugin/test/test_copyright.py | 23 +++++ ros2plugin/test/test_flake8.py | 23 +++++ ros2plugin/test/test_pep257.py | 23 +++++ ros2plugin/test/test_xmllint.py | 23 +++++ 21 files changed, 751 insertions(+) create mode 100644 pluginlib/src/list_plugins.cpp create mode 100644 pluginlib/test/include/test_base.hpp create mode 100644 pluginlib/test/include/test_plugins.hpp create mode 100644 ros2plugin/package.xml create mode 100644 ros2plugin/resource/ros2plugin create mode 100644 ros2plugin/ros2plugin/__init__.py create mode 100644 ros2plugin/ros2plugin/api/__init__.py create mode 100644 ros2plugin/ros2plugin/command/__init__.py create mode 100644 ros2plugin/ros2plugin/command/plugin.py create mode 100644 ros2plugin/ros2plugin/verb/__init__.py create mode 100644 ros2plugin/ros2plugin/verb/list.py create mode 100644 ros2plugin/setup.py create mode 100644 ros2plugin/test/test_copyright.py create mode 100644 ros2plugin/test/test_flake8.py create mode 100644 ros2plugin/test/test_pep257.py create mode 100644 ros2plugin/test/test_xmllint.py diff --git a/pluginlib/include/pluginlib/class_desc.hpp b/pluginlib/include/pluginlib/class_desc.hpp index 8a1ea122..4dfecc32 100644 --- a/pluginlib/include/pluginlib/class_desc.hpp +++ b/pluginlib/include/pluginlib/class_desc.hpp @@ -1,3 +1,4 @@ +<<<<<<< HEAD /********************************************************************* * * Software License Agreement (BSD License) @@ -33,6 +34,35 @@ * POSSIBILITY OF SUCH DAMAGE. * *********************************************************************/ +======= +// Copyright 2008, Willow Garage, Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// * Neither the name of the Willow Garage nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +>>>>>>> 1a596d6 (Add ros2plugin (#165)) #ifndef PLUGINLIB__CLASS_DESC_HPP_ #define PLUGINLIB__CLASS_DESC_HPP_ diff --git a/pluginlib/include/pluginlib/class_list_macros.hpp b/pluginlib/include/pluginlib/class_list_macros.hpp index 9691052c..02ceea89 100644 --- a/pluginlib/include/pluginlib/class_list_macros.hpp +++ b/pluginlib/include/pluginlib/class_list_macros.hpp @@ -1,3 +1,4 @@ +<<<<<<< HEAD /********************************************************************* * * Software License Agreement (BSD License) @@ -33,6 +34,35 @@ * POSSIBILITY OF SUCH DAMAGE. * *********************************************************************/ +======= +// Copyright 2008, Willow Garage, Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// * Neither the name of the Willow Garage nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +>>>>>>> 1a596d6 (Add ros2plugin (#165)) #ifndef PLUGINLIB__CLASS_LIST_MACROS_HPP_ #define PLUGINLIB__CLASS_LIST_MACROS_HPP_ diff --git a/pluginlib/include/pluginlib/impl/split.hpp b/pluginlib/include/pluginlib/impl/split.hpp index b83232db..0ac561b5 100644 --- a/pluginlib/include/pluginlib/impl/split.hpp +++ b/pluginlib/include/pluginlib/impl/split.hpp @@ -1,3 +1,4 @@ +<<<<<<< HEAD /* * Copyright (c) 2017, Open Source Robotics Foundation, Inc. * All rights reserved. @@ -26,6 +27,35 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +======= +// Copyright (c) 2017, Open Source Robotics Foundation, Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// * Neither the name of the Willow Garage nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. +>>>>>>> 1a596d6 (Add ros2plugin (#165)) #ifndef PLUGINLIB__IMPL__SPLIT_HPP_ #define PLUGINLIB__IMPL__SPLIT_HPP_ diff --git a/pluginlib/src/list_plugins.cpp b/pluginlib/src/list_plugins.cpp new file mode 100644 index 00000000..684a4050 --- /dev/null +++ b/pluginlib/src/list_plugins.cpp @@ -0,0 +1,49 @@ +// Copyright (c) 2025, Metro Robots +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// * Neither the name of the Willow Garage nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +/* Author: David V. Lu!! */ + +#include +#include + +int main(int argc, char ** argv) +{ + if (argc != 3) { + std::cerr << "Requires two arguments!" << std::endl; + std::cerr << "Usage: " << argv[0]; + std::cerr << " [package] [base_class]" << std::endl; + return -1; + } + + // Note: You cannot use void if you want to use the templated createSharedInstance methods + pluginlib::ClassLoader cl(argv[1], argv[2]); + for (const auto & declared : cl.getDeclaredClasses()) { + std::cout << declared << std::endl; + } + return 0; +} diff --git a/pluginlib/test/include/test_base.hpp b/pluginlib/test/include/test_base.hpp new file mode 100644 index 00000000..5b5978ac --- /dev/null +++ b/pluginlib/test/include/test_base.hpp @@ -0,0 +1,47 @@ +// Copyright (c) 2012, Willow Garage, Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// * Neither the name of the Willow Garage nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#ifndef TEST_BASE_HPP_ +#define TEST_BASE_HPP_ + +#include + +namespace test_base +{ +class TEST_PLUGINLIB_FIXTURE_PUBLIC Fubar +{ +public: + virtual void initialize(double foo) = 0; + virtual double result() = 0; + virtual ~Fubar() {} + +protected: + Fubar() {} +}; +} // namespace test_base +#endif // TEST_BASE_HPP_ diff --git a/pluginlib/test/include/test_plugins.hpp b/pluginlib/test/include/test_plugins.hpp new file mode 100644 index 00000000..5ad26240 --- /dev/null +++ b/pluginlib/test/include/test_plugins.hpp @@ -0,0 +1,83 @@ +// Copyright (c) 2012, Willow Garage, Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// * Neither the name of the Willow Garage nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#ifndef TEST_PLUGINS_HPP_ +#define TEST_PLUGINS_HPP_ + +#include + +#include +#include + +namespace test_plugins +{ +class TEST_PLUGINLIB_FIXTURE_PUBLIC Bar : public test_base::Fubar +{ +public: + Bar() {} + + void initialize(double foo) + { + foo_ = foo; + } + + double result() + { + return 0.5 * foo_ * getBar(); + } + + double getBar() + { + return sqrt((foo_ * foo_) - ((foo_ / 2) * (foo_ / 2))); + } + +private: + double foo_; +}; + +class TEST_PLUGINLIB_FIXTURE_PUBLIC Foo : public test_base::Fubar +{ +public: + Foo() {} + + void initialize(double foo) + { + foo_ = foo; + } + + double result() + { + return foo_ * foo_; + } + +private: + double foo_; +}; +} // namespace test_plugins + +#endif // TEST_PLUGINS_HPP_ diff --git a/pluginlib/test/include/visibility_control.hpp b/pluginlib/test/include/visibility_control.hpp index d14c205d..9dee3589 100644 --- a/pluginlib/test/include/visibility_control.hpp +++ b/pluginlib/test/include/visibility_control.hpp @@ -1,3 +1,4 @@ +<<<<<<< HEAD /* * Copyright (c) 2018, Open Source Robotics Foundation, Inc. * All rights reserved. @@ -29,6 +30,38 @@ #ifndef TEST_PLUGINLIB_FIXTURE__VISIBILITY_CONTROL_HPP_ #define TEST_PLUGINLIB_FIXTURE__VISIBILITY_CONTROL_HPP_ +======= +// Copyright (c) 2018, Open Source Robotics Foundation, Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// * Neither the name of the Willow Garage nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#ifndef VISIBILITY_CONTROL_HPP_ +#define VISIBILITY_CONTROL_HPP_ +>>>>>>> 1a596d6 (Add ros2plugin (#165)) // This logic was borrowed (then namespaced) from the examples on the gcc wiki: // https://gcc.gnu.org/wiki/Visibility @@ -61,4 +94,8 @@ #define TEST_PLUGINLIB_FIXTURE_PUBLIC_TYPE #endif +<<<<<<< HEAD #endif // TEST_PLUGINLIB_FIXTURE__VISIBILITY_CONTROL_HPP_ +======= +#endif // VISIBILITY_CONTROL_HPP_ +>>>>>>> 1a596d6 (Add ros2plugin (#165)) diff --git a/pluginlib/test/test_plugins.cpp b/pluginlib/test/test_plugins.cpp index fcf59001..02d1a0c2 100644 --- a/pluginlib/test/test_plugins.cpp +++ b/pluginlib/test/test_plugins.cpp @@ -1,3 +1,4 @@ +<<<<<<< HEAD /* * Copyright (c) 2012, Willow Garage, Inc. * All rights reserved. @@ -30,6 +31,39 @@ #include #include #include "test_plugins.h" // NOLINT +======= +// Copyright (c) 2012, Willow Garage, Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// * Neither the name of the Willow Garage nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include "test_plugins.hpp" +>>>>>>> 1a596d6 (Add ros2plugin (#165)) PLUGINLIB_EXPORT_CLASS(test_plugins::Foo, test_base::Fubar) PLUGINLIB_EXPORT_CLASS(test_plugins::Bar, test_base::Fubar) diff --git a/ros2plugin/package.xml b/ros2plugin/package.xml new file mode 100644 index 00000000..14c053bf --- /dev/null +++ b/ros2plugin/package.xml @@ -0,0 +1,26 @@ + + + + ros2plugin + 5.7.0 + + The plugin command for ROS 2 command line tools. + + Jeremie Deray + Apache License 2.0 + + ament_index_python + rclpy + ros2cli + ros2pkg + + ament_copyright + ament_flake8 + ament_pep257 + ament_xmllint + python3-pytest + + + ament_python + + diff --git a/ros2plugin/resource/ros2plugin b/ros2plugin/resource/ros2plugin new file mode 100644 index 00000000..e69de29b diff --git a/ros2plugin/ros2plugin/__init__.py b/ros2plugin/ros2plugin/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/ros2plugin/ros2plugin/api/__init__.py b/ros2plugin/ros2plugin/api/__init__.py new file mode 100644 index 00000000..eb118909 --- /dev/null +++ b/ros2plugin/ros2plugin/api/__init__.py @@ -0,0 +1,81 @@ +# Copyright 2025 Canonical Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_index_python.resources import get_resource +from ament_index_python.resources import get_resource_types +from ament_index_python.resources import get_resources +from ament_index_python.resources import has_resource + +PLUGIN_RESOURCE_TYPE = '__pluginlib__plugin' + + +def is_plugin_resource_type(resource_type): + """ + Check if resource_type has the plugin extension. + + :param str resource_type: the resource type name to be evaluated. + + :return: a boolean, True if resource_type has the plugin extension. + """ + assert resource_type, 'The resource type must not be empty' + return PLUGIN_RESOURCE_TYPE in resource_type + + +def get_registered_plugin_resource_list(): + """ + Get all plugin resources registered in the ament index. + + :return: a filtered list containing the plugin ressouce types. + """ + return filter(is_plugin_resource_type, get_resource_types()) + + +def get_package_names_with_plugin_resource_types(): + """ + Get the names of all packages that register a plugin resource in the ament index. + + :return: a list of packages exporting plugins. + """ + packages = [] + for plugin in get_registered_plugin_resource_list(): + packages += list(get_resources(plugin).keys()) + return packages + + +def get_package_plugin_resource(*, package_name=None): + """ + Get all plugin resources registered in the ament index for the given package. + + :param package_name: whose component types are to be retrieved. + :return: a list of plugin resources relative path. + """ + plugin_resources = get_registered_plugin_resource_list() + package_plugins = [] + for plugin_resource in plugin_resources: + if has_resource(plugin_resource, package_name): + component_registry, _ = get_resource(plugin_resource, package_name) + package_plugins += [line.split(';')[0] for line in component_registry.splitlines()] + return package_plugins + + +def get_registered_plugin_resources(): + """ + Get all plugin resources registered in the ament index. + + :return: a list of (package name, plugin type names) tuples. + """ + return [ + (package_name, get_package_plugin_resource(package_name=package_name)) + for package_name in get_package_names_with_plugin_resource_types() + ] diff --git a/ros2plugin/ros2plugin/command/__init__.py b/ros2plugin/ros2plugin/command/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/ros2plugin/ros2plugin/command/plugin.py b/ros2plugin/ros2plugin/command/plugin.py new file mode 100644 index 00000000..f097e5d4 --- /dev/null +++ b/ros2plugin/ros2plugin/command/plugin.py @@ -0,0 +1,37 @@ +# Copyright 2025 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ros2cli.command import add_subparsers_on_demand +from ros2cli.command import CommandExtension + + +class PluginCommand(CommandExtension): + """Various plugin related sub-commands.""" + + def add_arguments(self, parser, cli_name): + self._subparser = parser + # get verb extensions and let them add their arguments + add_subparsers_on_demand( + parser, cli_name, '_verb', 'ros2plugin.verb', required=False) + + def main(self, *, parser, args): + if not hasattr(args, '_verb'): + # in case no verb was passed + self._subparser.print_help() + return 0 + + extension = getattr(args, '_verb') + + # call the verb's main method + return extension.main(args=args) diff --git a/ros2plugin/ros2plugin/verb/__init__.py b/ros2plugin/ros2plugin/verb/__init__.py new file mode 100644 index 00000000..532e3a9f --- /dev/null +++ b/ros2plugin/ros2plugin/verb/__init__.py @@ -0,0 +1,44 @@ +# Copyright 2019 Canonical Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ros2cli.plugin_system import PLUGIN_SYSTEM_VERSION +from ros2cli.plugin_system import satisfies_version + + +class VerbExtension: + """ + The extension point for 'plugin' verb extensions. + + The following properties must be defined: + * `NAME` (will be set to the entry point name) + + The following methods must be defined: + * `main` + + The following methods can be defined: + * `add_arguments` + """ + + NAME = None + EXTENSION_POINT_VERSION = '0.1' + + def __init__(self): + super(VerbExtension, self).__init__() + satisfies_version(PLUGIN_SYSTEM_VERSION, '^0.1') + + def add_arguments(self, parser, cli_name): + pass + + def main(self, *, args): + raise NotImplementedError() diff --git a/ros2plugin/ros2plugin/verb/list.py b/ros2plugin/ros2plugin/verb/list.py new file mode 100644 index 00000000..fd7a6c90 --- /dev/null +++ b/ros2plugin/ros2plugin/verb/list.py @@ -0,0 +1,82 @@ +# Copyright 2025 Canonical Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from collections import namedtuple + +import os +import xml.etree.ElementTree as ET + +from ament_index_python import get_package_prefix +from ament_index_python import PackageNotFoundError +from ros2cli.node.strategy import add_arguments + +from ros2plugin.api import get_registered_plugin_resources +from ros2plugin.verb import VerbExtension + + +PluginInfo = namedtuple('Plugin', ('name', 'type', 'base')) + + +class ListVerb(VerbExtension): + """Output a list of plugins.""" + + def add_arguments(self, parser, cli_name): + add_arguments(parser) + parser.add_argument( + '--packages', action='store_true', + help='List the packages that register plugins') + parser.add_argument( + '--package', type=str, + help='Name of the package to list plugins from') + + def main(self, *, args): + plugin_resources = get_registered_plugin_resources() + + if args.package: + plugin_resources + + if args.packages: + for package_name, package_plugin_resources in sorted(plugin_resources): + print(package_name + ':') + if any(package_plugin_resources): + print(*['\t' + r for r in package_plugin_resources], sep='\n') + return + + for package_name, package_plugin_resources in sorted(plugin_resources): + plugins = [] + print(package_name + ':') + for package_plugin_resource in package_plugin_resources: + try: + package_prefix = get_package_prefix(package_name) + except PackageNotFoundError: + print('Package ' + package_name + ' not found.') + + plugin_xml = os.path.join(package_prefix, package_plugin_resource) + if not os.path.isfile(plugin_xml): + print('XML manifest ' + os.path.basename(plugin_xml) + ' not found.') + + tree = ET.parse(plugin_xml) + + for e in tree.iter(): + if e.tag == 'class': + try: + plugin_name = e.attrib['name'] + except KeyError: + plugin_name = e.attrib['type'] + plugins.append(PluginInfo( + plugin_name, e.attrib['type'], e.attrib['base_class_type']) + ) + + if any(plugins): + print(*['\t' + str(p) for p in plugins], sep='\n') diff --git a/ros2plugin/setup.py b/ros2plugin/setup.py new file mode 100644 index 00000000..e1e6e1aa --- /dev/null +++ b/ros2plugin/setup.py @@ -0,0 +1,49 @@ +from setuptools import find_packages +from setuptools import setup + +package_name = 'ros2plugin' + +setup( + name=package_name, + version='5.7.0', + packages=find_packages(exclude=['test']), + data_files=[ + ('share/' + package_name, ['package.xml']), + ('share/ament_index/resource_index/packages', + ['resource/' + package_name]), + ], + install_requires=['ros2cli'], + zip_safe=True, + author='Jeremie Deray', + author_email='jeremie.deray@canonical.com', + maintainer='Jeremie Deray', + maintainer_email='jeremie.deray@canonical.com', + url='https://github.com/ros2/ros2cli/tree/master/ros2plugin', + download_url='https://github.com/ros2/ros2cli/releases', + keywords=[], + classifiers=[ + 'Environment :: Console', + 'Intended Audience :: Developers', + 'Programming Language :: Python', + ], + description='The plugin command for ROS 2 command line tools.', + long_description="""\ +The package provides the plugin command for the ROS 2 command line tools.""", + license='Apache License, Version 2.0', + extras_require={ + 'test': [ + 'pytest', + ], + }, + entry_points={ + 'ros2cli.command': [ + 'plugin = ros2plugin.command.plugin:PluginCommand', + ], + 'ros2cli.extension_point': [ + 'ros2plugin.verb = ros2plugin.verb:VerbExtension', + ], + 'ros2plugin.verb': [ + 'list = ros2plugin.verb.list:ListVerb', + ], + } +) diff --git a/ros2plugin/test/test_copyright.py b/ros2plugin/test/test_copyright.py new file mode 100644 index 00000000..cf0fae31 --- /dev/null +++ b/ros2plugin/test/test_copyright.py @@ -0,0 +1,23 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_copyright.main import main +import pytest + + +@pytest.mark.copyright +@pytest.mark.linter +def test_copyright(): + rc = main(argv=['.', 'test']) + assert rc == 0, 'Found errors' diff --git a/ros2plugin/test/test_flake8.py b/ros2plugin/test/test_flake8.py new file mode 100644 index 00000000..eff82996 --- /dev/null +++ b/ros2plugin/test/test_flake8.py @@ -0,0 +1,23 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_flake8.main import main +import pytest + + +@pytest.mark.flake8 +@pytest.mark.linter +def test_flake8(): + rc = main(argv=[]) + assert rc == 0, 'Found errors' diff --git a/ros2plugin/test/test_pep257.py b/ros2plugin/test/test_pep257.py new file mode 100644 index 00000000..0e38a6c6 --- /dev/null +++ b/ros2plugin/test/test_pep257.py @@ -0,0 +1,23 @@ +# Copyright 2017 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_pep257.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.pep257 +def test_pep257(): + rc = main(argv=[]) + assert rc == 0, 'Found code style errors / warnings' diff --git a/ros2plugin/test/test_xmllint.py b/ros2plugin/test/test_xmllint.py new file mode 100644 index 00000000..f46285e7 --- /dev/null +++ b/ros2plugin/test/test_xmllint.py @@ -0,0 +1,23 @@ +# Copyright 2019 Open Source Robotics Foundation, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from ament_xmllint.main import main +import pytest + + +@pytest.mark.linter +@pytest.mark.xmllint +def test_xmllint(): + rc = main(argv=[]) + assert rc == 0, 'Found errors' From b1f5802aee1ca687779352c4a92f2dddb698d17c Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez Cordero Date: Thu, 9 Oct 2025 10:44:38 +0200 Subject: [PATCH 2/2] Fixed merge Signed-off-by: Alejandro Hernandez Cordero --- pluginlib/include/pluginlib/class_desc.hpp | 30 ------- .../include/pluginlib/class_list_macros.hpp | 30 ------- pluginlib/include/pluginlib/impl/split.hpp | 30 ------- pluginlib/test/include/test_base.hpp | 47 ----------- pluginlib/test/include/test_plugins.hpp | 83 ------------------- pluginlib/test/include/visibility_control.hpp | 37 --------- pluginlib/test/test_plugins.cpp | 34 -------- 7 files changed, 291 deletions(-) delete mode 100644 pluginlib/test/include/test_base.hpp delete mode 100644 pluginlib/test/include/test_plugins.hpp diff --git a/pluginlib/include/pluginlib/class_desc.hpp b/pluginlib/include/pluginlib/class_desc.hpp index 4dfecc32..8a1ea122 100644 --- a/pluginlib/include/pluginlib/class_desc.hpp +++ b/pluginlib/include/pluginlib/class_desc.hpp @@ -1,4 +1,3 @@ -<<<<<<< HEAD /********************************************************************* * * Software License Agreement (BSD License) @@ -34,35 +33,6 @@ * POSSIBILITY OF SUCH DAMAGE. * *********************************************************************/ -======= -// Copyright 2008, Willow Garage, Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the Willow Garage nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. ->>>>>>> 1a596d6 (Add ros2plugin (#165)) #ifndef PLUGINLIB__CLASS_DESC_HPP_ #define PLUGINLIB__CLASS_DESC_HPP_ diff --git a/pluginlib/include/pluginlib/class_list_macros.hpp b/pluginlib/include/pluginlib/class_list_macros.hpp index 02ceea89..9691052c 100644 --- a/pluginlib/include/pluginlib/class_list_macros.hpp +++ b/pluginlib/include/pluginlib/class_list_macros.hpp @@ -1,4 +1,3 @@ -<<<<<<< HEAD /********************************************************************* * * Software License Agreement (BSD License) @@ -34,35 +33,6 @@ * POSSIBILITY OF SUCH DAMAGE. * *********************************************************************/ -======= -// Copyright 2008, Willow Garage, Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the Willow Garage nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. ->>>>>>> 1a596d6 (Add ros2plugin (#165)) #ifndef PLUGINLIB__CLASS_LIST_MACROS_HPP_ #define PLUGINLIB__CLASS_LIST_MACROS_HPP_ diff --git a/pluginlib/include/pluginlib/impl/split.hpp b/pluginlib/include/pluginlib/impl/split.hpp index 0ac561b5..b83232db 100644 --- a/pluginlib/include/pluginlib/impl/split.hpp +++ b/pluginlib/include/pluginlib/impl/split.hpp @@ -1,4 +1,3 @@ -<<<<<<< HEAD /* * Copyright (c) 2017, Open Source Robotics Foundation, Inc. * All rights reserved. @@ -27,35 +26,6 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -======= -// Copyright (c) 2017, Open Source Robotics Foundation, Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the Willow Garage nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. ->>>>>>> 1a596d6 (Add ros2plugin (#165)) #ifndef PLUGINLIB__IMPL__SPLIT_HPP_ #define PLUGINLIB__IMPL__SPLIT_HPP_ diff --git a/pluginlib/test/include/test_base.hpp b/pluginlib/test/include/test_base.hpp deleted file mode 100644 index 5b5978ac..00000000 --- a/pluginlib/test/include/test_base.hpp +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) 2012, Willow Garage, Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the Willow Garage nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -#ifndef TEST_BASE_HPP_ -#define TEST_BASE_HPP_ - -#include - -namespace test_base -{ -class TEST_PLUGINLIB_FIXTURE_PUBLIC Fubar -{ -public: - virtual void initialize(double foo) = 0; - virtual double result() = 0; - virtual ~Fubar() {} - -protected: - Fubar() {} -}; -} // namespace test_base -#endif // TEST_BASE_HPP_ diff --git a/pluginlib/test/include/test_plugins.hpp b/pluginlib/test/include/test_plugins.hpp deleted file mode 100644 index 5ad26240..00000000 --- a/pluginlib/test/include/test_plugins.hpp +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) 2012, Willow Garage, Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the Willow Garage nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -#ifndef TEST_PLUGINS_HPP_ -#define TEST_PLUGINS_HPP_ - -#include - -#include -#include - -namespace test_plugins -{ -class TEST_PLUGINLIB_FIXTURE_PUBLIC Bar : public test_base::Fubar -{ -public: - Bar() {} - - void initialize(double foo) - { - foo_ = foo; - } - - double result() - { - return 0.5 * foo_ * getBar(); - } - - double getBar() - { - return sqrt((foo_ * foo_) - ((foo_ / 2) * (foo_ / 2))); - } - -private: - double foo_; -}; - -class TEST_PLUGINLIB_FIXTURE_PUBLIC Foo : public test_base::Fubar -{ -public: - Foo() {} - - void initialize(double foo) - { - foo_ = foo; - } - - double result() - { - return foo_ * foo_; - } - -private: - double foo_; -}; -} // namespace test_plugins - -#endif // TEST_PLUGINS_HPP_ diff --git a/pluginlib/test/include/visibility_control.hpp b/pluginlib/test/include/visibility_control.hpp index 9dee3589..d14c205d 100644 --- a/pluginlib/test/include/visibility_control.hpp +++ b/pluginlib/test/include/visibility_control.hpp @@ -1,4 +1,3 @@ -<<<<<<< HEAD /* * Copyright (c) 2018, Open Source Robotics Foundation, Inc. * All rights reserved. @@ -30,38 +29,6 @@ #ifndef TEST_PLUGINLIB_FIXTURE__VISIBILITY_CONTROL_HPP_ #define TEST_PLUGINLIB_FIXTURE__VISIBILITY_CONTROL_HPP_ -======= -// Copyright (c) 2018, Open Source Robotics Foundation, Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the Willow Garage nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -#ifndef VISIBILITY_CONTROL_HPP_ -#define VISIBILITY_CONTROL_HPP_ ->>>>>>> 1a596d6 (Add ros2plugin (#165)) // This logic was borrowed (then namespaced) from the examples on the gcc wiki: // https://gcc.gnu.org/wiki/Visibility @@ -94,8 +61,4 @@ #define TEST_PLUGINLIB_FIXTURE_PUBLIC_TYPE #endif -<<<<<<< HEAD #endif // TEST_PLUGINLIB_FIXTURE__VISIBILITY_CONTROL_HPP_ -======= -#endif // VISIBILITY_CONTROL_HPP_ ->>>>>>> 1a596d6 (Add ros2plugin (#165)) diff --git a/pluginlib/test/test_plugins.cpp b/pluginlib/test/test_plugins.cpp index 02d1a0c2..fcf59001 100644 --- a/pluginlib/test/test_plugins.cpp +++ b/pluginlib/test/test_plugins.cpp @@ -1,4 +1,3 @@ -<<<<<<< HEAD /* * Copyright (c) 2012, Willow Garage, Inc. * All rights reserved. @@ -31,39 +30,6 @@ #include #include #include "test_plugins.h" // NOLINT -======= -// Copyright (c) 2012, Willow Garage, Inc. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// * Neither the name of the Willow Garage nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. - -#include -#include -#include "test_plugins.hpp" ->>>>>>> 1a596d6 (Add ros2plugin (#165)) PLUGINLIB_EXPORT_CLASS(test_plugins::Foo, test_base::Fubar) PLUGINLIB_EXPORT_CLASS(test_plugins::Bar, test_base::Fubar)