/*
    Copyright (C) 2012 Bartosz Broda, Jacek Bochenek, Łukasz Biłeńkij, 
    Damian Jaworski, Wojciech Mazur, Dominik Piasecki, Maciej Piasecki, 
    Radosław Ramocki
    
    This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your option)
any later version.

    This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. 

    See the LICENSE and COPYING files for more details.
*/

#ifndef MATRIXCONV_MATRIXCONV_H
#define MATRIXCONV_MATRIXCONV_H
#include <iostream>
#include <fstream>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/algorithm/string.hpp>
#include <stdexcept>
#include <boost/lexical_cast.hpp>
#include <vector>
#include "matrices_all.h"

class MatrixConverter
{
public:
	MatrixConverter();
	void ConvertMatrix(const std::string &old_matrix_path, const std::string &new_matrix_path, 
			const std::string &corpus_info);
private:
	void ConvertFeatures(const std::string &filename_in, const std::string filename_out, std::vector<std::string> &terms);
	void ProcessInfo();
	void CopyLabels();
	void CopyFeatures();
	void PrepareOutputDir();
	void DoCheck();
	void CopyData();
	void LoadInfo();
	void CheckCRSFiles();
	void CheckCCSFiles();
	void LoadTerms(const  std::string &filename, std::vector<std::string> &v);
	void CopyMatrices();
	void WriteInfo();


	std::string old_path;
	std::string new_path;
	std::string matrix_name;
	std::string corpus_info;
	std::string old_matrix_ccs_name;
	std::string old_matrix_crs_name;
	std::vector<std::string> row_terms;
	std::vector<std::string> column_terms;
	size_t token_count;

};

#endif

