All Classes Namespaces Files Functions Variables Typedefs Friends Macros Groups Pages
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 <string>
21 #include <memory>
22 #include <functional>
23 
24 #include "sdf/Param.hh"
25 #include "sdf/Element.hh"
26 #include "sdf/system_util.hh"
27 
29 #ifndef _WIN32
30 #pragma GCC diagnostic push
31 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
32 #endif
33 #include "sdf/Types.hh"
34 #ifndef _WIN32
35 #pragma GCC diagnostic pop
36 #endif
37 
40 namespace sdf
41 {
43 
46  typedef std::shared_ptr<SDF> SDFPtr;
47 
50 
58  std::string findFile(const std::string &_filename,
59  bool _searchLocalPath = true,
60  bool _useCallback = false);
61 
67  void addURIPath(const std::string &_uri, const std::string &_path);
68 
74  void setFindCallback(std::function<std::string (const std::string &)> _cb);
75 
78  {
79  public: SDF();
81  public: ~SDF();
82  public: void PrintDescription();
83  public: void PrintValues();
84  public: void PrintWiki();
85  public: void PrintDoc();
86  public: void Write(const std::string &_filename);
87  public: std::string ToString() const;
88 
90  public: void SetFromString(const std::string &_sdfData);
91 
94  public: ElementPtr Root() const;
95 
98  public: void Root(const ElementPtr _root);
99 
102  public: static std::string Version();
103 
106  public: static void Version(const std::string &_version);
107 
108 // \todo Remove this warning push/pop after sdformat 4.0
109 #ifdef _MSC_VER
110 #pragma warning(push)
111 #pragma warning(disable : 4251)
112 #endif
113 
117  public: ElementPtr root SDF_DEPRECATED(4.0);
118 
122  public: static std::string version SDF_DEPRECATED(4.0);
123 
124 #ifdef _MSC_VER
125 #pragma warning(pop)
126 #endif
127  };
129 }
130 #endif
Base SDF class.
Definition: SDFImpl.hh:77
std::shared_ptr< SDF > SDFPtr
Definition: SDFImpl.hh:46
class SDFORMAT_VISIBLE SDF
Definition: SDFImpl.hh:42
SDFORMAT_VISIBLE std::string findFile(const std::string &_filename, bool _searchLocalPath=true, bool _useCallback=false)
Find the absolute path of a file.
#define SDFORMAT_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system_util.hh:48
SDFORMAT_VISIBLE void addURIPath(const std::string &_uri, const std::string &_path)
Associate paths to a URI.
SDFORMAT_VISIBLE void setFindCallback(std::function< std::string(const std::string &)> _cb)
Set the callback to use when SDF can't find a file.
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:53
#define SDF_DEPRECATED(version)
Definition: Types.hh:36