The XML Documentation of a Module

In this tutorial we show how to write the XML documentation of an iCub module.


The convenience of providing the documentation of an iCub module in the XML format is twofold: (1) it standardizes the way we declare relevant information for the module (arguments, dependencies ...) and serves thus to automatically generate the Doxygen documentation; (2) the XML file accompanying the module is indeed the description file itself used by the yarpmanager.


The XML file should start with the following lines that contain the instructions on how to produce the Doxygen documentation from the XML itself:

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="yarpmanifest.xsl"?>

The description is all contained within the module section:


General Information on the Module

A bunch of dedicated key account for describing general information on the module as in the following:

<!-- <name> should match the executable file's name -->
<!-- <doxygen-group> accounts for the "@ingroup" Doxygen key,
to declare <name> as a Doxygen tag belonging to the specified group -->
<description>Example to show idl usage.</description>
<copypolicy>Released under the terms of the GNU GPL v2.0</copypolicy>
Implements a trivial server that provides access to an integer.
You can use html, for example to add a link to <a href=""> the yarp page</a> and Doxygen tags.
@subsection sec-intro Introduction
This is the introduction. 123
@subsection sec-details More stuff
This is a detailed description, etc.
<!-- <authors> can have multiple <author> tags. -->
<author email=""> Lorenzo Natale</author>


Here comes the arguments section that lists down all the command-line parameters of the module:

<!-- <arguments> can have multiple <param> tags -->
<param default = "rpcIdl" desc="name of the module"> name </param>
<param default = "" desc="configuration file name"> from </param>
<param default = "" desc="select the current context"> context </param>


The data section contains information on the input and output ports of the module:

<!-- <data> can have multiple <input> or <output> tags. -->
<!-- input data if available-->
<!-- <type> refers to nominal type of data (e.g. ImageFrame, String). -->
<!-- input port which receive images. -->
<port carrier="tcp">/rpcIdl/img:i</port>
<!-- required input means the execution of module depends on
this input data. Notice that not all the input are required
for a module to perform its task (e.g. control input, status
request input). -->
<!-- priority forces the execution of module to be delayed
until the required data becomes available on the port -->
<description>Feed images to rpcIdl using this port.</description>
<output type="service">
<port carrier="udp">/rpcIdl/img:o</port>
<description>Output image.</description>
<port carrier="udp">/rpcIdl/target:o</port>
Outputs the x-y location of whatever is the output of the module:
- int i value of y
- int j value of x


The services section describes the Thrift services exposed by the module according to the Interface Description Language rules contained in the rpcIdl.thrift file:

<description>Command port</description>
<description>Control remote object</description>


In the final sections dependencies and development we find further lists containing useful information to run the module.

<!-- physical and logical resource dependencies can be introduced in this
section. Dependencies must follow resource conceptional models. Currently
available resource models are 'memory', 'processor', 'storage', 'network',
'yarp_port', 'platform' and 'gpu'. All resource dependencies should be introduced
inside <computer></computer> tags. While resources described inside <computer>
tags represent conjunctional dependency, resources from different <computer>
tags can be seen as disjunctions. Meaning that If a module depend on either
resource R1 or R2 they can be introduced inside two different <computer> tags.
Resource dependencies should be introduced if they are really required. For
example, if module's performance drops significantly in case of memory swapping,
a memory resource dependency can be introduced with the required memory space. -->
<!-- specific libraries or header files which are used for development -->


Concluding, once processed the final Doxygen documentation will look like as in rpcIdl.

To install the description file in the location where all the xml are supposed to be just rely on the following cmake directive: