bt_plugin_manifest.cpp
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <iostream>
00003 #include <fstream>
00004 #include <unordered_map>
00005 #include "behaviortree_cpp/bt_factory.h"
00006 
00007 int main(int argc, char* argv[])
00008 {
00009     if (argc != 2)
00010     {
00011         printf("Wrong number of command line arguments\nUsage: %s [filename]\n", argv[0]);
00012         return 1;
00013     }
00014 
00015     BT::BehaviorTreeFactory factory;
00016 
00017     std::unordered_set<std::string> default_nodes;
00018     for (auto& it : factory.manifests())
00019     {
00020         const auto& manifest = it.second;
00021         default_nodes.insert(manifest.registration_ID);
00022     }
00023 
00024     factory.registerFromPlugin(argv[1]);
00025 
00026     for (auto& it : factory.manifests())
00027     {
00028         const auto& manifest = it.second;
00029         if (default_nodes.count(manifest.registration_ID) > 0)
00030         {
00031             continue;
00032         }
00033         auto& params = manifest.ports;
00034         std::cout << "---------------\n"
00035                   << manifest.registration_ID << " [" << manifest.type
00036                   << "]\n  NodeParameters: " << params.size();
00037 
00038         if (params.size() > 0)
00039         {
00040             std::cout << ":";
00041         }
00042 
00043         std::cout << std::endl;
00044 
00045         for (auto& param : params)
00046         {
00047             std::cout << "    - [Key]: \"" << param.first << "\"" << std::endl;
00048         }
00049     }
00050 
00051     return 0;
00052 }


behaviortree_cpp
Author(s): Michele Colledanchise, Davide Faconti
autogenerated on Sat Jun 8 2019 20:17:15