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 
22 #include "sdf/SDFImpl.hh"
23 #include "sdf/Types.hh"
24 #include "sdf/sdf_config.h"
25 #include "sdf/system_util.hh"
26 
27 namespace sdf
28 {
29  // Inline bracket to help doxygen filtering.
30  inline namespace SDF_VERSION_NAMESPACE {
31  //
32 
33  // Forward declarations.
34  class Light;
35  class Model;
36  class RootPrivate;
37  class World;
38 
54  {
56  public: Root();
57 
59  public: ~Root();
60 
66  public: Errors Load(const std::string &_filename);
67 
73  public: Errors LoadSdfString(const std::string &_sdf);
74 
80  public: Errors Load(const SDFPtr _sdf);
81 
86  public: std::string Version() const;
87 
91  public: void SetVersion(const std::string &_version);
92 
95  public: uint64_t WorldCount() const;
96 
102  public: const World *WorldByIndex(const uint64_t _index) const;
103 
107  public: bool WorldNameExists(const std::string &_name) const;
108 
111  public: uint64_t ModelCount() const;
112 
118  public: const Model *ModelByIndex(const uint64_t _index) const;
119 
123  public: bool ModelNameExists(const std::string &_name) const;
124 
127  public: uint64_t LightCount() const;
128 
134  public: const Light *LightByIndex(const uint64_t _index) const;
135 
139  public: bool LightNameExists(const std::string &_name) const;
140 
145  public: sdf::ElementPtr Element() const;
146 
148  private: RootPrivate *dataPtr = nullptr;
149  };
150  }
151 }
152 #endif
Provides a description of a light source.
Definition: Light.hh:59
class SDFORMAT_VISIBLE Element
Definition: Element.hh:47
Definition: World.hh:43
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:51
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:74
Root class that acts as an entry point to the SDF document model.
Definition: Root.hh:53
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:48
std::shared_ptr< SDF > SDFPtr
Definition: SDFImpl.hh:50
namespace for Simulation Description Format parser
Definition: AirPressure.hh:25
Definition: Model.hh:38