|
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 ALIGNERPOOL_HPP_ 00023 #define ALIGNERPOOL_HPP_ 00024 00025 #include <string> 00026 using namespace std; 00027 00028 #include "../libmasa/libmasaTypes.hpp" 00029 #include "CrosspointsFile.hpp" 00030 00031 class AlignerPool { 00032 public: 00033 AlignerPool(string sharedPath); 00034 virtual ~AlignerPool(); 00035 00036 virtual void initialize(); 00037 00038 virtual string getLoadURL(int id); 00039 00040 virtual void waitId(int id); 00041 virtual score_t receiveScore(); 00042 virtual crosspoint_t receiveCrosspoint(int* final); 00043 virtual CrosspointsFile* receiveCrosspointFile(); 00044 //virtual void waitSignal(int signal); 00045 00046 virtual void registerNode(int id, int left, int right, string flushURL); 00047 virtual void dispatchScore(score_t score); 00048 virtual void dispatchCrosspoint(crosspoint_t crosspoint, int final); 00049 virtual void dispatchCrosspointFile(CrosspointsFile* file); 00050 //virtual void dispatchSignal(int signal); 00051 00052 virtual bool isFirstNode(); 00053 virtual bool isLastNode(); 00054 const score_t& getBestNodeScore() const; 00055 void setBestNodeScore(const score_t& bestLocalScore); 00056 00057 private: 00058 string sharedPath; 00059 int right; 00060 int left; 00061 int crosspointIdSentCounter; 00062 int crosspointIdRecvCounter; 00063 score_t bestNodeScore; 00064 00065 string getMsgFile(string prefix, int id, int count=-1); 00066 string getSignalFile(string msgFile); 00067 void sendSignal(string msgFile); 00068 void waitSignal(string msgFile); 00069 bool peekSignal(string msgFile); 00070 }; 00071 00072 #endif /* ALIGNERPOOL_HPP_ */
1.7.6.1