|
MASA-Core
|
00001 /******************************************************************************* 00002 * 00003 * Copyright (c) 2010-2015 Edans Sandes 00004 * 00005 * This file is part of MASA-Core. 00006 * 00007 * MASA-Core is free software: you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation, either version 3 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * MASA-Core is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with MASA-Core. If not, see <http://www.gnu.org/licenses/>. 00019 * 00020 ******************************************************************************/ 00021 00022 #ifndef ABSTRACTALIGNERPARAMETER_HPP_ 00023 #define ABSTRACTALIGNERPARAMETER_HPP_ 00024 00025 #include <stdio.h> 00026 #include <getopt.h> 00027 #include "../IAlignerParameter.hpp" 00028 00029 00030 /** 00031 * The customized parameters of a MASA Extension, used for receiving, 00032 * manipulating and customizing command line parameters. The 00033 * AbstractAlignerParameters class implements the basic operations of the 00034 * IAlignerParameter. Extend this class to implement Aligner specific parameters. 00035 * 00036 * @see IAlignerParameter 00037 * @see <a href="http://www.gnu.org/software/libc/manual/html_node/Getopt.html">GNU getopt C library</a> (External link) 00038 */ 00039 class AbstractAlignerParameters : public IAlignerParameters { 00040 00041 00042 public: 00043 /** 00044 * Constructor 00045 */ 00046 AbstractAlignerParameters(); 00047 00048 /** 00049 * Destructor 00050 */ 00051 virtual ~AbstractAlignerParameters(); 00052 00053 /* Implemented virtual methods inherited from IAligner */ 00054 virtual const char* getLastError() const; 00055 virtual int getForkId() const; 00056 virtual void setForkId(int forkId); 00057 00058 protected: 00059 00060 /** 00061 * Defines the number of processes that may be forked using the "--fork" 00062 * command line parameter. 00063 * 00064 * @param forkCount the maximum number of forked processes. 00065 * @param forkWeights The weight of each processed used in the split procedure. 00066 * set to NULL to consider equal weights. 00067 */ 00068 void setForkCount(const int forkCount, const int* forkWeights = NULL); 00069 00070 /** 00071 * Defines the error during the execution of the 00072 * AbstractAlignerParameters::processArgument method. 00073 * 00074 * @param error The string containing the argument error. 00075 */ 00076 void setLastError(const char* error); 00077 00078 /** 00079 * Prints the usage text in the command line. 00080 * @param header The highlighted header of the help section that will contain 00081 * the customized usage string. 00082 * @param text The string containing the help text that will be shown to the user. 00083 */ 00084 static void printFormattedUsage(const char* header, const char* text); 00085 00086 /** 00087 * Process the arguments using the optarg library. 00088 */ 00089 static int callGetOpt(int argc, char** argv, option* arguments); 00090 00091 private: 00092 /** The last error */ 00093 char lastError[500]; 00094 00095 /** The Id of this forked process */ 00096 int forkId; 00097 00098 /** Arguments passed to the getopt library */ 00099 const option* arguments; 00100 }; 00101 00102 #endif /* ABSTRACTALIGNERPARAMETER_HPP_ */
1.7.6.1