SDFormat Editor
Loading...
Searching...
No Matches
sdformat_parser_interface.h
1/*
2* sdformat-editor
3* Copyright 2025 sdformat-editor
4*
5* Licensed under the Apache License, Version 2.0 (the "License");
6* you may not use this file except in compliance with the License.
7* You may obtain a copy of the License at
8*
9* http://www.apache.org/licenses/LICENSE-2.0
10*
11* Unless required by applicable law or agreed to in writing, software
12* distributed under the License is distributed on an "AS IS" BASIS,
13* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14* See the License for the specific language governing permissions and
15* limitations under the License.
16*
17* Developer: Zaid Duraid, Ean Wheeler, Evan Vokey
18*/
19
20#ifndef SDFORMAT_EDITOR_PARSER_INTERFACE_HH_
21#define SDFORMAT_EDITOR_PARSER_INTERFACE_HH_
22
23#include <iostream>
24
25// SDFormat dependencies
26#include <sdf/sdf.hh>
27
28#include <interfaces/model_viewer_interface.h>
29
32{
37 public: virtual void Initialize(const std::string file_path, bool &success) = 0;
38
42 public: virtual sdf::SDFPtr GetSDFElement() = 0;
43
45 public: struct Mentions
46 {
47 std::vector<sdf::ElementPtr> elements;
48 std::vector<sdf::ParamPtr> attributes;
49 };
50
54 public: virtual std::vector<sdf::ElementPtr> LookupElementsByAttributeType(const std::string& attribute_type) = 0;
55
60 public: virtual std::vector<sdf::ElementPtr> LookupElementsByAttributeTypeAndValue(const std::string& attribute_type, const std::string& attribute_value) = 0;
61
65 public: virtual std::vector<sdf::ElementPtr> LookupElementsByType(const std::string& type) = 0;
66
70 public: virtual Mentions FindMentions(std::string key) = 0;
71
76 public: virtual Mentions FindMentions(std::string key, sdf::ElementPtr element_to_exclude) = 0;
77
82 public: virtual Mentions FindMentions(std::string key, sdf::ParamPtr attribute_to_exclude) = 0;
83
89 public: virtual Mentions FindMentions(std::string key, sdf::ElementPtr element_to_exclude, sdf::ParamPtr attribute_to_exclude) = 0;
90
94 public: virtual std::string GetSDFTreePathToElement(sdf::ElementPtr element) = 0;
95
100 public: virtual std::pair<std::vector<ModelViewerI::ModelInfo>, std::vector<ModelViewerI::PresetModelInfo>> GetModelsFromSDFTree(bool render_collisions = false) = 0;
101
102};
103
104#endif
Interface for the SDFormat Editor's Parser.
Definition sdformat_parser_interface.h:32
virtual Mentions FindMentions(std::string key, sdf::ElementPtr element_to_exclude)=0
Finds the elements and attributes which mention a given key.
virtual std::string GetSDFTreePathToElement(sdf::ElementPtr element)=0
Get the tree path to a given element.
virtual void Initialize(const std::string file_path, bool &success)=0
Initialization of the Parser. Will re-initalize the parser if initalized already.
virtual std::pair< std::vector< ModelViewerI::ModelInfo >, std::vector< ModelViewerI::PresetModelInfo > > GetModelsFromSDFTree(bool render_collisions=false)=0
Gets information about all models in the sdf tree in a format that can be interperted by the model vi...
virtual Mentions FindMentions(std::string key, sdf::ParamPtr attribute_to_exclude)=0
Finds the elements and attributes which mention a given key.
virtual std::vector< sdf::ElementPtr > LookupElementsByAttributeType(const std::string &attribute_type)=0
Provides a list of elements which have an attribute of the given attribute type.
virtual Mentions FindMentions(std::string key, sdf::ElementPtr element_to_exclude, sdf::ParamPtr attribute_to_exclude)=0
Finds the elements and attributes which mention a given key.
virtual std::vector< sdf::ElementPtr > LookupElementsByAttributeTypeAndValue(const std::string &attribute_type, const std::string &attribute_value)=0
Provides a list of elements which have an attribute of the given attribute type and the given attribu...
virtual sdf::SDFPtr GetSDFElement()=0
Returns the main sdfElement associated this this SDFormatParser instance.
virtual Mentions FindMentions(std::string key)=0
Finds the elements and attributes which mention a given key.
virtual std::vector< sdf::ElementPtr > LookupElementsByType(const std::string &type)=0
Provides a list of elements which are of a given type.
Struct to define a "mentions" object type.
Definition sdformat_parser_interface.h:46