Root.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2017 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_ROOT_HH_
18 #define SDF_ROOT_HH_
19 
20 #include <string>
21 #include <ignition/utils/ImplPtr.hh>
22 
23 #include "sdf/OutputConfig.hh"
24 #include "sdf/ParserConfig.hh"
25 #include "sdf/SDFImpl.hh"
26 #include "sdf/Types.hh"
27 #include "sdf/sdf_config.h"
28 #include "sdf/system_util.hh"
29 
30 namespace sdf
31 {
32  // Inline bracket to help doxygen filtering.
33  inline namespace SDF_VERSION_NAMESPACE {
34  //
35 
36  // Forward declarations.
37  class Actor;
38  class Light;
39  class Model;
40  class World;
41 
57  {
59  public: Root();
60 
66  public: Errors Load(const std::string &_filename);
67 
74  public: Errors Load(
75  const std::string &_filename, const ParserConfig &_config);
76 
82  public: Errors LoadSdfString(const std::string &_sdf);
83 
90  public: Errors LoadSdfString(
91  const std::string &_sdf, const ParserConfig &_config);
92 
98  public: Errors Load(const SDFPtr _sdf);
99 
106  public: Errors Load(const SDFPtr _sdf, const ParserConfig &_config);
107 
112  public: std::string Version() const;
113 
117  public: void SetVersion(const std::string &_version);
118 
121  public: uint64_t WorldCount() const;
122 
128  public: const World *WorldByIndex(const uint64_t _index) const;
129 
135  public: World *WorldByIndex(const uint64_t _index);
136 
140  public: bool WorldNameExists(const std::string &_name) const;
141 
145  public: const sdf::Model *Model() const;
146 
150  public: void SetModel(const sdf::Model &_model);
151 
155  public: const sdf::Light *Light() const;
156 
160  public: void SetLight(const sdf::Light &_light);
161 
165  public: const sdf::Actor *Actor() const;
166 
170  public: void SetActor(const sdf::Actor &_actor);
171 
176  public: sdf::ElementPtr Element() const;
177 
184  public: Errors AddWorld(const World &_world);
185 
187  public: void ClearWorlds();
188 
193  public: sdf::Root Clone() const;
194 
201  public: Errors UpdateGraphs();
202 
209  public: sdf::ElementPtr ToElement(
210  const OutputConfig &_config = OutputConfig::GlobalConfig()) const;
211 
213  IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr)
214  };
215  }
216 }
217 #endif
sdf::v12::World
Definition: World.hh:57
sdf::v12::ParserConfig
This class contains configuration options for the libsdformat parser.
Definition: ParserConfig.hh:84
sdf::v12::Actor
Provides a description of an actor.
Definition: Actor.hh:191
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:34
sdf::v12::Light
Provides a description of a light source.
Definition: Light.hh:63
sdf::v12::Model
Definition: Model.hh:54
sdf::v12::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:106
ParserConfig.hh
Types.hh
sdf_config.h
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:25
sdf::v12::Element
class IGNITION_SDFORMAT_VISIBLE Element
Definition: Element.hh:50
sdf::v12::SDFPtr
std::shared_ptr< SDF > SDFPtr
Definition: SDFImpl.hh:52
sdf::v12::Root
Root class that acts as an entry point to the SDF document model.
Definition: Root.hh:56
sdf::v12::OutputConfig
This class contains configuration options for SDF output.
Definition: OutputConfig.hh:58
SDFImpl.hh
OutputConfig.hh
system_util.hh
sdf::v12::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:54