Fabric 0.2.0
Loading...
Searching...
No Matches
parser_base.hpp
Go to the documentation of this file.
1#pragma once
2#include <string>
3#include <vector>
4#include <rclcpp/rclcpp.hpp>
7
8namespace fabric
9{
10
18{
19public:
20 virtual ~ParserBase() = default;
21
28 virtual void initialize(const rclcpp::Node::SharedPtr& node)
29 {
30 initialize_base(node, "ParserBasePlugin");
31 }
32
39 virtual bool load_file(const std::string& file_path, fabric::Plan& plan) = 0;
40
47 virtual void parse(fabric::Plan& plan) = 0;
48
55 virtual bool check_compatibility(const fabric::Plan& plan) = 0;
56
57protected:
64 void initialize_base(const rclcpp::Node::SharedPtr& node, const std::string& plugin_name)
65 {
66 node_ = node;
67 plugin_name_ = plugin_name;
68 }
69
73 rclcpp::Node::SharedPtr node_;
74
78 std::string plugin_name_;
79};
80
81} // namespace fabric
Abstract base class for XML plan parsing plugins.
Definition parser_base.hpp:18
void initialize_base(const rclcpp::Node::SharedPtr &node, const std::string &plugin_name)
Base initialization method for derived classes.
Definition parser_base.hpp:64
virtual bool load_file(const std::string &file_path, fabric::Plan &plan)=0
load a file into an XML document
virtual void initialize(const rclcpp::Node::SharedPtr &node)
Initialize the validation plugin with the given ROS2 node.
Definition parser_base.hpp:28
virtual void parse(fabric::Plan &plan)=0
Parse the given XML plan.
virtual ~ParserBase()=default
std::string plugin_name_
Name of the validation plugin.
Definition parser_base.hpp:78
rclcpp::Node::SharedPtr node_
Shared pointer to the ROS2 node.
Definition parser_base.hpp:73
virtual bool check_compatibility(const fabric::Plan &plan)=0
Check the compatibility of the given plan with the given parser.
Definition parser_base.hpp:9
Definition structs.hpp:70
Structure representing a node in the fabric.
Definition structs.hpp:26