Skip to content

raisim::RaiSimTinyXmlWriterElement ​

class · #include <raisim/RaiSimTinyXmlWriter.hpp>

Builder for one element of an XML document written by RaiSimTinyXmlWriter (used by World::exportToXml()). Children are stored by value: a reference returned by operator[] can be invalidated when more children are added to the same parent (storage for 20 children is reserved up front). Numbers are written in the classic locale with max_digits10 precision.

Constructors & destructor ​

RaiSimTinyXmlWriterElement ​

cpp
RaiSimTinyXmlWriterElement(const std::string &name)

Parameters

ParameterDescription
name (in)element name

Public member functions ​

operator[] ​

cpp
RaiSimTinyXmlWriterElement &operator[](const std::string &element)

Append a new child element (always a new one, even if the name exists).

Parameters

ParameterDescription
element (in)child element name

Returns the new child

setAttribute ​

cpp
RaiSimTinyXmlWriterElement &setAttribute(
    const std::string &name,
    int attribute)

Parameters

ParameterDescription
name (in)attribute name
attribute (in)value

Returns this element, for chaining

cpp
RaiSimTinyXmlWriterElement &setAttribute(
    const std::string &name,
    unsigned long attribute)

Parameters

ParameterDescription
name (in)attribute name
attribute (in)value

Returns this element, for chaining

cpp
RaiSimTinyXmlWriterElement &setAttribute(
    const std::string &name,
    unsigned long long attribute)

The maximum value is written as "-1" (read back by RaiSimTinyXmlWrapper).

Parameters

ParameterDescription
name (in)attribute name
attribute (in)value

Returns this element, for chaining

cpp
RaiSimTinyXmlWriterElement &setAttribute(
    const std::string &name,
    const std::string &attribute)

Parameters

ParameterDescription
name (in)attribute name
attribute (in)value

Returns this element, for chaining

cpp
RaiSimTinyXmlWriterElement &setAttribute(
    const std::string &name,
    double attribute)

Parameters

ParameterDescription
name (in)attribute name
attribute (in)value

Returns this element, for chaining

cpp
RaiSimTinyXmlWriterElement &setAttribute(
    const std::string &name,
    float attribute)

Parameters

ParameterDescription
name (in)attribute name
attribute (in)value

Returns this element, for chaining

cpp
RaiSimTinyXmlWriterElement &setAttribute(
    const std::string &name,
    const char *attribute)

Parameters

ParameterDescription
name (in)attribute name
attribute (in)value

Returns this element, for chaining

cpp
template <typename T>
RaiSimTinyXmlWriterElement &setAttribute(
    const std::string &name,
    T attribute)

Write any other arithmetic value, or a container with size() and operator[] as a ", "-separated list.

Parameters

ParameterDescription
name (in)attribute name
attribute (in)value or container

Returns this element, for chaining

setVectorAttribute ​

cpp
template <typename T>
RaiSimTinyXmlWriterElement &setVectorAttribute(
    const std::string &name,
    T attribute,
    size_t size)

Write the first size elements of a container as a ", "-separated list. Fatal if the container is shorter.

Parameters

ParameterDescription
name (in)attribute name
attribute (in)container
size (in)number of elements

Returns this element, for chaining

cpp
void link()

Internal: attaches the children to this element recursively (called by RaiSimTinyXmlWriter::saveFile()).

ptr ​

cpp
TiXmlElement *ptr()

Returns the underlying TinyXML element

RaiSim — physics for robotics and AI.