Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move pluginlib in its own folder (port 83 to ros2 branch) #95

Merged
merged 3 commits into from Dec 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
File renamed without changes.
2 changes: 1 addition & 1 deletion CMakeLists.txt → pluginlib/CMakeLists.txt
Expand Up @@ -58,7 +58,7 @@ install(
# endif()

# include(CheckCXXCompilerFlag)
# CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
# check_cxx_compiler_flag("-std=c++11" COMPILER_SUPPORTS_CXX11)
# if(COMPILER_SUPPORTS_CXX11)
# catkin_add_gtest(${PROJECT_NAME}_unique_ptr_test test/unique_ptr_test.cpp)
# if(TARGET ${PROJECT_NAME}_unique_ptr_test)
Expand Down
Expand Up @@ -69,7 +69,7 @@ set(__PLUGINLIB_PLUGIN_CATEGORIES "")
# pluginlib_export_plugin_description_file(rviz "plugin_description.xml")
#
# This macro assumes the package name is PROJECT_NAME.
#
#
# :param plugin_category: category for the type of plugin described; used at
# runtime to locate all description files for that kind of plugin
# :type plugin_category: string
Expand Down
Expand Up @@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# install the ament resource for the plugin descriptions exported by this package
# install the ament resource for the plugin descriptions exported by
# this package
list(REMOVE_DUPLICATES __PLUGINLIB_PLUGIN_CATEGORIES)
foreach(plugin_category ${__PLUGINLIB_PLUGIN_CATEGORIES})
# this assumes PROJECT_NAME is the package name
Expand Down
Expand Up @@ -316,7 +316,13 @@ std::map<std::string, ClassDesc> ClassLoader<T>::determineAvailableClasses(
for (std::vector<std::string>::const_iterator it = plugin_xml_paths.begin();
it != plugin_xml_paths.end(); ++it)
{
processSingleXMLPluginFile(*it, classes_available);
try {
processSingleXMLPluginFile(*it, classes_available);
} catch (const pluginlib::InvalidXMLException & e) {
RCUTILS_LOG_ERROR_NAMED("pluginlib.ClassLoader",
"Skipped loading plugin with error: %s.",
e.what());
}
}

RCUTILS_LOG_DEBUG_NAMED("pluginlib.ClassLoader", "Exiting determineAvailableClasses()...");
Expand Down Expand Up @@ -670,15 +676,15 @@ void ClassLoader<T>::processSingleXMLPluginFile(
tinyxml2::XMLElement * config = document.RootElement();
if (NULL == config) {
throw pluginlib::InvalidXMLException(
"XML Document has no Root Element. "
"This likely means the XML is malformed or missing.");
"XML Document '" + xml_file +
"' has no Root Element. This likely means the XML is malformed or missing.");
return;
}
if (!(strcmp(config->Value(), "library") == 0 ||
strcmp(config->Value(), "class_libraries") == 0))
{
throw pluginlib::InvalidXMLException(
"The XML document given to add must have either \"library\" or "
"The XML document '" + xml_file + "' given to add must have either \"library\" or "
"\"class_libraries\" as the root tag");
return;
}
Expand Down
Expand Up @@ -47,7 +47,7 @@ class PluginlibException : public std::runtime_error
: std::runtime_error(error_desc) {}
};

/// An exception class thrown when pluginlib is unable to load a plugin XML file.
/// Thrown when pluginlib is unable to load a plugin XML file.
/**
* \class InvalidXMLException
*/
Expand All @@ -58,7 +58,7 @@ class InvalidXMLException : public PluginlibException
: PluginlibException(error_desc) {}
};

/// An exception class thrown when pluginlib is unable to load the library associated with a given plugin.
/// Thrown when pluginlib is unable to load the library associated with a given plugin.
/**
* \class LibraryLoadException
*/
Expand All @@ -69,7 +69,7 @@ class LibraryLoadException : public PluginlibException
: PluginlibException(error_desc) {}
};

/// An exception class thrown when pluginlib is unable to instantiate a class loader.
/// Thrown when pluginlib is unable to instantiate a class loader.
/**
* \class ClassLoaderException
*/
Expand All @@ -80,7 +80,7 @@ class ClassLoaderException : public PluginlibException
: PluginlibException(error_desc) {}
};

/// An exception class thrown when pluginlib is unable to unload the library associated with a given plugin.
/// Thrown when pluginlib is unable to unload the library associated with a given plugin.
/**
* \class LibraryUnloadException
*/
Expand All @@ -91,7 +91,7 @@ class LibraryUnloadException : public PluginlibException
: PluginlibException(error_desc) {}
};

/// An exception class thrown when pluginlib is unable to create the class associated with a given plugin.
/// Thrown when pluginlib is unable to create the class associated with a given plugin.
/**
* \class CreateClassException
*/
Expand Down
Expand Up @@ -67,6 +67,7 @@ namespace fs = std::experimental::filesystem;
#ifndef PLUGINLIB__IMPL__FILESYSYEM_HELPER__HAS_STD_FILESYSTEM

#include <string>
#include <vector>

#ifdef _WIN32
#define CLASS_LOADER_IMPL_OS_DIRSEP '\\'
Expand Down
Expand Up @@ -40,7 +40,8 @@ namespace impl
{

inline std::vector<std::string>
split(const std::string & input, const std::string & regex) {
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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -29,7 +29,7 @@

#include <pluginlib/class_list_macros.hpp>
#include "./test_base.h"
#include "./test_plugins.h"
#include "test_plugins.h" // NOLINT

PLUGINLIB_EXPORT_CLASS(test_plugins::Foo, test_base::Fubar)
PLUGINLIB_EXPORT_CLASS(test_plugins::Bar, test_base::Fubar)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 4 additions & 2 deletions test/utest.cpp → pluginlib/test/utest.cpp
Expand Up @@ -29,7 +29,8 @@

#include <gtest/gtest.h>

#include <pluginlib/class_loader.hpp>
#include <memory>
#include <pluginlib/class_loader.hpp> // NOLINT

#include "./test_base.h"

Expand Down Expand Up @@ -123,7 +124,8 @@ TEST(PluginlibTest, brokenXML) {
try {
pluginlib::ClassLoader<test_base::Fubar> test_loader("pluginlib", "test_base::Fubar",
"plugin_test");
} catch (pluginlib::InvalidXMLException & ex) {
test_loader.createInstance("pluginlib/foo");
} catch (pluginlib::PluginlibException & ex) {
SUCCEED();
return;
}
Expand Down