Public Member Functions | Static Public Member Functions | List of all members
sdf::SDF_VERSION_NAMESPACE::OutputConfig Class Reference

This class contains configuration options for SDF output. More...

#include <OutputConfig.hh>

Public Member Functions

 OutputConfig ()
 Default constructor. More...
 
void SetToElementUseIncludeTag (bool _useIncludeTag)
 Several DOM classes have ToElement() methods that return an XML Element populated from the contents of the DOM object. More...
 
bool ToElementUseIncludeTag () const
 Get the policy value about whether tags are reconstituted in ToElement() invocations. More...
 

Static Public Member Functions

static OutputConfigGlobalConfig ()
 Mutable access to a singleton OutputConfig that serves as the global OutputConfig object for all parsing operations that do not specify their own OutputConfig. More...
 

Detailed Description

This class contains configuration options for SDF output.

Output configuration can be used to specify how SDF is generated from in-memory represenations, such as the DOM classes.

Example: The default behavior of the ToElement functions is to use <include> tags if the tags were present during load. You can choose not to use the <include> tags using the following snippet.

// Create an output config;
// Set the config so that include tags are not used.
// Use the new config when generating the SDFormat element.
sdf::Root root;
sdf::ElementPtr elem = root.ToElement(config);
// You can now output the element as a string.
std::cout << elem->ToString("") << std::endl;
This class contains configuration options for SDF output.
Definition: OutputConfig.hh:59
void SetToElementUseIncludeTag(bool _useIncludeTag)
Several DOM classes have ToElement() methods that return an XML Element populated from the contents o...
Root class that acts as an entry point to the SDF document model.
Definition: Root.hh:58
sdf::ElementPtr ToElement(const OutputConfig &_config=OutputConfig::GlobalConfig()) const
Create and return an SDF element filled with data from this root.
std::shared_ptr< Element > ElementPtr
Definition: Element.hh:55

Constructor & Destructor Documentation

◆ OutputConfig()

sdf::SDF_VERSION_NAMESPACE::OutputConfig::OutputConfig ( )

Default constructor.

Member Function Documentation

◆ GlobalConfig()

static OutputConfig& sdf::SDF_VERSION_NAMESPACE::OutputConfig::GlobalConfig ( )
static

Mutable access to a singleton OutputConfig that serves as the global OutputConfig object for all parsing operations that do not specify their own OutputConfig.

Returns
A mutable reference to the singleton OutputConfig object

◆ SetToElementUseIncludeTag()

void sdf::SDF_VERSION_NAMESPACE::OutputConfig::SetToElementUseIncludeTag ( bool  _useIncludeTag)

Several DOM classes have ToElement() methods that return an XML Element populated from the contents of the DOM object.

When populating the details of a model that was included using the tag, one may wish to retain the exact include tag and URI instead of copying the full details of the included model. This method lets you set this behavior.

Parameters
[in]_useIncludeTagWhen true, the model's URI is used to create an SDF <include> rather than a <model>. The model's URI must be first set using the Model::SetUri function. If the model's URI is empty, then a <model> element will be generated. The default is true so that URI values are used when ToElement is called from a World object. Make sure to use Model::SetUri even when the model is loaded from an <include> tag since the parser will automatically expand an <include> element to a <model> element.

◆ ToElementUseIncludeTag()

bool sdf::SDF_VERSION_NAMESPACE::OutputConfig::ToElementUseIncludeTag ( ) const

Get the policy value about whether tags are reconstituted in ToElement() invocations.

Returns
True if include tags are reconstituted, or false if the fully populated model is returned instead.

The documentation for this class was generated from the following file: