MASA-Core
SpecialRowsArea.hpp
Go to the documentation of this file.
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 class SpecialRowsArea;
00023 
00024 #ifndef SPECIALROWSAREA_HPP_
00025 #define SPECIALROWSAREA_HPP_
00026 
00027 #include "SpecialRowsPartition.hpp"
00028 #include "../../libmasa/libmasa.hpp"
00029 
00030 #include <string>
00031 #include <map>
00032 #include <vector>
00033 using namespace std;
00034 
00035 class SpecialRowsArea {
00036 public:
00037         SpecialRowsArea(string directory, long long ram_limit, long long disk_limit, const score_params_t* score_params);
00038         virtual ~SpecialRowsArea();
00039 
00040         SpecialRowsPartition* createPartition(int i0, int j0, int i1, int j1);
00041         SpecialRowsPartition* openPartition(int i0, int j0);
00042         SpecialRowsPartition* openPartition(int i0, int j0, int i1, int j1);
00043         void truncatePartition(SpecialRowsPartition* partition, int max_i, int max_j);
00044         void createSplittedPartitions(int i0, int j0, int i1, int j1, int ni, int nj, SeekableCellsReader* firstRow, SeekableCellsReader* firstColumn, CellsWriter* lastRow, CellsWriter* lastColumn);
00045         int getRowsCount() const;
00046         int getPartitionsCount() const;
00047         const string& getDirectory() const;
00048         void setPersistentPartitions(bool persistent);
00049 
00050         vector<SpecialRowsPartition*> getSortedPartitions();
00051 
00052 private:
00053 
00054         bool persistentPartitions;
00055         string directory;
00056         long long disk_limit;
00057         long long ram_limit;
00058         map<string, SpecialRowsPartition*> partitions;
00059         int rowsCount;
00060         const score_params_t* score_params;
00061 
00062         string getPartitionPath(int i0, int j0, int i1, int j1);
00063 };
00064 
00065 #endif /* SPECIALROWSAREA_HPP_ */