AutoAPMS
Resilient Robot Mission Management
Loading...
Searching...
No Matches
tree_builder_factory_template.hpp
Go to the documentation of this file.
1// Copyright 2024 Robin Müller
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16
18
20{
21
22template <typename T>
24{
25public:
27 virtual ~TreeBuilderFactoryTemplate() = default;
28
29 std::shared_ptr<TreeBuilderBase> instantiateBuilder(const rclcpp::Node::SharedPtr node_ptr)
30 {
31 static_assert(std::is_convertible_v<T*, TreeBuilderBase*>,
32 "Cannot convert T* to TreeBuilderBase*. Did you forget to specify the keyword 'public' when "
33 "inheriting? --> class T : public TreeBuilderBase");
34 return std::make_shared<T>(node_ptr);
35 }
36};
37
38} // namespace auto_apms_behavior_tree
std::shared_ptr< TreeBuilderBase > instantiateBuilder(const rclcpp::Node::SharedPtr node_ptr)