parallel_all_node.h
Go to the documentation of this file.
1 /* Copyright (C) 2023 Davide Faconti - All Rights Reserved
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
4 * to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
5 * 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:
6 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9 * 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,
10 * 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.
11 */
12 
13 #pragma once
14 
15 #include <set>
17 
18 namespace BT
19 {
34 {
35 public:
36  ParallelAllNode(const std::string& name, const NodeConfig& config);
37 
39  {
40  return { InputPort<int>("max_failures", 1,
41  "If the number of children returning FAILURE exceeds this "
42  "value, "
43  "ParallelAll returns FAILURE") };
44  }
45 
46  ~ParallelAllNode() override = default;
47 
48  virtual void halt() override;
49 
50  size_t failureThreshold() const;
51  void setFailureThreshold(int threshold);
52 
53 private:
55 
56  std::set<size_t> completed_list_;
57  size_t failure_count_ = 0;
58 
59  virtual BT::NodeStatus tick() override;
60 };
61 
62 } // namespace BT
BT
Definition: ex01_wrap_legacy.cpp:29
BT::ParallelAllNode::failure_threshold_
size_t failure_threshold_
Definition: parallel_all_node.h:54
BT::ParallelAllNode::completed_list_
std::set< size_t > completed_list_
Definition: parallel_all_node.h:56
BT::TreeNode::config
const NodeConfig & config() const
Definition: tree_node.cpp:345
BT::ParallelAllNode::tick
virtual BT::NodeStatus tick() override
Method to be implemented by the user.
Definition: parallel_all_node.cpp:25
BT::ParallelAllNode::setFailureThreshold
void setFailureThreshold(int threshold)
Definition: parallel_all_node.cpp:117
BT::PortsList
std::unordered_map< std::string, PortInfo > PortsList
Definition: basic_types.h:585
BT::ParallelAllNode::~ParallelAllNode
~ParallelAllNode() override=default
BT::ParallelAllNode::failure_count_
size_t failure_count_
Definition: parallel_all_node.h:57
BT::ParallelAllNode::providedPorts
static PortsList providedPorts()
Definition: parallel_all_node.h:38
BT::ParallelAllNode::ParallelAllNode
ParallelAllNode(const std::string &name, const NodeConfig &config)
Definition: parallel_all_node.cpp:21
control_node.h
BT::TreeNode::name
const std::string & name() const
Name of the instance, not the type.
Definition: tree_node.cpp:296
BT::ParallelAllNode::halt
virtual void halt() override
Definition: parallel_all_node.cpp:105
BT::NodeConfig
Definition: tree_node.h:73
BT::ParallelAllNode
The ParallelAllNode execute all its children concurrently, but not in separate threads!
Definition: parallel_all_node.h:33
BT::ControlNode
Definition: control_node.h:21
BT::NodeStatus
NodeStatus
Definition: basic_types.h:33
BT::ParallelAllNode::failureThreshold
size_t failureThreshold() const
Definition: parallel_all_node.cpp:112


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