/**********************************************************************
XyGrib: meteorological GRIB file viewer
Copyright (C) 2008-2012 - Jacques Zaninetti - http://www.zygrib.org

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
***********************************************************************/

#ifndef DATAMETEOABSTRACT_H
#define DATAMETEOABSTRACT_H

#include <iostream>
#include "DataDefines.h"
#include "Therm.h"

#define isleapyear(y) ((((y)%4==0) && ((y)%100!=0))||((y)%400==0))

//--------------------------------------------------------
enum FileDataType 
{
	DATATYPE_NONE,
	DATATYPE_CANCELLED,
	DATATYPE_GRIB,
};

//--------------------------------------------------------
class DataRecordAbstract
{
	public:
		DataRecordAbstract () {}
		virtual ~DataRecordAbstract () {}

        virtual time_t getRecordRefDate () const = 0;
        virtual time_t getRecordCurrentDate () const = 0;

		/** Return a timestamp in the UTC timezone.
		*/
		static time_t UTC_mktime (int year,int month,int day,int hour,int min,int sec);
		
		/** Compute a dew point with the Magnus-Tetens formula.
		*/
		static double dewpointMagnusTetens (double tempK, double humidRel);
		
		/** Compute a dew point with the Hardy formula.
			Hardy B., Thunder Scientific Corporation, Albuquerque, NM, USA 
			The proceedings of the Third international Symposium on Humidity & Moisture, 
			Teddington, London, England, April 1998.
		*/
		static double dewpointHardy (double tempK, double humidRel);
		
		/** Compute the mean geopotential altitude in meters
		*/
		static double computeGeopotentialAltitude (
							double Phpa  // pressure (hPa)
						);
};

//--------------------------------------------------------
class DataReaderAbstract
{
	public:
		DataReaderAbstract () {}
		virtual ~DataReaderAbstract () {}
		
		virtual FileDataType getReaderFileDataType () = 0;
};

//--------------------------------------------------------
class DataPlotterAbstract
{
	public:
		DataPlotterAbstract () {}
		virtual ~DataPlotterAbstract () {}

};

#endif
