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 
47  bool init(SDFPtr _sdf);
48 
54  bool initFile(const std::string &_filename, SDFPtr _sdf);
55 
62  bool initFile(
63  const std::string &_filename, const ParserConfig &_config, SDFPtr _sdf);
64 
70  bool initFile(const std::string &_filename, ElementPtr _sdf);
71 
78  bool initFile(const std::string &_filename, const ParserConfig &_config,
79  ElementPtr _sdf);
80 
86  bool initString(const std::string &_xmlString, SDFPtr _sdf);
87 
94  bool initString(
95  const std::string &_xmlString, const ParserConfig &_config, SDFPtr _sdf);
96 
105  sdf::SDFPtr readFile(const std::string &_filename);
106 
116  sdf::SDFPtr readFile(const std::string &_filename, Errors &_errors);
117 
128  sdf::SDFPtr readFile(const std::string &_filename,
129  const ParserConfig &_config, Errors &_errors);
130 
141  bool readFile(const std::string &_filename, SDFPtr _sdf, Errors &_errors);
142 
154  bool readFile(const std::string &_filename, const ParserConfig &_config,
155  SDFPtr _sdf, Errors &_errors);
156 
170  const std::string &_filename, SDFPtr _sdf, Errors &_errors);
171 
185  bool readFileWithoutConversion(const std::string &_filename,
186  const ParserConfig &_config, SDFPtr _sdf, Errors &_errors);
187 
197  bool readFile(const std::string &_filename, SDFPtr _sdf);
198 
209  bool readString(const std::string &_xmlString, SDFPtr _sdf, Errors &_errors);
210 
222  bool readString(const std::string &_xmlString, const ParserConfig &_config,
223  SDFPtr _sdf, Errors &_errors);
224 
234  bool readString(const std::string &_xmlString, SDFPtr _sdf);
235 
246  bool readString(const std::string &_xmlString, ElementPtr _sdf,
247  Errors &_errors);
248 
260  bool readString(const std::string &_xmlString, const ParserConfig &_config,
261  ElementPtr _sdf, Errors &_errors);
262 
276  const std::string &_xmlString, SDFPtr _sdf, Errors &_errors);
277 
289  bool readStringWithoutConversion(const std::string &_xmlString,
290  const ParserConfig &_config, SDFPtr _sdf, Errors &_errors);
291 
301  bool readString(const std::string &_xmlString, ElementPtr _sdf);
302 
309  std::string getModelFilePath(const std::string &_modelDirPath);
310 
317  bool convertFile(const std::string &_filename, const std::string &_version,
318  SDFPtr _sdf);
319 
327  bool convertFile(const std::string &_filename, const std::string &_version,
328  const ParserConfig &_config, SDFPtr _sdf);
329 
336  bool convertString(const std::string &_sdfString,
337  const std::string &_version, SDFPtr _sdf);
338 
346  bool convertString(const std::string &_sdfString, const std::string &_version,
347  const ParserConfig &_config, SDFPtr _sdf);
348 
357  bool checkCanonicalLinkNames(const sdf::Root *_root);
358 
368  bool checkFrameAttachedToGraph(const sdf::Root *_root);
369 
379  bool checkFrameAttachedToNames(const sdf::Root *_root);
380 
389  bool checkJointParentChildLinkNames(const sdf::Root *_root);
390 
400  bool checkPoseRelativeToGraph(const sdf::Root *_root);
401 
410 
419 
429 
437  }
438 }
439 #endif
sdf::v12::readStringWithoutConversion
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::v12::checkCanonicalLinkNames
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::v12::convertFile
bool convertFile(const std::string &_filename, const std::string &_version, SDFPtr _sdf)
Convert an SDF file to a specific SDF version.
sdf::v12::shouldValidateElement
bool shouldValidateElement(sdf::ElementPtr _elem)
Check whether the element should be validated.
sdf
namespace for Simulation Description Format parser
Definition: Actor.hh:33
sdf::v12::getModelFilePath
std::string getModelFilePath(const std::string &_modelDirPath)
Get the file path to the model file.
sdf::v12::recursiveSameTypeUniqueNames
bool recursiveSameTypeUniqueNames(sdf::ElementPtr _elem)
Check that all sibling elements of the same type have unique names.
sdf::v12::Errors
std::vector< Error > Errors
A vector of Error.
Definition: Types.hh:106
sdf::v12::initFile
bool initFile(const std::string &_filename, SDFPtr _sdf)
Initialize the SDF interface using a file.
sdf::v12::readFileWithoutConversion
bool readFileWithoutConversion(const std::string &_filename, SDFPtr _sdf, Errors &_errors)
Populate the SDF values from a file without converting to the latest SDF version.
SDFORMAT_VISIBLE
#define SDFORMAT_VISIBLE
Definition: system_util.hh:41
sdf::v12::SDFPtr
std::shared_ptr< SDF > SDFPtr
Definition: SDFImpl.hh:52
sdf::v12::checkFrameAttachedToGraph
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::v12::init
bool init(SDFPtr _sdf)
Initialize the SDF interface from the embedded root spec file.
sdf::v12::initString
bool initString(const std::string &_xmlString, SDFPtr _sdf)
Initialize the SDF interface using a string.
sdf::v12::Root
Root class that acts as an entry point to the SDF document model.
Definition: Root.hh:54
sdf::v12::checkFrameAttachedToNames
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...
SDFImpl.hh
sdf::v12::checkPoseRelativeToGraph
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::v12::recursiveSiblingNoDoubleColonInNames
bool recursiveSiblingNoDoubleColonInNames(sdf::ElementPtr _elem)
Check that all sibling elements do not contain the delimiter double colons '::' in element names,...
sdf::v12::checkJointParentChildLinkNames
bool checkJointParentChildLinkNames(const sdf::Root *_root)
Check that all joints in contained models specify parent and child link names that match the names of...
system_util.hh
sdf::v12::readString
bool readString(const std::string &_xmlString, SDFPtr _sdf, Errors &_errors)
Populate the SDF values from a string.
sdf::v12::ElementPtr
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:54
sdf::v12::recursiveSiblingUniqueNames
bool recursiveSiblingUniqueNames(sdf::ElementPtr _elem)
Check that all sibling elements of the any type have unique names.
sdf::v12::readFile
sdf::SDFPtr readFile(const std::string &_filename)
Populate the SDF values from a file.
sdf::v12::convertString
bool convertString(const std::string &_sdfString, const std::string &_version, SDFPtr _sdf)
Convert an SDF string to a specific SDF version.