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 Actor;
35  class Light;
36  class Model;
37  class RootPrivate;
38  class World;
39 
55  {
57  public: Root();
58 
60  public: ~Root();
61 
67  public: Errors Load(const std::string &_filename);
68 
74  public: Errors LoadSdfString(const std::string &_sdf);
75 
81  public: Errors Load(const SDFPtr _sdf);
82 
87  public: std::string Version() const;
88 
92  public: void SetVersion(const std::string &_version);
93 
96  public: uint64_t WorldCount() const;
97 
103  public: const World *WorldByIndex(const uint64_t _index) const;
104 
108  public: bool WorldNameExists(const std::string &_name) const;
109 
112  public: uint64_t ModelCount() const;
113 
119  public: const Model *ModelByIndex(const uint64_t _index) const;
120 
124  public: bool ModelNameExists(const std::string &_name) const;
125 
128  public: uint64_t LightCount() const;
129 
135  public: const Light *LightByIndex(const uint64_t _index) const;
136 
140  public: bool LightNameExists(const std::string &_name) const;
141 
144  public: uint64_t ActorCount() const;
145 
151  public: const Actor *ActorByIndex(const uint64_t _index) const;
152 
156  public: bool ActorNameExists(const std::string &_name) const;
157 
162  public: sdf::ElementPtr Element() const;
163 
165  private: RootPrivate *dataPtr = nullptr;
166  };
167  }
168 }
169 #endif
sdf::v9::SDFPtr
std::shared_ptr< SDF > SDFPtr
Definition: SDFImpl.hh:50
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:32
Types.hh
sdf::v9::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:89
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:48
sdf::v9::World
Definition: World.hh:45
sdf::v9::Light
Provides a description of a light source.
Definition: Light.hh:62
sdf::v9::Root
Root class that acts as an entry point to the SDF document model.
Definition: Root.hh:54
SDFImpl.hh
sdf::v9::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
sdf::v9::Actor
Provides a description of an actor.
Definition: Actor.hh:277
sdf::v9::Model
Definition: Model.hh:43
system_util.hh
sdf::v9::Element
class SDFORMAT_VISIBLE Element
Definition: Element.hh:49