With Example 3 and subsequent examples, we no longer use a singleton. So we will see a simple example of using the service normally.
Note that this example does the same thing as the previous examples.
To start, let's look at the options of the .axl file:
SimpleTableOutputExample3.axl
In the .axl, we just declare the use of a service implementing the Arcane::ISimpleTableOutput interface.
Here is the corresponding .arc:
SimpleTableOutputExample3.arc
Here, compared to the previous example, we fill in the options in the service section. We request the use of the SimpleCsvOutput service with the two options it requires.
Let's look at the start-init entry point:
SimpleTableOutputExample3Module.cc
Compared to the previous example, we do not need to retrieve a pointer to a singleton; here it is a service used normally.
Still compared to the previous example, the service manages the default values.
Let's look at the compute-loop entry point:
SimpleTableOutputExample3Module.cc
Aside from replacing the singleton pointer with the use of module options, there are no differences from the two previous examples.
Finally, let's look at the exit entry point:
SimpleTableOutputExample3Module.cc
Here, we simply write the output file (and print the table). If one wishes to control whether or not the file is written via the .arc, this is where it can be done by conditioning the call to writeFile() with an if().