AutoAPMS
Resilient Robot Mission Management
Loading...
Searching...
No Matches
tree_resource.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
17#include <set>
18#include <string>
19#include <vector>
20
22
24{
25
31{
32private:
33 // The default constructor is private. To create an instance, use one of the static factory methods instead.
34 TreeResource() = default;
35
36public:
37 std::string tree_file_stem;
38 std::string tree_file_path;
39 std::string package_name;
41 std::set<std::string> tree_names;
42
48 static std::vector<TreeResource> collectFromPackage(const std::string& package_name);
49
50 static TreeResource selectByTreeName(const std::string& tree_name, const std::string& package_name = "");
51
52 static TreeResource selectByFileName(const std::string& file_name, const std::string& package_name = "");
53
87 static TreeResource fromString(const std::string& identity);
88
89 std::string writeTreeToString() const;
90};
91
92} // namespace auto_apms_behavior_tree
Struct containing behavior tree resource data.
static TreeResource fromString(const std::string &identity)
Find a behavior tree resource using an identity string.
static TreeResource selectByFileName(const std::string &file_name, const std::string &package_name="")
static std::vector< TreeResource > collectFromPackage(const std::string &package_name)
Collect all behavior tree resources registered by a certain package.
static TreeResource selectByTreeName(const std::string &tree_name, const std::string &package_name="")