/***************************************************************************
*                                                                          *
*  Copyright (C) Golaem S.A.  All Rights Reserved.                         *
*                                                                          *
***************************************************************************/

#pragma once

#include "glmAbstractRoadmapCreator.h"
#include <glmProgress.h>
#include "glmGseOStream.h"

namespace glm
{
	/** 
	* \brief Roadmap saver to the proprietary GSE file format.
	*
	* In most cases users shouldn't use directly this saver, roadmap should be saved along
	* a spatial environment using \ref PSSpatialEnvironmentGseSaver.
	*
	* \ingroup Roadmap
	*
	* \author Golaem <dev@golaem.com>
	*/
	class GLM_SDK_API RoadmapGseSaver : private AbstractRoadmapCreator
	{
	public:

		GLM_CLASS_STAT_ID( glm::MemoryStatIds::Simulation)
		
		RoadmapGseSaver(GseOStream & gseStream);
		~RoadmapGseSaver();

		/**
		* \name Progress
		*/
		//@{
		inline const Progress::SP getProgress() const;
		inline Progress::SP touchProgress();
		//@}

		bool saveRoadmap(const Roadmap& roadmap);

	protected:

		bool doComputation(bool& /*cancel*/){return false;}

		Progress::SP _progress;

		GseOStream * _stream;
	};

	//*****************************************************************************
	// RoadmapGseSaver inline definitions
	//*****************************************************************************

	//-----------------------------------------------------------------------------
	// getProgress
	//-----------------------------------------------------------------------------
	const Progress::SP RoadmapGseSaver::getProgress() const
	{
		return _progress;
	}

	//-----------------------------------------------------------------------------
	// touchProgress
	//-----------------------------------------------------------------------------
	Progress::SP RoadmapGseSaver::touchProgress()
	{
		return _progress;
	}
}
