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 <string>
21#include <memory>
22
23#include <ignition/math/Pose3.hh>
24#include <ignition/utils/ImplPtr.hh>
25
26#include "sdf/Element.hh"
27#include "sdf/InterfaceModel.hh"
28#include "sdf/Types.hh"
29
30#include "sdf/sdf_config.h"
31#include "sdf/system_util.hh"
32
33namespace sdf
34{
35inline namespace SDF_VERSION_NAMESPACE
36{
37#ifdef _WIN32
38// Disable warning C4251 which is triggered by std::string
39#pragma warning(push)
40#pragma warning(disable: 4251)
41#endif
45{
47 public: NestedInclude();
48 // Defaulted copy, move constructors and destructors are needed to avoid
49 // deprecation warnings on memeber variables when simply instantiating this
50 // class.
51 // TODO(anyone) Remove the constructor and destructor once the deprecated
52 // members are removed.
54 public: NestedInclude(const NestedInclude&) = default;
55 public: NestedInclude(NestedInclude&&) = default;
56 public: NestedInclude& operator=(const NestedInclude&) = default;
57 public: NestedInclude& operator=(NestedInclude&&) = default;
58 public: ~NestedInclude() = default;
60
65 public: const std::string &Uri() const;
66
69 public: void SetUri(const std::string &_uri);
70
76 public: const std::string &ResolvedFileName() const;
77
80 public: void SetResolvedFileName(const std::string &_resolvedFileName);
81
88 public: const std::string &AbsoluteParentName() const;
89
92 public: void SetAbsoluteParentName(const std::string &_absoluteparentname);
93
100 public: const std::optional<std::string> &LocalModelName() const;
101
105 public: void SetLocalModelName(const std::string &_localModelName);
106
111 public: const std::optional<bool> &IsStatic() const;
112
115 public: void SetIsStatic(bool _isStatic);
116
120 public: const std::optional<ignition::math::Pose3d> &IncludeRawPose() const;
121
124 public: void SetIncludeRawPose(const ignition::math::Pose3d &_includeRawPose);
125
131 public: const std::optional<std::string> &IncludePoseRelativeTo() const;
132
136 const std::string &_includePoseRelativeTo);
137
142 public: const std::optional<std::string> &PlacementFrame() const;
143
146 public: void SetPlacementFrame(const std::string &_placementFrame);
147
152
155 public: void SetIncludeElement(sdf::ElementPtr _includeElement);
156
161 public: std::string uri SDF_DEPRECATED(12);
162
168 public: std::string resolvedFileName SDF_DEPRECATED(12);
169
176 public: std::string absoluteParentName SDF_DEPRECATED(12);
177
184 public: std::optional<std::string> localModelName SDF_DEPRECATED(12);
185
189 public: std::optional<bool> isStatic SDF_DEPRECATED(12);
190
194 public: std::optional<ignition::math::Pose3d> includeRawPose
195 SDF_DEPRECATED(12);
196
201 public: std::optional<std::string> includePoseRelativeTo SDF_DEPRECATED(12);
202
206 public: std::optional<std::string> placementFrame SDF_DEPRECATED(12);
207
211 public: sdf::ElementPtr includeElement SDF_DEPRECATED(12);
212
214 IGN_UTILS_IMPL_PTR(dataPtr)
215};
216#ifdef _MSC_VER
217#pragma warning(pop)
218#endif
219
254 std::function<sdf::InterfaceModelPtr(const sdf::NestedInclude &, Errors &)>;
255}
256}
257
258#endif
#define SDF_DEPRECATED(version)
Definition Types.hh:39
#define SDF_SUPPRESS_DEPRECATED_END
Definition Types.hh:55
#define SDF_SUPPRESS_DEPRECATED_BEGIN
Definition Types.hh:54
Contains the necessary information about an included model file for custom model parsers to be able t...
Definition InterfaceElements.hh:45
sdf::ElementPtr IncludeElement() const
This is the //include element.
void SetIsStatic(bool _isStatic)
Set whether the model is static.
NestedInclude & operator=(NestedInclude &&)=default
void SetLocalModelName(const std::string &_localModelName)
Set the name relative to immediate parent as specified in //include/name
void SetIncludeElement(sdf::ElementPtr _includeElement)
Set the //include element.
const std::optional< ignition::math::Pose3d > & IncludeRawPose() const
The raw pose as specified in //include/pose.
NestedInclude & operator=(const NestedInclude &)=default
NestedInclude()
Constructor.
const std::optional< std::string > & PlacementFrame() const
The placement frame as specified in //include/placement_frame.
const std::optional< bool > & IsStatic() const
Whether the model is static as defined by //include/static.
void SetAbsoluteParentName(const std::string &_absoluteparentname)
Set the absolute name of parent entity.
const std::string & ResolvedFileName() const
Provides the resolved absolute file path from the URI.
void SetIncludeRawPose(const ignition::math::Pose3d &_includeRawPose)
Set the raw pose as specified in //include/pose.
void SetIncludePoseRelativeTo(const std::string &_includePoseRelativeTo)
Set the relative-to frame of the pose.
const std::optional< std::string > & LocalModelName() const
Name relative to immediate parent as specified in //include/name.
void SetUri(const std::string &_uri)
Set the URI of the included model.
NestedInclude(const NestedInclude &)=default
const std::optional< std::string > & IncludePoseRelativeTo() const
The relative-to frame of the pose as specified in //include/pose/@relative_to.
NestedInclude(NestedInclude &&)=default
const std::string & Uri() const
Provides the URI as specified in //include/uri.
void SetPlacementFrame(const std::string &_placementFrame)
Set the 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.
std::vector< Error > Errors
A vector of Error.
Definition Types.hh:106
std::function< sdf::InterfaceModelPtr(const sdf::NestedInclude &, Errors &)> CustomModelParser
Defines a custom model parser.
Definition InterfaceElements.hh:254
std::shared_ptr< Element > ElementPtr
Definition Element.hh:54
std::shared_ptr< InterfaceModel > InterfaceModelPtr
Definition InterfaceModel.hh:49
namespace for Simulation Description Format parser
Definition Actor.hh:34
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition system_util.hh:41