diff --git a/pluginlib/CHANGELOG.rst b/CHANGELOG.rst similarity index 100% rename from pluginlib/CHANGELOG.rst rename to CHANGELOG.rst diff --git a/pluginlib/CMakeLists.txt b/CMakeLists.txt similarity index 85% rename from pluginlib/CMakeLists.txt rename to CMakeLists.txt index c3216cac..c4b1385e 100644 --- a/pluginlib/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,12 +46,15 @@ install( install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME}) if(BUILD_TESTING) - find_package(ament_cmake_gtest REQUIRED) + find_package(ament_lint_auto REQUIRED) + ament_lint_auto_find_test_dependencies() - include_directories(include test/include) + find_package(ament_cmake_gtest REQUIRED) add_library(test_plugins SHARED ./test/test_plugins.cpp) target_compile_definitions(test_plugins PRIVATE "TEST_PLUGINLIB_FIXTURE_BUILDING_LIBRARY") + target_include_directories(test_plugins PRIVATE + "$") target_link_libraries(test_plugins ${PROJECT_NAME}) include("cmake/pluginlib_enable_plugin_testing.cmake") @@ -72,6 +75,8 @@ if(BUILD_TESTING) ) if(TARGET ${PROJECT_NAME}_unique_ptr_test) target_link_libraries(${PROJECT_NAME}_unique_ptr_test ${PROJECT_NAME}) + target_include_directories(${PROJECT_NAME}_unique_ptr_test PRIVATE + "$") add_dependencies(${PROJECT_NAME}_unique_ptr_test "${mock_install_target}") endif() @@ -84,6 +89,8 @@ if(BUILD_TESTING) # rcutils::rcutils target_link_libraries(${PROJECT_NAME}_utest ${PROJECT_NAME}) add_dependencies(${PROJECT_NAME}_utest "${mock_install_target}") + target_include_directories(${PROJECT_NAME}_utest PRIVATE + "$") endif() endif() diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..309be1e1 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,3 @@ +Any contribution that you make to this repository will +be under the 3-Clause BSD License, as dictated by that +[license](https://opensource.org/licenses/BSD-3-Clause). diff --git a/pluginlib/cmake/blank.in b/cmake/blank.in similarity index 100% rename from pluginlib/cmake/blank.in rename to cmake/blank.in diff --git a/pluginlib/cmake/pluginlib_enable_plugin_testing.cmake b/cmake/pluginlib_enable_plugin_testing.cmake similarity index 98% rename from pluginlib/cmake/pluginlib_enable_plugin_testing.cmake rename to cmake/pluginlib_enable_plugin_testing.cmake index 54ffc460..0dcd1a59 100644 --- a/pluginlib/cmake/pluginlib_enable_plugin_testing.cmake +++ b/cmake/pluginlib_enable_plugin_testing.cmake @@ -119,7 +119,8 @@ function(pluginlib_enable_plugin_testing) set(target_name "pluginlib_enable_plugin_testing__${ARG_PLUGIN_CATEGORY}__${ARG_PACKAGE_NAME}") if(TARGET "${target_name}") - message(FATAL_ERROR "pluginlib_enable_plugin_testing has already been called with category '${ARG_PLUGIN_CATEGORY}' and package name '${ARG_PACKAGE_NAME}'") + message(FATAL_ERROR "pluginlib_enable_plugin_testing has already been called with " + "category '${ARG_PLUGIN_CATEGORY}' and package name '${ARG_PACKAGE_NAME}'") endif() ##### diff --git a/pluginlib/cmake/pluginlib_export_plugin_description_file.cmake b/cmake/pluginlib_export_plugin_description_file.cmake similarity index 100% rename from pluginlib/cmake/pluginlib_export_plugin_description_file.cmake rename to cmake/pluginlib_export_plugin_description_file.cmake diff --git a/pluginlib/cmake/pluginlib_package_hook.cmake b/cmake/pluginlib_package_hook.cmake similarity index 100% rename from pluginlib/cmake/pluginlib_package_hook.cmake rename to cmake/pluginlib_package_hook.cmake diff --git a/include/pluginlib/class_desc.hpp b/include/pluginlib/class_desc.hpp new file mode 100644 index 00000000..3aee0f25 --- /dev/null +++ b/include/pluginlib/class_desc.hpp @@ -0,0 +1,76 @@ +// 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. + +#ifndef PLUGINLIB__CLASS_DESC_HPP_ +#define PLUGINLIB__CLASS_DESC_HPP_ + +#include + +namespace pluginlib +{ + +/// Storage for information about a given class. +class ClassDesc +{ +public: + /** + * \param lookup_name The lookup name of the class + * \param derived_class The type of the derived class of the class + * \param base_class The type of the class, corresponds to the type of the base class + * \param package The package the class lives in + * \param description A description for the class + * \param library_name The name of the containing library for the class (not a full path!) + * \param plugin_manifest_path The path to the plugin manifest file + */ + ClassDesc( + const std::string & lookup_name, const std::string & derived_class, + const std::string & base_class, const std::string & package, + const std::string & description, const std::string & library_name, + const std::string & plugin_manifest_path) + : lookup_name_(lookup_name), + derived_class_(derived_class), + base_class_(base_class), + package_(package), + description_(description), + library_name_(library_name), + resolved_library_path_("UNRESOLVED"), + plugin_manifest_path_(plugin_manifest_path) {} + + std::string lookup_name_; + std::string derived_class_; + std::string base_class_; + std::string package_; + std::string description_; + std::string library_name_; + std::string resolved_library_path_; // This is set by pluginlib::ClassLoader at load time. + std::string plugin_manifest_path_; +}; + +} // namespace pluginlib + +#endif // PLUGINLIB__CLASS_DESC_HPP_ diff --git a/include/pluginlib/class_list_macros.hpp b/include/pluginlib/class_list_macros.hpp new file mode 100644 index 00000000..470ab1d6 --- /dev/null +++ b/include/pluginlib/class_list_macros.hpp @@ -0,0 +1,43 @@ +// 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. + +#ifndef PLUGINLIB__CLASS_LIST_MACROS_HPP_ +#define PLUGINLIB__CLASS_LIST_MACROS_HPP_ + +#include + +/// Register a class with class loader to effectively export it for plugin loading later. +/** + * \def PLUGINLIB_EXPORT_CLASS(class_type, base_class_type) + * \param class_type The real class name with namespace qualifier (e.g. Animals::Lion) + * \param base_class_type The real base class type from which class_type inherits + */ +#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type) \ + CLASS_LOADER_REGISTER_CLASS(class_type, base_class_type) + +#endif // PLUGINLIB__CLASS_LIST_MACROS_HPP_ diff --git a/pluginlib/include/pluginlib/class_loader.hpp b/include/pluginlib/class_loader.hpp similarity index 88% rename from pluginlib/include/pluginlib/class_loader.hpp rename to include/pluginlib/class_loader.hpp index c2824f3e..28eb0f06 100644 --- a/pluginlib/include/pluginlib/class_loader.hpp +++ b/include/pluginlib/class_loader.hpp @@ -1,31 +1,30 @@ -/* - * Copyright (c) 2009, 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, Inc. 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 OWNER 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. - */ +// Copyright 2009, 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 PLUGINLIB__CLASS_LOADER_HPP_ #define PLUGINLIB__CLASS_LOADER_HPP_ diff --git a/pluginlib/include/pluginlib/class_loader_base.hpp b/include/pluginlib/class_loader_base.hpp similarity index 75% rename from pluginlib/include/pluginlib/class_loader_base.hpp rename to include/pluginlib/class_loader_base.hpp index cf6a3340..8daa5773 100644 --- a/pluginlib/include/pluginlib/class_loader_base.hpp +++ b/include/pluginlib/class_loader_base.hpp @@ -1,31 +1,30 @@ -/* - * 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, Inc. 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 OWNER 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. - */ +// Copyright 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 PLUGINLIB__CLASS_LOADER_BASE_HPP_ #define PLUGINLIB__CLASS_LOADER_BASE_HPP_ diff --git a/pluginlib/include/pluginlib/class_loader_imp.hpp b/include/pluginlib/class_loader_imp.hpp similarity index 93% rename from pluginlib/include/pluginlib/class_loader_imp.hpp rename to include/pluginlib/class_loader_imp.hpp index 149d1cef..43bfcfb1 100644 --- a/pluginlib/include/pluginlib/class_loader_imp.hpp +++ b/include/pluginlib/class_loader_imp.hpp @@ -1,38 +1,30 @@ -/********************************************************************* -* -* Software License Agreement (BSD License) -* -* Copyright (c) 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 Willow Garage, Inc. 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 OWNER 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. -* -*********************************************************************/ +// 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. #ifndef PLUGINLIB__CLASS_LOADER_IMP_HPP_ #define PLUGINLIB__CLASS_LOADER_IMP_HPP_ @@ -284,7 +276,7 @@ std::string ClassLoader::extractPackageNameFromPackageXML(const std::string & return ""; } - const char* package_name_node_txt = package_name_node->GetText(); + const char * package_name_node_txt = package_name_node->GetText(); if (NULL == package_name_node_txt) { RCUTILS_LOG_ERROR_NAMED("pluginlib.ClassLoader", "package.xml at %s has an invalid tag! Cannot determine package " @@ -643,12 +635,12 @@ void ClassLoader::processSingleXMLPluginFile( "' has no Root Element. This likely means the XML is malformed or missing."); return; } - const char* config_value = config->Value(); + const char * config_value = config->Value(); if (NULL == config_value) { - throw pluginlib::InvalidXMLException( + throw pluginlib::InvalidXMLException( "XML Document '" + xml_file + "' has an invalid Root Element. This likely means the XML is malformed or missing."); - return; + return; } if (!(strcmp(config_value, "library") == 0 || strcmp(config_value, "class_libraries") == 0)) @@ -665,7 +657,7 @@ void ClassLoader::processSingleXMLPluginFile( tinyxml2::XMLElement * library = config; while (library != NULL) { - const char* path = library->Attribute("path"); + const char * path = library->Attribute("path"); if (NULL == path) { RCUTILS_LOG_ERROR_NAMED("pluginlib.ClassLoader", "Attribute 'path' in 'library' tag is missing in %s.", xml_file.c_str()); diff --git a/pluginlib/include/pluginlib/exceptions.hpp b/include/pluginlib/exceptions.hpp similarity index 58% rename from pluginlib/include/pluginlib/exceptions.hpp rename to include/pluginlib/exceptions.hpp index 4733d851..a1c8e7db 100644 --- a/pluginlib/include/pluginlib/exceptions.hpp +++ b/include/pluginlib/exceptions.hpp @@ -1,31 +1,30 @@ -/* - * 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, Inc. 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 OWNER 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. - */ +// Copyright 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 PLUGINLIB__EXCEPTIONS_HPP_ #define PLUGINLIB__EXCEPTIONS_HPP_ diff --git a/include/pluginlib/impl/split.hpp b/include/pluginlib/impl/split.hpp new file mode 100644 index 00000000..3ec257da --- /dev/null +++ b/include/pluginlib/impl/split.hpp @@ -0,0 +1,55 @@ +// 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. + +#ifndef PLUGINLIB__IMPL__SPLIT_HPP_ +#define PLUGINLIB__IMPL__SPLIT_HPP_ + +#include +#include +#include + +namespace pluginlib +{ +namespace impl +{ + +inline std::vector +split(const std::string & input, const std::string & regex) +{ + std::regex re(regex); + // the -1 will cause this to return the stuff between the matches, see the submatch argument: + // http://en.cppreference.com/w/cpp/regex/regex_token_iterator/regex_token_iterator + std::sregex_token_iterator first(input.begin(), input.end(), re, -1); + std::sregex_token_iterator last; + return {first, last}; // vector will copy from first to last +} + +} // namespace impl +} // namespace pluginlib + +#endif // PLUGINLIB__IMPL__SPLIT_HPP_ diff --git a/pluginlib/package.xml b/package.xml similarity index 88% rename from pluginlib/package.xml rename to package.xml index 16c0df66..bcd0a54e 100644 --- a/pluginlib/package.xml +++ b/package.xml @@ -8,10 +8,9 @@ To work, these tools require plugin providers to register their plugins in the package.xml of their package. - Chris Lalancette + Chris Lalancette BSD - http://www.ros.org/wiki/pluginlib https://github.com/ros/pluginlib/issues https://github.com/ros/pluginlib @@ -31,6 +30,8 @@ tinyxml2_vendor ament_cmake_gtest + ament_lint_auto + ament_lint_common ament_cmake diff --git a/pluginlib/pluginlib-extras.cmake b/pluginlib-extras.cmake similarity index 100% rename from pluginlib/pluginlib-extras.cmake rename to pluginlib-extras.cmake diff --git a/pluginlib/include/pluginlib/class_desc.hpp b/pluginlib/include/pluginlib/class_desc.hpp deleted file mode 100644 index 8a1ea122..00000000 --- a/pluginlib/include/pluginlib/class_desc.hpp +++ /dev/null @@ -1,84 +0,0 @@ -/********************************************************************* -* -* Software License Agreement (BSD License) -* -* Copyright (c) 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 Willow Garage, Inc. 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 OWNER 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 PLUGINLIB__CLASS_DESC_HPP_ -#define PLUGINLIB__CLASS_DESC_HPP_ - -#include - -namespace pluginlib -{ - -/// Storage for information about a given class. -class ClassDesc -{ -public: - /** - * \param lookup_name The lookup name of the class - * \param derived_class The type of the derived class of the class - * \param base_class The type of the class, corresponds to the type of the base class - * \param package The package the class lives in - * \param description A description for the class - * \param library_name The name of the containing library for the class (not a full path!) - * \param plugin_manifest_path The path to the plugin manifest file - */ - ClassDesc( - const std::string & lookup_name, const std::string & derived_class, - const std::string & base_class, const std::string & package, - const std::string & description, const std::string & library_name, - const std::string & plugin_manifest_path) - : lookup_name_(lookup_name), - derived_class_(derived_class), - base_class_(base_class), - package_(package), - description_(description), - library_name_(library_name), - resolved_library_path_("UNRESOLVED"), - plugin_manifest_path_(plugin_manifest_path) {} - - std::string lookup_name_; - std::string derived_class_; - std::string base_class_; - std::string package_; - std::string description_; - std::string library_name_; - std::string resolved_library_path_; // This is set by pluginlib::ClassLoader at load time. - std::string plugin_manifest_path_; -}; - -} // namespace pluginlib - -#endif // PLUGINLIB__CLASS_DESC_HPP_ diff --git a/pluginlib/include/pluginlib/class_list_macros.hpp b/pluginlib/include/pluginlib/class_list_macros.hpp deleted file mode 100644 index 9691052c..00000000 --- a/pluginlib/include/pluginlib/class_list_macros.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/********************************************************************* -* -* Software License Agreement (BSD License) -* -* Copyright (c) 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 Willow Garage, Inc. 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 OWNER 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 PLUGINLIB__CLASS_LIST_MACROS_HPP_ -#define PLUGINLIB__CLASS_LIST_MACROS_HPP_ - -#include - -/// Register a class with class loader to effectively export it for plugin loading later. -/** - * \def PLUGINLIB_EXPORT_CLASS(class_type, base_class_type) - * \param class_type The real class name with namespace qualifier (e.g. Animals::Lion) - * \param base_class_type The real base class type from which class_type inherits - */ -#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type) \ - CLASS_LOADER_REGISTER_CLASS(class_type, base_class_type) - -#endif // PLUGINLIB__CLASS_LIST_MACROS_HPP_ diff --git a/pluginlib/include/pluginlib/impl/split.hpp b/pluginlib/include/pluginlib/impl/split.hpp deleted file mode 100644 index b83232db..00000000 --- a/pluginlib/include/pluginlib/impl/split.hpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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, Inc. 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 OWNER 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 PLUGINLIB__IMPL__SPLIT_HPP_ -#define PLUGINLIB__IMPL__SPLIT_HPP_ - -#include -#include -#include - -namespace pluginlib -{ -namespace impl -{ - -inline std::vector -split(const std::string & input, const std::string & regex) -{ - std::regex re(regex); - // the -1 will cause this to return the stuff between the matches, see the submatch argument: - // http://en.cppreference.com/w/cpp/regex/regex_token_iterator/regex_token_iterator - std::sregex_token_iterator first(input.begin(), input.end(), re, -1); - std::sregex_token_iterator last; - return {first, last}; // vector will copy from first to last -} - -} // namespace impl -} // namespace pluginlib - -#endif // PLUGINLIB__IMPL__SPLIT_HPP_ diff --git a/pluginlib/test/include/test_base.h b/pluginlib/test/include/test_base.h deleted file mode 100644 index 190c18af..00000000 --- a/pluginlib/test/include/test_base.h +++ /dev/null @@ -1,48 +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, Inc. 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 OWNER 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_PLUGINLIB_FIXTURE__TEST_BASE_H_ -#define TEST_PLUGINLIB_FIXTURE__TEST_BASE_H_ - -#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_H_ diff --git a/pluginlib/test/include/test_plugins.h b/pluginlib/test/include/test_plugins.h deleted file mode 100644 index fabf221c..00000000 --- a/pluginlib/test/include/test_plugins.h +++ /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, Inc. 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 OWNER 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_H_ -#define TEST_PLUGINS_H_ - -#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_H_ diff --git a/pluginlib/test/include/visibility_control.hpp b/pluginlib/test/include/visibility_control.hpp deleted file mode 100644 index d14c205d..00000000 --- a/pluginlib/test/include/visibility_control.hpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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, Inc. 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 OWNER 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_PLUGINLIB_FIXTURE__VISIBILITY_CONTROL_HPP_ -#define TEST_PLUGINLIB_FIXTURE__VISIBILITY_CONTROL_HPP_ - -// This logic was borrowed (then namespaced) from the examples on the gcc wiki: -// https://gcc.gnu.org/wiki/Visibility - -#if defined _WIN32 || defined __CYGWIN__ - #ifdef __GNUC__ - #define TEST_PLUGINLIB_FIXTURE_EXPORT __attribute__ ((dllexport)) - #define TEST_PLUGINLIB_FIXTURE_IMPORT __attribute__ ((dllimport)) - #else - #define TEST_PLUGINLIB_FIXTURE_EXPORT __declspec(dllexport) - #define TEST_PLUGINLIB_FIXTURE_IMPORT __declspec(dllimport) - #endif - #ifdef TEST_PLUGINLIB_FIXTURE_BUILDING_LIBRARY - #define TEST_PLUGINLIB_FIXTURE_PUBLIC TEST_PLUGINLIB_FIXTURE_EXPORT - #else - #define TEST_PLUGINLIB_FIXTURE_PUBLIC TEST_PLUGINLIB_FIXTURE_IMPORT - #endif - #define TEST_PLUGINLIB_FIXTURE_PUBLIC_TYPE TEST_PLUGINLIB_FIXTURE_PUBLIC - #define TEST_PLUGINLIB_FIXTURE_LOCAL -#else - #define TEST_PLUGINLIB_FIXTURE_EXPORT __attribute__ ((visibility("default"))) - #define TEST_PLUGINLIB_FIXTURE_IMPORT - #if __GNUC__ >= 4 - #define TEST_PLUGINLIB_FIXTURE_PUBLIC __attribute__ ((visibility("default"))) - #define TEST_PLUGINLIB_FIXTURE_LOCAL __attribute__ ((visibility("hidden"))) - #else - #define TEST_PLUGINLIB_FIXTURE_PUBLIC - #define TEST_PLUGINLIB_FIXTURE_LOCAL - #endif - #define TEST_PLUGINLIB_FIXTURE_PUBLIC_TYPE -#endif - -#endif // TEST_PLUGINLIB_FIXTURE__VISIBILITY_CONTROL_HPP_ diff --git a/pluginlib/test/test_plugins.cpp b/pluginlib/test/test_plugins.cpp deleted file mode 100644 index fcf59001..00000000 --- a/pluginlib/test/test_plugins.cpp +++ /dev/null @@ -1,35 +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, Inc. 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 OWNER 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.h" // NOLINT - -PLUGINLIB_EXPORT_CLASS(test_plugins::Foo, test_base::Fubar) -PLUGINLIB_EXPORT_CLASS(test_plugins::Bar, test_base::Fubar) diff --git a/test/include/test_base.hpp b/test/include/test_base.hpp new file mode 100644 index 00000000..5b5978ac --- /dev/null +++ b/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/test/include/test_plugins.hpp b/test/include/test_plugins.hpp new file mode 100644 index 00000000..5ad26240 --- /dev/null +++ b/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/test/include/visibility_control.hpp b/test/include/visibility_control.hpp new file mode 100644 index 00000000..b7341f5e --- /dev/null +++ b/test/include/visibility_control.hpp @@ -0,0 +1,63 @@ +// 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_ + +// This logic was borrowed (then namespaced) from the examples on the gcc wiki: +// https://gcc.gnu.org/wiki/Visibility + +#if defined _WIN32 || defined __CYGWIN__ + #ifdef __GNUC__ + #define TEST_PLUGINLIB_FIXTURE_EXPORT __attribute__ ((dllexport)) + #define TEST_PLUGINLIB_FIXTURE_IMPORT __attribute__ ((dllimport)) + #else + #define TEST_PLUGINLIB_FIXTURE_EXPORT __declspec(dllexport) + #define TEST_PLUGINLIB_FIXTURE_IMPORT __declspec(dllimport) + #endif + #ifdef TEST_PLUGINLIB_FIXTURE_BUILDING_LIBRARY + #define TEST_PLUGINLIB_FIXTURE_PUBLIC TEST_PLUGINLIB_FIXTURE_EXPORT + #else + #define TEST_PLUGINLIB_FIXTURE_PUBLIC TEST_PLUGINLIB_FIXTURE_IMPORT + #endif + #define TEST_PLUGINLIB_FIXTURE_PUBLIC_TYPE TEST_PLUGINLIB_FIXTURE_PUBLIC + #define TEST_PLUGINLIB_FIXTURE_LOCAL +#else + #define TEST_PLUGINLIB_FIXTURE_EXPORT __attribute__ ((visibility("default"))) + #define TEST_PLUGINLIB_FIXTURE_IMPORT + #if __GNUC__ >= 4 + #define TEST_PLUGINLIB_FIXTURE_PUBLIC __attribute__ ((visibility("default"))) + #define TEST_PLUGINLIB_FIXTURE_LOCAL __attribute__ ((visibility("hidden"))) + #else + #define TEST_PLUGINLIB_FIXTURE_PUBLIC + #define TEST_PLUGINLIB_FIXTURE_LOCAL + #endif + #define TEST_PLUGINLIB_FIXTURE_PUBLIC_TYPE +#endif + +#endif // VISIBILITY_CONTROL_HPP_ diff --git a/pluginlib/test/test_package.xml b/test/test_package.xml similarity index 78% rename from pluginlib/test/test_package.xml rename to test/test_package.xml index 4b97b834..c4efdf79 100644 --- a/pluginlib/test/test_package.xml +++ b/test/test_package.xml @@ -6,6 +6,8 @@ This tests pluginlib. + Chris Lalancette + BSD diff --git a/test/test_plugins.cpp b/test/test_plugins.cpp new file mode 100644 index 00000000..1c3708bc --- /dev/null +++ b/test/test_plugins.cpp @@ -0,0 +1,34 @@ +// 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" + +PLUGINLIB_EXPORT_CLASS(test_plugins::Foo, test_base::Fubar) +PLUGINLIB_EXPORT_CLASS(test_plugins::Bar, test_base::Fubar) diff --git a/pluginlib/test/test_plugins.xml b/test/test_plugins.xml similarity index 100% rename from pluginlib/test/test_plugins.xml rename to test/test_plugins.xml diff --git a/pluginlib/test/unique_ptr_test.cpp b/test/unique_ptr_test.cpp similarity index 57% rename from pluginlib/test/unique_ptr_test.cpp rename to test/unique_ptr_test.cpp index b5a55487..e59bda16 100644 --- a/pluginlib/test/unique_ptr_test.cpp +++ b/test/unique_ptr_test.cpp @@ -1,37 +1,36 @@ -/* - * 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, Inc. 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 OWNER 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. - */ +// 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 +#include TEST(PluginlibUniquePtrTest, unknownPlugin) { pluginlib::ClassLoader test_loader("test_pluginlib", "test_base::Fubar"); @@ -48,14 +47,16 @@ TEST(PluginlibUniquePtrTest, misspelledPlugin) { TEST(PluginlibTest, brokenPlugin) { pluginlib::ClassLoader test_loader("test_pluginlib", "test_base::Fubar"); - ASSERT_THROW(test_loader.createUniqueInstance("test_pluginlib/none"), pluginlib::PluginlibException); + ASSERT_THROW( + test_loader.createUniqueInstance("test_pluginlib/none"), pluginlib::PluginlibException); } TEST(PluginlibUniquePtrTest, workingPlugin) { pluginlib::ClassLoader test_loader("test_pluginlib", "test_base::Fubar"); try { - pluginlib::UniquePtr foo = test_loader.createUniqueInstance("test_pluginlib/foo"); + pluginlib::UniquePtr foo = + test_loader.createUniqueInstance("test_pluginlib/foo"); foo->initialize(10.0); EXPECT_EQ(100.0, foo->result()); } catch (pluginlib::PluginlibException & ex) { diff --git a/pluginlib/test/utest.cpp b/test/utest.cpp similarity index 66% rename from pluginlib/test/utest.cpp rename to test/utest.cpp index af66c960..e3edae1d 100644 --- a/pluginlib/test/utest.cpp +++ b/test/utest.cpp @@ -1,31 +1,30 @@ -/* - * 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, Inc. 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 OWNER 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. - */ +// 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 @@ -34,16 +33,18 @@ #include "rcutils/logging_macros.h" // NOLINT -#include +#include TEST(PluginlibTest, unknownPlugin) { pluginlib::ClassLoader test_loader("test_pluginlib", "test_base::Fubar"); - ASSERT_THROW(test_loader.createSharedInstance("test_pluginlib/foobar"), pluginlib::LibraryLoadException); + ASSERT_THROW( + test_loader.createSharedInstance("test_pluginlib/foobar"), pluginlib::LibraryLoadException); } TEST(PluginlibTest, misspelledPlugin) { pluginlib::ClassLoader bad_test_loader("test_pluginlib", "test_base::Fuba"); - ASSERT_THROW(bad_test_loader.createSharedInstance("test_pluginlib/foo"), pluginlib::LibraryLoadException); + ASSERT_THROW( + bad_test_loader.createSharedInstance("test_pluginlib/foo"), pluginlib::LibraryLoadException); } TEST(PluginlibTest, invalidPackage) { @@ -54,7 +55,8 @@ TEST(PluginlibTest, invalidPackage) { TEST(PluginlibTest, brokenPlugin) { pluginlib::ClassLoader test_loader("test_pluginlib", "test_base::Fubar"); - ASSERT_THROW(test_loader.createSharedInstance("test_pluginlib/none"), pluginlib::PluginlibException); + ASSERT_THROW( + test_loader.createSharedInstance("test_pluginlib/none"), pluginlib::PluginlibException); } TEST(PluginlibTest, workingPlugin) {