|
MASA-Core
|
The customized parameters of a MASA Extension, used for receiving, manipulating and customizing command line parameters.
Each MASA Extension must have its own subclass of the IAlignerParameters class. The subclass may customize the command line parameters using the GNU getopt C library. This is done by calling the AbstractAlignerParameters::callGetOpt method with the option structure of the getopt library. The IAlignerParameters::processArgument() pure virtual method will be invoked whenever MASA encounters one of the customized parameters defined with the setArguments method. Using this method, all the parameters may be set as an attribute of the subclass.
The aligner must set default values for each parameters because the IAlignerParameters::processArgument() methods may never be called if there is no argument.
The Aligner class must hold one instance of the IAlignerParameters class and it must return this instance in the IAlign::getParameters() method.
One command line that the IAlignerParameters must manipulate is the --fork parameter, since MASA use this parameter to fork as many processes as the architecture supports. If MASA forks many processes, the IAlignerParameters::getForkId() method will return the identifier of this forked process (from 0 to n-1), or NOT_FORKED_INSTANCE if there was no forked process. Use this Id to customize the execution uniquely to your architecture.
The AbstractAlignerParameters class implements the basic operations of the IAlignerParameter. Extend this class to implement Aligner specific parameters. You can create a hierarchy of parameter classes, but always call the overwritten methods in order to parse the parameters of the super classes.
Definition at line 74 of file IAlignerParameter.hpp.
#include <IAlignerParameter.hpp>
Public Member Functions | |
| virtual void | printUsage () const =0 |
| Prints the usage text in the command line. | |
| virtual int | processArgument (int argc, char **argv)=0 |
| Processes each customized command line option. | |
| virtual const char * | getLastError () const =0 |
| Returns the last error defined by the AbstractAlignerParameters::setLastError method. | |
| virtual int | getForkId () const =0 |
| Returns the Id of the forked process. | |
| virtual void | setForkId (int forkId)=0 |
| Defines the Id of the forked process. | |
Protected Member Functions | |
| ~IAlignerParameters () | |
| IAlignerParameters () | |
| IAlignerParameters::~IAlignerParameters | ( | ) | [inline, protected] |
Definition at line 135 of file IAlignerParameter.hpp.
| IAlignerParameters::IAlignerParameters | ( | ) | [inline, protected] |
Definition at line 136 of file IAlignerParameter.hpp.
| virtual int IAlignerParameters::getForkId | ( | ) | const [pure virtual] |
Returns the Id of the forked process.
Implemented in AbstractAlignerParameters.
| virtual const char* IAlignerParameters::getLastError | ( | ) | const [pure virtual] |
Returns the last error defined by the AbstractAlignerParameters::setLastError method.
Implemented in AbstractAlignerParameters.
| virtual void IAlignerParameters::printUsage | ( | ) | const [pure virtual] |
Prints the usage text in the command line.
Use the AbstractAlignerParameters::printUsage method to print with a pretty bash format.
Implemented in BlockAlignerParameters.
| virtual int IAlignerParameters::processArgument | ( | int | argc, |
| char ** | argv | ||
| ) | [pure virtual] |
Processes each customized command line option.
For instance, suppose that the customized parameter was "--arg=OPT". The we will have this methos will be invoked with the following parameters:
Inside this method, the subclass should set the "arg" variable to OPT.
| argument_code | The code of the argument associated in the AbstractAlignerParameters::setArguments method. |
| argument_str | The argument string with its option. |
| argument_option | The option passed to the argument. NULL if there is not any argument. |
Implemented in BlockAlignerParameters.
| virtual void IAlignerParameters::setForkId | ( | int | forkId | ) | [pure virtual] |
Defines the Id of the forked process.
| forkId | the unique Id of this forked process. |
Implemented in AbstractAlignerParameters.
1.7.6.1