This class contains configuration options for the libsdformat parser.
More...
#include <ParserConfig.hh>
|
using | SchemeToPathMap = std::map< std::string, std::vector< std::string > > |
| type alias for the map from URI scheme to search directories More...
|
|
This class contains configuration options for the libsdformat parser.
The configuration options include:
- A callback function used to locate a file from a given URI
- A map from URI schemes to search directories
For backward compatibility, the functions sdf::setFindCallback() and sdf::addURIPath() update a singleton ParserConfig object, which can be retrieved by ParserConfig::GlobalConfig().
The functions sdf::readFile(), sdf::readString(), and sdf::Root::Load() have overloads that take a ParserConfig object. If the ParserConfig object is omitted, these functions will use the singleton ParserConfig object.
Example: To set an additional URI scheme search directory without affecting the global config,
config.
AddURIPath(
"newScheme://",
"path/to/directory");
root.
Load(
"path/to/file.sdf", config);
This class contains configuration options for the libsdformat parser.
Definition: ParserConfig.hh:100
void AddURIPath(const std::string &_uri, const std::string &_path)
Associate paths to a URI.
static ParserConfig & GlobalConfig()
Mutable access to a singleton ParserConfig that serves as the global ParserConfig object for all pars...
Root class that acts as an entry point to the SDF document model.
Definition: Root.hh:58
Errors Load(const std::string &_filename)
Parse the given SDF file, and generate objects based on types specified in the SDF file.
◆ SchemeToPathMap
type alias for the map from URI scheme to search directories
◆ ParserConfig()
sdf::SDF_VERSION_NAMESPACE::ParserConfig::ParserConfig |
( |
| ) |
|
◆ AddURIPath()
void sdf::SDF_VERSION_NAMESPACE::ParserConfig::AddURIPath |
( |
const std::string & |
_uri, |
|
|
const std::string & |
_path |
|
) |
| |
Associate paths to a URI.
Example paramters: "model://", "/usr/share/models:~/.gazebo/models"
- Parameters
-
[in] | _uri | URI that will be mapped to _path |
[in] | _path | Colon separated set of paths. |
- See also
- sdf::findFile() for the order of search operations
◆ CalculateInertialConfiguration()
Get the current configuration for the CalculateInertial() function.
- Returns
- Current set value of the ConfigureResolveAutoInertials enum
◆ CustomInertiaCalc()
Get the registered custom mesh MOI Calculator.
- Returns
- registered mesh MOI Calculator.
◆ CustomModelParsers()
const std::vector< CustomModelParser > & sdf::SDF_VERSION_NAMESPACE::ParserConfig::CustomModelParsers |
( |
| ) |
const |
Get the registered custom model parsers.
- Returns
- Vector of registered model parser callbacks.
◆ DeprecatedElementsPolicy()
EnforcementPolicy sdf::SDF_VERSION_NAMESPACE::ParserConfig::DeprecatedElementsPolicy |
( |
| ) |
const |
Get the current deprecated elements policy.
By default, the policy is the same as the overall WarningsPolicy, but it can be overriden by SetDeprecatedElementsPolicy. Once it is overriden, changing SetWarningsPolicy will not change the value of DeprecatedElementsPolicy unless ResetDeprecatedElementsPolicy is called.
- Returns
- The deperacted elements policy enum value
◆ FindFileCallback()
const std::function< std::string(const std::string &)> & sdf::SDF_VERSION_NAMESPACE::ParserConfig::FindFileCallback |
( |
| ) |
const |
Get the find file callback function.
- Returns
- Immutable reference to the find file callback function
◆ GlobalConfig()
static ParserConfig & sdf::SDF_VERSION_NAMESPACE::ParserConfig::GlobalConfig |
( |
| ) |
|
|
static |
◆ RegisterCustomInertiaCalc()
void sdf::SDF_VERSION_NAMESPACE::ParserConfig::RegisterCustomInertiaCalc |
( |
CustomInertiaCalculator |
_inertiaCalculator | ) |
|
Registers a custom Moment of Inertia Calculator for Meshes.
- Parameters
-
◆ RegisterCustomModelParser()
void sdf::SDF_VERSION_NAMESPACE::ParserConfig::RegisterCustomModelParser |
( |
CustomModelParser |
_modelParser | ) |
|
Registers a custom model parser.
- Parameters
-
◆ ResetDeprecatedElementsPolicy()
void sdf::SDF_VERSION_NAMESPACE::ParserConfig::ResetDeprecatedElementsPolicy |
( |
| ) |
|
Resets the policy for deprecated elements so that it follows WarningsPolicy.
◆ SetCalculateInertialConfiguration()
Set the configuration for the CalculateInertial() function.
- Parameters
-
[in] | _configuration | The configuration to set for the CalculateInertial() function |
◆ SetDeprecatedElementsPolicy()
void sdf::SDF_VERSION_NAMESPACE::ParserConfig::SetDeprecatedElementsPolicy |
( |
EnforcementPolicy |
_policy | ) |
|
Set the policy for deprecated elements.
- Parameters
-
[in] | _policy | The deprecated elements enforcement policy |
◆ SetFindCallback()
void sdf::SDF_VERSION_NAMESPACE::ParserConfig::SetFindCallback |
( |
std::function< std::string(const std::string &)> |
_cb | ) |
|
Set the callback to use when libsdformat can't find a file.
The callback should return a complete path to the requested file, or an empty string if the file was not found in the callback. Generally, the input argument is a URI or a file path (absolute or relative) obtained from a //include/uri
element. For example, if the value custom://model_name
is given in a //include/uri
, sdf::findFile() may invoke the callback with the argument custom://model_name
if it is unable to find a file using the steps listed in sdf::findfile().
Note, however, the input is not limited to URIs and file paths, and it is left up to the callback to interpret the contents of the input string.
- Parameters
-
[in] | _cb | The callback function. |
- See also
- sdf::findFile() for the order of search operations
◆ SetStoreResovledURIs()
void sdf::SDF_VERSION_NAMESPACE::ParserConfig::SetStoreResovledURIs |
( |
bool |
_resolveURI | ) |
|
Set the storeResolvedURIs flag value.
- Parameters
-
[in] | _resolveURI | True to make the parser attempt to resolve any URIs found and store them. False to preserve original URIs |
The Parser will use the FindFileCallback provided to attempt to resolve URIs in the Mesh, Material, Heightmap, and Skybox DOM objects If the FindFileCallback provides a non-empty string, the URI will be stored in the DOM object, and the original (unresolved) URI will be stored in the underlying Element.
◆ SetUnrecognizedElementsPolicy()
void sdf::SDF_VERSION_NAMESPACE::ParserConfig::SetUnrecognizedElementsPolicy |
( |
EnforcementPolicy |
_policy | ) |
|
Set the policy for unrecogonized elements without an xmlns.
- Parameters
-
[in] | _policy | The unrecognized elements enforcement policy |
◆ SetWarningsPolicy()
void sdf::SDF_VERSION_NAMESPACE::ParserConfig::SetWarningsPolicy |
( |
EnforcementPolicy |
_policy | ) |
|
Set the warning enforcment policy.
- Parameters
-
[in] | _policy | policy enum value to set |
◆ StoreResolvedURIs()
bool sdf::SDF_VERSION_NAMESPACE::ParserConfig::StoreResolvedURIs |
( |
| ) |
const |
Get the storeResolvedURIs flag value.
- Returns
- True if the parser will attempt to resolve any URIs found and store them. False to preserve original URIs
◆ UnrecognizedElementsPolicy()
EnforcementPolicy sdf::SDF_VERSION_NAMESPACE::ParserConfig::UnrecognizedElementsPolicy |
( |
| ) |
const |
Get the current unrecognized elements policy.
- Returns
- The unrecognized elements policy enum value
◆ URDFPreserveFixedJoint()
bool sdf::SDF_VERSION_NAMESPACE::ParserConfig::URDFPreserveFixedJoint |
( |
| ) |
const |
Get the preserveFixedJoint flag value.
- Returns
- True to preserve fixed joints, false to reduce the fixed joints and merge the child link into the parent.
◆ URDFSetPreserveFixedJoint()
void sdf::SDF_VERSION_NAMESPACE::ParserConfig::URDFSetPreserveFixedJoint |
( |
bool |
_preserveFixedJoint | ) |
|
Set the preserveFixedJoint flag.
- Parameters
-
[in] | _preserveFixedJoint | True to preserve fixed joints, false to reduce the fixed joints and merge the child link into the parent. |
◆ URIPathMap()
const SchemeToPathMap & sdf::SDF_VERSION_NAMESPACE::ParserConfig::URIPathMap |
( |
| ) |
const |
Get the URI scheme to search directories map.
- Returns
- Immutable reference to the URI scheme to search directories map
◆ WarningsPolicy()
Get the current warning enforcement policy.
- Returns
- The warning enforcement policy enum value
The documentation for this class was generated from the following file: