Commit aed8d257 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Add doc for input/output objects (list)

parent 6a8e0244
......@@ -551,6 +551,90 @@ class MyComponent (Component):
</table>
</div>
<h3>add_input_object()</h3>
<p>Add a python object as input. The object is defined as a class inherited from object.</p>
<h4>Example</h4>
<p>Considering the following object:</p>
<pre class="pre-hl "><code class="python">
class MyObject(object):
def __init__(self, value):
self.value = value
def add_five(self):
self.value = self.value + 5
def multiply_by_ten(self):
self.value = self.value * 10
</code></pre>
<p>We define this object and give it as a component argument. Into the component, the input is defined
like that:</p>
<pre class="pre-hl "><code class="python">self.add_input_object("i_object", "The input object to add 5", default=i_object)
</code></pre>
<p>Note: the object is accessible only into a python function loaded from an "add_python_execution".</p>
<h4>Options</h4>
<p>There are two positional argument : <code>name</code> and <code>help</code>. All other options are keyword options. </p>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr style="white-space:nowrap">
<th>Name</th>
<th>Type</th>
<th>Required</th>
<th>Default value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td>string</td>
<td>true</td>
<td>None</td>
<td>The name of the parameter. The parameter value is accessible
within the workflow object through the attribute named <code>self.parameter_name</code>.</td>
</tr>
<tr>
<td>help</td>
<td>string</td>
<td>true</td>
<td>None</td>
<td>The parameter help message.</td>
</tr>
<tr>
<td>default</td>
<td>string</td>
<td>false</td>
<td>None</td>
<td>The default object.</td>
</tr>
<tr>
<td>required</td>
<td>boolean</td>
<td>false</td>
<td>false</td>
<td>Wether or not the parameter can be ommitted.</td>
</tr>
</tbody>
</table>
</div>
<h3>add_input_object_list()</h3>
<p>This method takes the same arguments as <code>add_input_object()</code>. However, adding this parameter,
the component can take a list of objects and the object attribut <code>self.parameter_name</code> will be
settled as a Python list.</p>
</div>
......@@ -950,6 +1034,111 @@ class MyComponent (Component):
</tbody>
</table>
</div>
<h3>add_output_object()</h3>
<h4>Example</h4>
<p>In the following example, an output named <code>o_object</code> is defined. The python function
defined for execution has to return a python object, which will be stored into this object.</p>
<pre class="pre-hl "><code class="python">self.add_output_object("o_object", "The output object")</code></pre>
<h4>Options</h4>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr style="white-space:nowrap">
<th>Name</th>
<th>Type</th>
<th>Required</th>
<th>Default value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td>string</td>
<td>true</td>
<td>None</td>
<td>The name of the output object.</td>
</tr>
</tbody>
<tbody>
<tr>
<td>help</td>
<td>string</td>
<td>true</td>
<td>None</td>
<td>The description of the object.</td>
</tr>
</tbody>
<tbody>
<tr>
<td>required</td>
<td>bool</td>
<td>false</td>
<td>false</td>
<td>Is required.</td>
</tr>
</tbody>
</table>
</div>
<h3>add_output_object_list()</h3>
<h4>Example</h4>
<p>In the following example, an output named <code>o_object</code> is defined. The python function defined
for execution has to return a list of python objects, with the exact numbers of items mentioned in the
argument <code>nb_items</code> (2 in this example).</p>
<pre class="pre-hl "><code class="python">self.add_output_object_list("o_object", "The output object", nb_items=2)</code></pre>
<h4>Options</h4>
<div class="table-responsive">
<table class="table table-bordered table-striped">
<thead>
<tr style="white-space:nowrap">
<th>Name</th>
<th>Type</th>
<th>Required</th>
<th>Default value</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>name</td>
<td>string</td>
<td>true</td>
<td>None</td>
<td>The name of the output object.</td>
</tr>
</tbody>
<tbody>
<tr>
<td>help</td>
<td>string</td>
<td>true</td>
<td>None</td>
<td>The description of the object.</td>
</tr>
</tbody>
<tbody>
<tr>
<td>nb_items</td>
<td>int</td>
<td>true</td>
<td>0</td>
<td>Number of objects into the list.</td>
</tr>
</tbody>
<tbody>
<tr>
<td>required</td>
<td>bool</td>
<td>false</td>
<td>false</td>
<td>Is required.</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment