Loading...
Searching...
No Matches
InterfaceElements.hh
Go to the documentation of this file.
1/*
2 * Copyright 2021 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17#ifndef SDF_INTERFACE_ELEMENTS_HH_
18#define SDF_INTERFACE_ELEMENTS_HH_
19
20#include <functional>
21#include <string>
22#include <memory>
23#include <optional>
24
25#include <gz/math/Pose3.hh>
26#include <gz/utils/ImplPtr.hh>
27#include <gz/utils/SuppressWarning.hh>
28
29#include "sdf/Element.hh"
30#include "sdf/InterfaceModel.hh"
31#include "sdf/Types.hh"
32
33#include "sdf/config.hh"
34#include "sdf/system_util.hh"
35
36namespace sdf
37{
38inline namespace SDF_VERSION_NAMESPACE
39{
40#ifdef _WIN32
41// Disable warning C4251 which is triggered by std::string
42#pragma warning(push)
43#pragma warning(disable: 4251)
44#endif
48{
50 public: NestedInclude();
51
56 public: const std::string &Uri() const;
57
60 public: void SetUri(const std::string &_uri);
61
67 public: const std::string &ResolvedFileName() const;
68
71 public: void SetResolvedFileName(const std::string &_resolvedFileName);
72
79 public: const std::string &AbsoluteParentName() const;
80
83 public: void SetAbsoluteParentName(const std::string &_absoluteparentname);
84
91 public: const std::optional<std::string> &LocalModelName() const;
92
96 public: void SetLocalModelName(const std::string &_localModelName);
97
102 public: const std::optional<bool> &IsStatic() const;
103
106 public: void SetIsStatic(bool _isStatic);
107
111 public: const std::optional<gz::math::Pose3d> &IncludeRawPose() const;
112
115 public: void SetIncludeRawPose(const gz::math::Pose3d &_includeRawPose);
116
122 public: const std::optional<std::string> &IncludePoseRelativeTo() const;
123
127 const std::string &_includePoseRelativeTo);
128
133 public: const std::optional<std::string> &PlacementFrame() const;
134
137 public: void SetPlacementFrame(const std::string &_placementFrame);
138
143
146 public: void SetIncludeElement(sdf::ElementPtr _includeElement);
147
148
152 public: void SetIsMerge(bool _isMerge);
153
157 public: const std::optional<bool> &IsMerge() const;
158
160 GZ_UTILS_IMPL_PTR(dataPtr)
161};
162#ifdef _MSC_VER
163#pragma warning(pop)
164#endif
165
200 std::function<sdf::InterfaceModelPtr(const sdf::NestedInclude &, Errors &)>;
201}
202}
203
204#endif
Contains the necessary information about an included model file for custom model parsers to be able t...
Definition InterfaceElements.hh:48
const std::string & ResolvedFileName() const
Provides the resolved absolute file path from the URI.
void SetPlacementFrame(const std::string &_placementFrame)
Set the placement frame.
void SetUri(const std::string &_uri)
Set the URI of the included model.
const std::string & Uri() const
Provides the URI as specified in //include/uri.
void SetAbsoluteParentName(const std::string &_absoluteparentname)
Set the absolute name of parent entity.
void SetIncludePoseRelativeTo(const std::string &_includePoseRelativeTo)
Set the relative-to frame of the pose.
void SetIncludeElement(sdf::ElementPtr _includeElement)
Set the //include element.
const std::optional< gz::math::Pose3d > & IncludeRawPose() const
The raw pose as specified in //include/pose.
const std::optional< bool > & IsMerge() const
Whether the interface model is to be merge-included.
const std::optional< std::string > & IncludePoseRelativeTo() const
The relative-to frame of the pose as specified in //include/pose/@relative_to.
void SetIncludeRawPose(const gz::math::Pose3d &_includeRawPose)
Set the raw pose as specified in //include/pose.
const std::optional< std::string > & PlacementFrame() const
The placement frame as specified in //include/placement_frame.
void SetResolvedFileName(const std::string &_resolvedFileName)
Set the resolved absolute file path.
const std::string & AbsoluteParentName() const
Name of the parent entity in absolute hierarchy.
void SetIsMerge(bool _isMerge)
Set whether the interface model is to be merge-included (i.e set the value of //include/[@merge])
void SetIsStatic(bool _isStatic)
Set whether the model is static.
sdf::ElementPtr IncludeElement() const
This is the //include element.
const std::optional< std::string > & LocalModelName() const
Name relative to immediate parent as specified in //include/name.
void SetLocalModelName(const std::string &_localModelName)
Set the name relative to immediate parent as specified in //include/name
const std::optional< bool > & IsStatic() const
Whether the model is static as defined by //include/static.
std::function< sdf::InterfaceModelPtr(const sdf::NestedInclude &, Errors &)> CustomModelParser
Defines a custom model parser.
Definition InterfaceElements.hh:200
std::shared_ptr< InterfaceModel > InterfaceModelPtr
Definition InterfaceModel.hh:50
std::vector< Error > Errors
A vector of Error.
Definition Types.hh:80
std::shared_ptr< Element > ElementPtr
Definition Element.hh:55
namespace for Simulation Description Format parser
Definition Actor.hh:35
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition system_util.hh:25