Classes | Functions
BT::details Namespace Reference

The SwitchNode is equivalent to a switch statement, where a certain branch (child) is executed according to the value of a blackboard entry. More...

Classes

class  Semaphore
 

Functions

bool CheckStringEquality (const std::string &v1, const std::string &v2, const ScriptingEnumsRegistry *enums)
 
template<typename T = AnyTypeAllowed, typename DefaultT = T>
std::pair< std::string, PortInfoPortWithDefault (PortDirection direction, StringView name, const DefaultT &default_value, StringView description)
 

Detailed Description

The SwitchNode is equivalent to a switch statement, where a certain branch (child) is executed according to the value of a blackboard entry.

Note that the same behaviour can be achieved with multiple Sequences, Fallbacks and Conditions reading the blackboard, but switch is shorter and more readable.

Example usage:

<Switch3 variable="{var}" case_1="1" case_2="42" case_3="666" > <ActionA name="action_when_var_eq_1" > <ActionB name="action_when_var_eq_42" > <ActionC name="action_when_var_eq_666" > <ActionD name="default_action" > </Switch3>

When the SwitchNode is executed (Switch3 is a node with 3 cases) the "variable" will be compared to the cases and execute the correct child or the default one (last).

Function Documentation

◆ CheckStringEquality()

bool BT::details::CheckStringEquality ( const std::string &  v1,
const std::string &  v2,
const ScriptingEnumsRegistry enums 
)

Definition at line 22 of file switch_node.cpp.

◆ PortWithDefault()

template<typename T = AnyTypeAllowed, typename DefaultT = T>
std::pair<std::string, PortInfo> BT::details::PortWithDefault ( PortDirection  direction,
StringView  name,
const DefaultT &  default_value,
StringView  description 
)
inline

Definition at line 505 of file basic_types.h.



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