tools
bt_plugin_manifest.cpp
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <iostream>
3
#include <unordered_map>
4
#include <unordered_set>
5
#include "
behaviortree_cpp/bt_factory.h
"
6
7
int
main
(
int
argc,
char
* argv[])
8
{
9
if
(argc != 2)
10
{
11
printf(
"Wrong number of command line arguments\nUsage: %s [filename]\n"
, argv[0]);
12
return
1;
13
}
14
15
BT::BehaviorTreeFactory
factory;
16
17
std::unordered_set<std::string> default_nodes;
18
for
(
auto
& it : factory.
manifests
())
19
{
20
const
auto
&
manifest
= it.second;
21
default_nodes.insert(
manifest
.registration_ID);
22
}
23
24
factory.
registerFromPlugin
(argv[1]);
25
26
for
(
auto
& it : factory.
manifests
())
27
{
28
const
auto
&
manifest
= it.second;
29
if
(default_nodes.count(
manifest
.registration_ID) > 0)
30
{
31
continue
;
32
}
33
auto
& params =
manifest
.ports;
34
std::cout <<
"---------------\n"
35
<<
manifest
.registration_ID <<
" ["
<<
manifest
.type
36
<<
"]\n NodeConfig: "
<< params.size();
37
38
if
(params.size() > 0)
39
{
40
std::cout <<
":"
;
41
}
42
43
std::cout << std::endl;
44
45
for
(
auto
& param : params)
46
{
47
std::cout <<
" - [Key]: \""
<< param.first <<
"\""
<< std::endl;
48
}
49
}
50
51
return
0;
52
}
BT::BehaviorTreeFactory::registerFromPlugin
void registerFromPlugin(const std::string &file_path)
registerFromPlugin load a shared library and execute the function BT_REGISTER_NODES (see macro).
Definition:
bt_factory.cpp:192
manifest
string manifest
bt_factory.h
BT::BehaviorTreeFactory::manifests
const std::unordered_map< std::string, TreeNodeManifest > & manifests() const
Manifests of all the registered TreeNodes.
Definition:
bt_factory.cpp:385
main
int main(int argc, char *argv[])
Definition:
bt_plugin_manifest.cpp:7
BT::BehaviorTreeFactory
The BehaviorTreeFactory is used to create instances of a TreeNode at run-time.
Definition:
bt_factory.h:209
behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Dec 13 2024 03:19:16