behavior_tree.h
Go to the documentation of this file.
1 /* Copyright (C) 2015-2018 Michele Colledanchise - All Rights Reserved
2  * Copyright (C) 2018-2023 Davide Faconti - All Rights Reserved
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
6 * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
7 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
11 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 */
13 
14 #pragma once
15 
26 
29 
37 
47 
54 
55 #include <iostream>
56 
57 namespace BT
58 {
59 //Call the visitor for each node of the tree, given a root.
60 void applyRecursiveVisitor(const TreeNode* root_node,
61  const std::function<void(const TreeNode*)>& visitor);
62 
63 //Call the visitor for each node of the tree, given a root.
64 void applyRecursiveVisitor(TreeNode* root_node,
65  const std::function<void(TreeNode*)>& visitor);
66 
70 void printTreeRecursively(const TreeNode* root_node, std::ostream& stream = std::cout);
71 
72 using SerializedTreeStatus = std::vector<std::pair<uint16_t, uint8_t>>;
73 
82 void buildSerializedStatusSnapshot(const TreeNode* root_node,
83  SerializedTreeStatus& serialized_buffer);
84 
87 template <typename T>
88 inline NodeType getType()
89 {
90  // clang-format off
96  return NodeType::UNDEFINED;
97  // clang-format on
98 }
99 
100 const char* LibraryVersionString();
101 
103 
104 } // namespace BT
BT
Definition: ex01_wrap_legacy.cpp:29
updated_action.h
script_precondition.h
BT::NodeType
NodeType
Enumerates the possible types of nodes.
Definition: basic_types.h:20
BT::NodeType::DECORATOR
@ DECORATOR
BT::NodeType::CONDITION
@ CONDITION
BT::LibraryVersionNumber
int LibraryVersionNumber()
Definition: behavior_tree.cpp:114
sleep_node.h
BT::TreeNode
Abstract base class for Behavior Tree Nodes.
Definition: tree_node.h:118
sequence_with_memory_node.h
subtree_node.h
BT::NodeType::SUBTREE
@ SUBTREE
force_failure_node.h
retry_node.h
magic_enum::detail::value
constexpr E value(std::size_t i) noexcept
Definition: magic_enum.hpp:664
timeout_node.h
reactive_sequence.h
BT::SerializedTreeStatus
std::vector< std::pair< uint16_t, uint8_t > > SerializedTreeStatus
Definition: behavior_tree.h:72
test_node.h
delay_node.h
fallback_node.h
BT::NodeType::UNDEFINED
@ UNDEFINED
script_condition.h
loop_node.h
always_success_node.h
BT::NodeType::ACTION
@ ACTION
action_node.h
unset_blackboard_node.h
force_success_node.h
while_do_else_node.h
if_then_else_node.h
run_once_node.h
script_node.h
inverter_node.h
BT::getType
NodeType getType()
Definition: behavior_tree.h:88
BT::applyRecursiveVisitor
void applyRecursiveVisitor(const TreeNode *root_node, const std::function< void(const TreeNode *)> &visitor)
Definition: behavior_tree.cpp:18
repeat_node.h
BT::printTreeRecursively
void printTreeRecursively(const TreeNode *root_node, std::ostream &stream=std::cout)
Definition: behavior_tree.cpp:66
BT::LibraryVersionString
const char * LibraryVersionString()
Definition: behavior_tree.cpp:126
keep_running_until_failure_node.h
BT::NodeType::CONTROL
@ CONTROL
always_failure_node.h
BT::buildSerializedStatusSnapshot
void buildSerializedStatusSnapshot(const TreeNode *root_node, SerializedTreeStatus &serialized_buffer)
buildSerializedStatusSnapshot can be used to create a buffer that can be stored (or sent to a client ...
sequence_node.h
condition_node.h
parallel_node.h
updated_decorator.h
set_blackboard_node.h
reactive_fallback.h
switch_node.h
parallel_all_node.h


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