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
RaiSimTinyXmlWriterElement(const std::string &name)Parameters
| Parameter | Description |
|---|---|
name (in) | element name |
Public member functions
operator[]
RaiSimTinyXmlWriterElement &operator[](const std::string &element)Append a new child element (always a new one, even if the name exists).
Parameters
| Parameter | Description |
|---|---|
element (in) | child element name |
Returns the new child
setAttribute
RaiSimTinyXmlWriterElement &setAttribute(
const std::string &name,
int attribute)Parameters
| Parameter | Description |
|---|---|
name (in) | attribute name |
attribute (in) | value |
Returns this element, for chaining
RaiSimTinyXmlWriterElement &setAttribute(
const std::string &name,
unsigned long attribute)Parameters
| Parameter | Description |
|---|---|
name (in) | attribute name |
attribute (in) | value |
Returns this element, for chaining
RaiSimTinyXmlWriterElement &setAttribute(
const std::string &name,
unsigned long long attribute)The maximum value is written as "-1" (read back by RaiSimTinyXmlWrapper).
Parameters
| Parameter | Description |
|---|---|
name (in) | attribute name |
attribute (in) | value |
Returns this element, for chaining
RaiSimTinyXmlWriterElement &setAttribute(
const std::string &name,
const std::string &attribute)Parameters
| Parameter | Description |
|---|---|
name (in) | attribute name |
attribute (in) | value |
Returns this element, for chaining
RaiSimTinyXmlWriterElement &setAttribute(
const std::string &name,
double attribute)Parameters
| Parameter | Description |
|---|---|
name (in) | attribute name |
attribute (in) | value |
Returns this element, for chaining
RaiSimTinyXmlWriterElement &setAttribute(
const std::string &name,
float attribute)Parameters
| Parameter | Description |
|---|---|
name (in) | attribute name |
attribute (in) | value |
Returns this element, for chaining
RaiSimTinyXmlWriterElement &setAttribute(
const std::string &name,
const char *attribute)Parameters
| Parameter | Description |
|---|---|
name (in) | attribute name |
attribute (in) | value |
Returns this element, for chaining
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
| Parameter | Description |
|---|---|
name (in) | attribute name |
attribute (in) | value or container |
Returns this element, for chaining
setVectorAttribute
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
| Parameter | Description |
|---|---|
name (in) | attribute name |
attribute (in) | container |
size (in) | number of elements |
Returns this element, for chaining
link
void link()Internal: attaches the children to this element recursively (called by RaiSimTinyXmlWriter::saveFile()).
ptr
TiXmlElement *ptr()Returns the underlying TinyXML element