|
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 BESTSCORELIST_H_ 00023 #define BESTSCORELIST_H_ 00024 #include <pthread.h> 00025 #include <set> 00026 using namespace std; 00027 00028 #include "../libmasa/libmasa.hpp" 00029 00030 struct classcomp { 00031 bool operator() (const score_t& a, const score_t& b) const { 00032 int diff_z = a.score - b.score; 00033 if (diff_z) return diff_z > 0; 00034 int diff_y = b.i - a.i; 00035 if (diff_y) return diff_y > 0; 00036 return b.j > a.j; 00037 } 00038 }; 00039 00040 00041 class BestScoreList : public std::set<score_t,classcomp> { 00042 public: 00043 BestScoreList(int limit, int min_score, int seq0_len, int seq1_len, const score_params_t* score_params); 00044 virtual ~BestScoreList(); 00045 void add(int i, int j, int score); 00046 score_t getBestScore() const; 00047 private: 00048 int limit; 00049 int min_score; 00050 int seq0_len; 00051 int seq1_len; 00052 const score_params_t* score_params; 00053 00054 //set<int3,classcomp> bestScores; 00055 pthread_mutex_t mutex; 00056 00057 bool isDerived(const score_t best, const score_t score); 00058 bool isAllowed(const score_t best, const score_t score); 00059 void _add(int i, int j, int score); 00060 }; 00061 00062 #endif /* BESTSCORELIST_H_ */
1.7.6.1