MASA-Core
Public Member Functions | Protected Member Functions
IAlignerParameters Class Reference

Detailed Description

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.

See also:
AbstractAligner, AbstractAlignerParameters
GNU getopt C library (External link)

Definition at line 74 of file IAlignerParameter.hpp.

#include <IAlignerParameter.hpp>

Inheritance diagram for IAlignerParameters:
AbstractAlignerParameters BlockAlignerParameters

List of all members.

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 ()

Constructor & Destructor Documentation

IAlignerParameters::~IAlignerParameters ( ) [inline, protected]

Definition at line 135 of file IAlignerParameter.hpp.

IAlignerParameters::IAlignerParameters ( ) [inline, protected]

Definition at line 136 of file IAlignerParameter.hpp.


Member Function Documentation

virtual int IAlignerParameters::getForkId ( ) const [pure virtual]

Returns the Id of the forked process.

Returns:
the Id of the forked process, from 0 to n-1 (where n is the number of forked process), or NOT_FORKED_INSTANCE (-1) if no process was forked.

Implemented in AbstractAlignerParameters.

virtual const char* IAlignerParameters::getLastError ( ) const [pure virtual]

Returns the last error defined by the AbstractAlignerParameters::setLastError method.

Returns:
the last error string.

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:

  • argument_str: the code associated with "--arg" in the option structure;
  • argument_str: the "--arg=OPT" string;
  • argument_option: the "OPT" string.

Inside this method, the subclass should set the "arg" variable to OPT.

Parameters:
argument_codeThe code of the argument associated in the AbstractAlignerParameters::setArguments method.
argument_strThe argument string with its option.
argument_optionThe option passed to the argument. NULL if there is not any argument.
Returns:
ARGUMENT_OK (0) if succeeded, non-zero otherwise (ARGUMENT_ERROR, ARGUMENT_ERROR_NOT_FOUND or ARGUMENT_ERROR_NO_OPTION). If there is an error, set the error string using the AbstractAlignerParameters::setLastError function.

Implemented in BlockAlignerParameters.

virtual void IAlignerParameters::setForkId ( int  forkId) [pure virtual]

Defines the Id of the forked process.

Parameters:
forkIdthe unique Id of this forked process.

Implemented in AbstractAlignerParameters.


The documentation for this class was generated from the following file: