/*
    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 GENSIMMATRIXWRITER_H
#define GENSIMMATRIXWRITER_H

#include "../matrices_headers.h"
#include "MatrixWriter.h"
#include "../SuperMatrix.h"

namespace Matrices
{
	namespace IO
	{
		/**
		  * Writes Super Matrix to file in Market Matrix format for Gensim
		  */
		class MATRICES_API GensimMatrixWriter
		{
		public:
			void Write(Matrices::SuperMatrixPtr matrix, std::string &path) throw(filesystem_error);
		private:
			static void WriteMatrixMarket(SuperMatrixPtr pMatrix, std::string &path);
			static void WriteId2Word(FeatureVectorPtr v, const std::string &filename);
			static void PrepareDir(SuperMatrixPtr m, std::string &path);
		};

		void MATRICES_API WriteGensimMatrix(SuperMatrixPtr m, const std::string &dir);
	}
}

#endif // GENSIMMATRIXWRITER_H
