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

#include "matrices_headers.h"

namespace Matrices
{
	/**
	  * A compressed vector that holds only real values.
	  * All operation should behave in exacly the same maner as in CompressedVector, so refer to its manuall for description.
	  * \see CompressedVector
	  * \todo CompressedVectors should be templates
	  * \note Nobody is using this class, so it will be probably removed from future versions.
	  */
	class MATRICES_API CompressedIntVector
	{
	public:
		CompressedIntVector(size_t uncompressedSize, int* uncompressedData);
		CompressedIntVector(const std::vector<int> &uncompressedData);
		CompressedIntVector(const std::map<size_t, int> &mapVal, size_t uncompressedSize);
		virtual ~CompressedIntVector();
		CompressedIntVector(const CompressedIntVector& v);
		CompressedIntVector& operator=(CompressedIntVector&v);

		int operator[](size_t n) const;
		virtual int* DecompressData() const;
		virtual void FreeBuffer() const;
		void SetVector(int *data);
		void SetElement(size_t index, int val);
		std::map<size_t, int>* GetValues();
		size_t GetUncompresseSize() const;
		CompressedIntVector& operator += (const CompressedIntVector &v);

	protected:
		void Compress(size_t size,const int* data);

		size_t m_stUncompressed;


		std::map<size_t, int> *m_pVals;

	private:
		mutable int *uncompressed;
	};


	typedef boost::shared_ptr<CompressedIntVector> CompressedIntVectorPtr;
}

#endif //MATRICES_COMPRESSEDINTVECTOR_H

