test_helper.hpp
Go to the documentation of this file.
1 #ifndef TEST_HELPER_HPP
2 #define TEST_HELPER_HPP
3 
4 #include <cstdio>
5 
7 
8 inline BT::NodeStatus TestTick(int* tick_counter)
9 {
10  (*tick_counter)++;
12 }
13 
14 template <size_t N>
16  const std::string& name_prefix,
17  std::array<int, N>& tick_counters)
18 {
19  for(size_t i = 0; i < tick_counters.size(); i++)
20  {
21  tick_counters[i] = false;
22  char str[100];
23  snprintf(str, sizeof str, "%s%c", name_prefix.c_str(), char('A' + i));
24  int* counter_ptr = &(tick_counters[i]);
25  factory.registerSimpleAction(str, std::bind(&TestTick, counter_ptr));
26  }
27 }
28 
29 #endif // TEST_HELPER_HPP
TestTick
BT::NodeStatus TestTick(int *tick_counter)
Definition: test_helper.hpp:8
RegisterTestTick
void RegisterTestTick(BT::BehaviorTreeFactory &factory, const std::string &name_prefix, std::array< int, N > &tick_counters)
Definition: test_helper.hpp:15
bt_factory.h
lexy::bind
constexpr auto bind(Callback &&callback, BoundArgs &&... args)
Binds the operator() of the callback with pre-defined/remapped values.
Definition: bind.hpp:321
BT::BehaviorTreeFactory
The BehaviorTreeFactory is used to create instances of a TreeNode at run-time.
Definition: bt_factory.h:205
BT::NodeStatus::SUCCESS
@ SUCCESS
BT::NodeStatus
NodeStatus
Definition: basic_types.h:33
BT::BehaviorTreeFactory::registerSimpleAction
void registerSimpleAction(const std::string &ID, const SimpleActionNode::TickFunctor &tick_functor, PortsList ports={})
registerSimpleAction help you register nodes of type SimpleActionNode.
Definition: bt_factory.cpp:166


behaviortree_cpp_v4
Author(s): Davide Faconti
autogenerated on Fri Jun 28 2024 02:20:08