ParameterOverrideRegistry Class
Thread-safe registry mapping a port C++ type to a parser that turns a YAML string into a typed BehaviorTree.CPP blackboard entry. More...
Declaration
Included Headers
Public Member Typedefs Index
| using | ParseFn = std::function< tl::expected< BT::Any, std::string >(std::string_view)> |
|
Callback that parses a YAML string into a typed BT::Any value. More... | |
Private Constructors Index
| ParameterOverrideRegistry ()=default | |
Public Member Functions Index
| void | registerParser (std::type_index type_index, ParseFn parser) |
|
Register a parser for the type identified by type_index. More... | |
| ParseFn | findParser (std::type_index type_index) const |
|
Look up the parser for type_index. Returns an empty ParseFn if no parser is registered. More... | |
| ParseFn | findParserByName (std::string_view declared_type_name) const |
|
Look up the parser for the C++ type whose spelling is declared_type_name. More... | |
Private Member Attributes Index
| std::mutex | mutex_ |
| std::unordered_map< std::type_index, ParseFn > | parsers_ |
| std::unordered_map< std::string, ParseFn, moveit_pro_types::StringHash, std::equal_to<> > | parsers_by_name_ |
Public Static Functions Index
| static ParameterOverrideRegistry & | get () |
|
Access the process-global registry. More... | |
Description
Thread-safe registry mapping a port C++ type to a parser that turns a YAML string into a typed BehaviorTree.CPP blackboard entry.
Used by the objective server to apply parameter_overrides from DoObjectiveSequence goals onto the tree's blackboards as typed values, so behaviors do not need a BT::convertFromString<T> specialization visible in every .cpp that calls getInput<T>(). Built-in ROS message types are seeded once at startup via seedBuiltinParameterOverrideParsers(). Customers register custom types by calling registerParameterType<T>() once per type from their behavior loader plugin's registerBehaviors().
Definition at line 42 of file parameter_override_registry.hpp.
Public Member Typedefs
ParseFn
|
Callback that parses a YAML string into a typed BT::Any value.
- Returns
tl::expected wrapping the parsed value on success, or a human-readable error string on YAML parse failure. The parser does not touch any blackboard — that is the caller's responsibility so the apply step can be made transactional.
Definition at line 51 of file parameter_override_registry.hpp.
Private Constructors
ParameterOverrideRegistry()
| default |
Definition at line 83 of file parameter_override_registry.hpp.
Public Member Functions
findParser()
|
Look up the parser for type_index. Returns an empty ParseFn if no parser is registered.
Returns by value (a copy of the std::function) so concurrent registerParser calls cannot dangle the pointer to a rehashed unordered_map entry between lookup and invocation.
Declaration at line 70 of file parameter_override_registry.hpp, definition at line 57 of file parameter_override_registry.cpp.
findParserByName()
|
Look up the parser for the C++ type whose spelling is declared_type_name.
Used to resolve an override against an Objective's declared <input_port type="..."> when the consuming port is type-erased (e.g. a ForEach whose port is std::vector<BT::Any>), so port-based type_index resolution yields no usable parser. The query is normalized via normalizeTypeName to match the registered key, so the user-written spelling (std::vector<geometry_msgs::msg::PoseStamped>) resolves to the parser registered for the demangled spelling (which carries std::allocator<...> template args). Returns an empty ParseFn if none matches.
Declaration at line 80 of file parameter_override_registry.hpp, definition at line 67 of file parameter_override_registry.cpp.
registerParser()
|
Register a parser for the type identified by type_index.
Overwrites any prior registration for the same type. Also indexes the parser by the normalized demangled spelling of type_index so it can be resolved by name (see findParserByName). Thread-safe.
Declaration at line 63 of file parameter_override_registry.hpp, definition at line 46 of file parameter_override_registry.cpp.
Private Member Attributes
mutex_
| mutable |
Definition at line 84 of file parameter_override_registry.hpp.
parsers_
|
Definition at line 85 of file parameter_override_registry.hpp.
parsers_by_name_
|
Definition at line 88 of file parameter_override_registry.hpp.
Public Static Functions
get()
| static |
Access the process-global registry.
Declaration at line 56 of file parameter_override_registry.hpp, definition at line 40 of file parameter_override_registry.cpp.
The documentation for this class was generated from the following files:
Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.