|
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 #include "AbstractAlignerParameters.hpp" 00023 00024 #include <stdio.h> 00025 #include <string.h> 00026 00027 /** 00028 * Initializes the inner structures of the object. 00029 */ 00030 AbstractAlignerParameters::AbstractAlignerParameters() { 00031 forkId = NOT_FORKED_INSTANCE; 00032 } 00033 00034 /** 00035 * Destruct the allocated structures. 00036 */ 00037 AbstractAlignerParameters::~AbstractAlignerParameters() { 00038 } 00039 00040 /* 00041 * @see definition on header file 00042 */ 00043 const char* AbstractAlignerParameters::getLastError() const { 00044 return lastError; 00045 } 00046 00047 /* 00048 * @see definition on header file 00049 */ 00050 void AbstractAlignerParameters::printFormattedUsage(const char* header, const char* text) { 00051 printf ( "\033[1m%s:\033[0m\n", header); 00052 printf ( "%s\n\n", text ); 00053 } 00054 00055 /* 00056 * @see definition on header file 00057 */ 00058 int AbstractAlignerParameters::callGetOpt(int argc, char** argv, option* arguments) { 00059 optind--; 00060 int ret = getopt_long ( argc, argv, ":", arguments, NULL ); 00061 if (ret == '?') { 00062 return ARGUMENT_ERROR_NOT_FOUND; 00063 } else if (ret == ':') { 00064 return ARGUMENT_ERROR_NO_OPTION; 00065 } 00066 return ret; 00067 } 00068 00069 /* 00070 * @see definition on header file 00071 */ 00072 int AbstractAlignerParameters::getForkId() const { 00073 return forkId; 00074 } 00075 00076 /* 00077 * @see definition on header file 00078 */ 00079 void AbstractAlignerParameters::setForkId(int forkId) { 00080 this->forkId = forkId; 00081 } 00082 00083 /* 00084 * @see definition on header file 00085 */ 00086 void AbstractAlignerParameters::setLastError(const char* error) { 00087 strncpy(lastError, error, sizeof(lastError)-1); 00088 lastError[sizeof(lastError)-1] = '\0'; 00089 } 00090 00091 00092
1.7.6.1