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/SDFImpl.hh"
24 #include "sdf/Types.hh"
25 #include "sdf/sdf_config.h"
26 #include "sdf/system_util.hh"
27 
28 namespace sdf
29 {
30  // Inline bracket to help doxygen filtering.
31  inline namespace SDF_VERSION_NAMESPACE {
32  //
33 
34  // Forward declarations.
35  class Actor;
36  class Light;
37  class Model;
38  class World;
39 
55  {
57  public: Root();
58 
64  public: Errors Load(const std::string &_filename);
65 
72  public: Errors Load(
73  const std::string &_filename, const ParserConfig &_config);
74 
80  public: Errors LoadSdfString(const std::string &_sdf);
81 
88  public: Errors LoadSdfString(
89  const std::string &_sdf, const ParserConfig &_config);
90 
96  public: Errors Load(const SDFPtr _sdf);
97 
104  public: Errors Load(const SDFPtr _sdf, const ParserConfig &_config);
105 
110  public: std::string Version() const;
111 
115  public: void SetVersion(const std::string &_version);
116 
119  public: uint64_t WorldCount() const;
120 
126  public: const World *WorldByIndex(const uint64_t _index) const;
127 
131  public: bool WorldNameExists(const std::string &_name) const;
132 
136  public: uint64_t ModelCount() const SDF_DEPRECATED(11.0);
137 
143  public: const sdf::Model *ModelByIndex(const uint64_t _index) const
144  SDF_DEPRECATED(11.0);
145 
149  public: bool ModelNameExists(const std::string &_name) const
150  SDF_DEPRECATED(11.0);
151 
161  public: const sdf::Model *Model() const;
162 
165  public: uint64_t LightCount() const SDF_DEPRECATED(11.0);
166 
172  public: const sdf::Light *LightByIndex(const uint64_t _index) const
173  SDF_DEPRECATED(11.0);
174 
178  public: bool LightNameExists(const std::string &_name) const
179  SDF_DEPRECATED(11.0);
180 
191  public: const sdf::Light *Light() const;
192 
195  public: uint64_t ActorCount() const SDF_DEPRECATED(11.0);
196 
202  public: const sdf::Actor *ActorByIndex(const uint64_t _index) const
203  SDF_DEPRECATED(11.0);
204 
208  public: bool ActorNameExists(const std::string &_name) const
209  SDF_DEPRECATED(11.0);
210 
221  public: const sdf::Actor *Actor() const;
222 
227  public: sdf::ElementPtr Element() const;
228 
230  IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr)
231  };
232  }
233 }
234 #endif
sdf::v11::World
Definition: World.hh:51
sdf::v11::Light
Provides a description of a light source.
Definition: Light.hh:63
sdf::v11::Actor
Provides a description of an actor.
Definition: Actor.hh:190
sdf::v11::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:33
sdf::v11::Model
Definition: Model.hh:48
SDF_DEPRECATED
#define SDF_DEPRECATED(version)
Definition: Types.hh:39
sdf::v11::ParserConfig
This class contains configuration options for the libsdformat parser.
Definition: ParserConfig.hh:84
Types.hh
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:41
sdf::v11::Root
Root class that acts as an entry point to the SDF document model.
Definition: Root.hh:54
sdf::v11::SDFPtr
std::shared_ptr< SDF > SDFPtr
Definition: SDFImpl.hh:51
SDFImpl.hh
system_util.hh
sdf::v11::Element
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49
sdf::v11::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:106