FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

List plugins script (#264) · ros/pluginlib@b69c590 · GitHub

/ pluginlib Public

Commit b69c590

Browse files
authored andcommitted
List plugins script (#264)
Signed-off-by: David V. Lu <davidvlu@gmail.com> Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com> Co-authored-by: Alejandro Hernandez Cordero <ahcorde@gmail.com> (cherry picked from commit 2f5289f)
1 parent 59aa79e commit b69c590

2 files changed

Lines changed: 61 additions & 0 deletions

File tree

‎pluginlib/CMakeLists.txt‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ target_link_libraries(${PROJECT_NAME} INTERFACE
2929
rcpputils::rcpputils
3030
tinyxml2::tinyxml2)
3131

32+
add_executable(list_plugins src/list_plugins.cpp)
33+
target_include_directories(list_plugins PUBLIC
34+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
35+
$<INSTALL_INTERFACE:include>
36+
)
37+
target_link_libraries(list_plugins
38+
${PROJECT_NAME}
39+
)
40+
install(TARGETS list_plugins
41+
DESTINATION lib/${PROJECT_NAME}
42+
)
43+
3244
ament_export_dependencies(ament_index_cpp class_loader rcutils rcpputils tinyxml2_vendor TinyXML2)
3345

3446
ament_export_targets(export_${PROJECT_NAME})

‎src/list_plugins.cpp‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright (c) 2025, Metro Robots
2+
//
3+
// Redistribution and use in source and binary forms, with or without
4+
// modification, are permitted provided that the following conditions are met:
5+
//
6+
// * Redistributions of source code must retain the above copyright
7+
// notice, this list of conditions and the following disclaimer.
8+
//
9+
// * Redistributions in binary form must reproduce the above copyright
10+
// notice, this list of conditions and the following disclaimer in the
11+
// documentation and/or other materials provided with the distribution.
12+
//
13+
// * Neither the name of the Willow Garage nor the names of its
14+
// contributors may be used to endorse or promote products derived from
15+
// this software without specific prior written permission.
16+
//
17+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18+
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19+
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20+
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21+
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22+
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23+
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24+
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25+
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26+
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27+
// POSSIBILITY OF SUCH DAMAGE.
28+
29+
/* Author: David V. Lu!! */
30+
31+
#include <iostream>
32+
#include <pluginlib/class_loader.hpp>
33+
34+
int main(int argc, char ** argv)
35+
{
36+
if (argc != 3) {
37+
std::cerr << "Requires two arguments!" << std::endl;
38+
std::cerr << "Usage: " << argv[0];
39+
std::cerr << " [package] [base_class]" << std::endl;
40+
return -1;
41+
}
42+
43+
// Note: You cannot use void if you want to use the templated createSharedInstance methods
44+
pluginlib::ClassLoader<void> cl(argv[1], argv[2]);
45+
for (const auto & declared : cl.getDeclaredClasses()) {
46+
std::cout << declared << std::endl;
47+
}
48+
return 0;
49+
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL