SDFImpl.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2012 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 SDFIMPL_HH_
18 #define SDFIMPL_HH_
19 
20 #include <functional>
21 #include <memory>
22 #include <string>
23 
24 #include "sdf/Param.hh"
25 #include "sdf/Element.hh"
26 #include "sdf/sdf_config.h"
27 #include "sdf/system_util.hh"
28 #include "sdf/Types.hh"
29 
30 #ifdef _WIN32
31 // Disable warning C4251 which is triggered by
32 // std::unique_ptr
33 #pragma warning(push)
34 #pragma warning(disable: 4251)
35 #endif
36 
39 namespace sdf
40 {
41  // Inline bracket to help doxygen filtering.
42  inline namespace SDF_VERSION_NAMESPACE {
43  //
44 
46  class SDFPrivate;
47 
50  typedef std::shared_ptr<SDF> SDFPtr;
51 
54 
63  std::string findFile(const std::string &_filename,
64  bool _searchLocalPath = true,
65  bool _useCallback = false);
66 
72  void addURIPath(const std::string &_uri, const std::string &_path);
73 
79  void setFindCallback(std::function<std::string (const std::string &)> _cb);
80 
81 
84  {
85  public: SDF();
87  public: ~SDF();
88  public: void PrintDescription();
89  public: void PrintValues();
90  public: void PrintDoc();
91  public: void Write(const std::string &_filename);
92  public: std::string ToString() const;
93 
95  public: void SetFromString(const std::string &_sdfData);
96 
99  public: ElementPtr Root() const;
100 
103  public: void Root(const ElementPtr _root);
104 
107  public: static std::string Version();
108 
111  public: static void Version(const std::string &_version);
112 
116  public: static ElementPtr WrapInRoot(const ElementPtr &_sdf);
117 
131  public: static const std::string &EmbeddedSpec(
132  const std::string &_filename, const bool _quiet);
133 
136  private: std::unique_ptr<SDFPrivate> dataPtr;
137 
140  private: static std::string version;
141  };
143  }
144 }
145 
146 #ifdef _WIN32
147 #pragma warning(pop)
148 #endif
149 
150 #endif
class SDFORMAT_VISIBLE SDF
Definition: SDFImpl.hh:45
SDFORMAT_VISIBLE void addURIPath(const std::string &_uri, const std::string &_path)
Associate paths to a URI.
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:51
Base SDF class.
Definition: SDFImpl.hh:83
SDFORMAT_VISIBLE void setFindCallback(std::function< std::string(const std::string &)> _cb)
Set the callback to use when SDF can&#39;t find a file.
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
SDFORMAT_VISIBLE std::string findFile(const std::string &_filename, bool _searchLocalPath=true, bool _useCallback=false)
Find the absolute path of a file.