parser.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 SDF_PARSER_HH_
18 #define SDF_PARSER_HH_
19 
20 #include <string>
21 
22 #include "sdf/SDFImpl.hh"
23 #include "sdf/sdf_config.h"
24 #include "sdf/system_util.hh"
25 
36 namespace sdf
37 {
38  // Inline bracket to help doxygen filtering.
39  inline namespace SDF_VERSION_NAMESPACE {
40  //
41  class Root;
42 
45  bool init(SDFPtr _sdf);
46 
49  bool initFile(const std::string &_filename, SDFPtr _sdf);
50 
53  bool initFile(const std::string &_filename, ElementPtr _sdf);
54 
57  bool initString(const std::string &_xmlString, SDFPtr _sdf);
58 
67  sdf::SDFPtr readFile(const std::string &_filename);
68 
78  sdf::SDFPtr readFile(const std::string &_filename, Errors &_errors);
79 
90  bool readFile(const std::string &_filename, SDFPtr _sdf, Errors &_errors);
91 
105  const std::string &_filename, SDFPtr _sdf, Errors &_errors);
106 
116  bool readFile(const std::string &_filename, SDFPtr _sdf);
117 
128  bool readString(const std::string &_xmlString, SDFPtr _sdf, Errors &_errors);
129 
139  bool readString(const std::string &_xmlString, SDFPtr _sdf);
140 
151  bool readString(const std::string &_xmlString, ElementPtr _sdf,
152  Errors &_errors);
153 
167  const std::string &_xmlString, SDFPtr _sdf, Errors &_errors);
168 
178  bool readString(const std::string &_xmlString, ElementPtr _sdf);
179 
186  std::string getModelFilePath(const std::string &_modelDirPath);
187 
198  void addNestedModel(ElementPtr _sdf, ElementPtr _includeSDF);
199 
211  void addNestedModel(ElementPtr _sdf, ElementPtr _includeSDF, Errors &_errors);
212 
219  bool convertFile(const std::string &_filename, const std::string &_version,
220  SDFPtr _sdf);
221 
228  bool convertString(const std::string &_sdfString,
229  const std::string &_version, SDFPtr _sdf);
230 
239  bool checkCanonicalLinkNames(const sdf::Root *_root);
240 
250  bool checkFrameAttachedToGraph(const sdf::Root *_root);
251 
261  bool checkFrameAttachedToNames(const sdf::Root *_root);
262 
271  bool checkJointParentChildLinkNames(const sdf::Root *_root);
272 
282  bool checkPoseRelativeToGraph(const sdf::Root *_root);
283 
292 
301 
309  }
310 }
311 #endif
sdf::v9::recursiveSiblingUniqueNames
SDFORMAT_VISIBLE bool recursiveSiblingUniqueNames(sdf::ElementPtr _elem)
Check that all sibling elements of the any type have unique names.
sdf::v9::readStringWithoutConversion
SDFORMAT_VISIBLE bool readStringWithoutConversion(const std::string &_xmlString, SDFPtr _sdf, Errors &_errors)
Populate the SDF values from a string without converting to the latest SDF version.
sdf::v9::initString
SDFORMAT_VISIBLE bool initString(const std::string &_xmlString, SDFPtr _sdf)
Initialize the SDF interface using a string.
sdf::v9::readFile
SDFORMAT_VISIBLE sdf::SDFPtr readFile(const std::string &_filename)
Populate the SDF values from a file.
sdf::v9::initFile
SDFORMAT_VISIBLE bool initFile(const std::string &_filename, SDFPtr _sdf)
Initialize the SDF interface using a file.
sdf::v9::SDFPtr
std::shared_ptr< SDF > SDFPtr
Definition: SDFImpl.hh:50
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:32
sdf::v9::recursiveSameTypeUniqueNames
SDFORMAT_VISIBLE bool recursiveSameTypeUniqueNames(sdf::ElementPtr _elem)
Check that all sibling elements of the same type have unique names.
sdf::v9::convertFile
SDFORMAT_VISIBLE bool convertFile(const std::string &_filename, const std::string &_version, SDFPtr _sdf)
Convert an SDF file to a specific SDF version.
sdf::v9::checkFrameAttachedToGraph
SDFORMAT_VISIBLE bool checkFrameAttachedToGraph(const sdf::Root *_root)
For the world and each model, check that the attached_to graphs build without errors and have no cycl...
sdf::v9::checkFrameAttachedToNames
SDFORMAT_VISIBLE bool checkFrameAttachedToNames(const sdf::Root *_root)
Check that for each frame, the attached_to attribute value does not match its own frame name but does...
sdf::v9::readFileWithoutConversion
SDFORMAT_VISIBLE bool readFileWithoutConversion(const std::string &_filename, SDFPtr _sdf, Errors &_errors)
Populate the SDF values from a file without converting to the latest SDF version.
sdf::v9::readString
SDFORMAT_VISIBLE bool readString(const std::string &_xmlString, SDFPtr _sdf, Errors &_errors)
Populate the SDF values from a string.
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::addNestedModel
SDFORMAT_VISIBLE void addNestedModel(ElementPtr _sdf, ElementPtr _includeSDF)
Copy the contents of the first model element from one ElementPtr to another ElementPtr,...
sdf::v9::checkJointParentChildLinkNames
SDFORMAT_VISIBLE bool checkJointParentChildLinkNames(const sdf::Root *_root)
Check that all joints in contained models specify parent and child link names that match the names of...
sdf::v9::convertString
SDFORMAT_VISIBLE bool convertString(const std::string &_sdfString, const std::string &_version, SDFPtr _sdf)
Convert an SDF string to a specific SDF version.
sdf::v9::checkCanonicalLinkNames
SDFORMAT_VISIBLE bool checkCanonicalLinkNames(const sdf::Root *_root)
Check that for each model, the canonical_link attribute value matches the name of a link in the model...
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::getModelFilePath
SDFORMAT_VISIBLE std::string getModelFilePath(const std::string &_modelDirPath)
Get the file path to the model file.
sdf::v9::checkPoseRelativeToGraph
SDFORMAT_VISIBLE bool checkPoseRelativeToGraph(const sdf::Root *_root)
For the world and each model, check that the attached_to graphs build without errors and have no cycl...
sdf::v9::init
SDFORMAT_VISIBLE bool init(SDFPtr _sdf)
Init based on the installed sdf_format.xml file.
system_util.hh
sdf::v9::shouldValidateElement
SDFORMAT_VISIBLE bool shouldValidateElement(sdf::ElementPtr _elem)
Check whether the element should be validated.