#pragma once
/*****************************************************************//**
 * \file   LogInfoCls.h
 * \brief  错误枚举类，以及返回错误信息
 * 
 * \author 陈增辉
 * \date   October 2024
 *********************************************************************/
#include "BaseConstVariable.h"
#include <string>

// 定义变换
#define _CASE_STR(x) case x : return #x; break; 


enum ErrorCode {
	SUCCESS = -1,// 执行成功
	VIRTUALABSTRACT = -2,// virtual abstract function ，not implement
	FAIL=0,
	FILENOFOUND = 1,
	OrbitNodeNotEnough = 2,
	XYDataPointNotEqual = 3,
	FILEOPENFAIL = 4,
	XMLPARSEFAIL = 5,
	XMLNOTFOUNDElEMENT = 6,
	FILEPATHISEMPTY = 7,
	FOLDER_NOT_EXIST = 8,
	FILE_NOT_EXIST = 9,
	FIND_ID_ERROR = 10,
	INSERT_ID_ERROR = 11,
	EPSGCODE_NOTSAME = 12,
	EPSGCODE_NOTSUPPORT = 13,
	RASTERBAND_NOTEQUAL = 14,  
	RASTER_DATETYPE_NOTSAME = 15,
	//GSL 1xx
	Error_GSL_FAILURE = -101,
	Error_GSL_CONTINUE = -102,  /* iteration has not converged */
	Error_GSL_EDOM = 101,   /* input domain error, e.g sqrt(-1) */
	Error_GSL_ERANGE = 102,   /* output range error, e.g. exp(1e100) */
	Error_GSL_EFAULT = 103,   /* invalid pointer */
	Error_GSL_EINVAL = 104,   /* invalid argument supplied by user */
	Error_GSL_EFAILED = 105,   /* generic failure */
	Error_GSL_EFACTOR = 106,   /* factorization failed */
	Error_GSL_ESANITY = 107,   /* sanity check failed - shouldn't happen */
	Error_GSL_ENOMEM = 108,   /* malloc failed */
	Error_GSL_EBADFUNC = 109,   /* problem with user-supplied function */
	Error_GSL_ERUNAWAY = 110,  /* iterative process is out of control */
	Error_GSL_EMAXITER = 111,  /* exceeded max number of iterations */
	Error_GSL_EZERODIV = 112,  /* tried to divide by zero */
	Error_GSL_EBADTOL = 113,  /* user specified an invalid tolerance */
	Error_GSL_ETOL = 114,  /* failed to reach the specified tolerance */
	Error_GSL_EUNDRFLW = 115,  /* underflow */
	Error_GSL_EOVRFLW = 116,  /* overflow  */
	Error_GSL_ELOSS = 117,  /* loss of accuracy */
	Error_GSL_EROUND = 118,  /* failed because of roundoff error */
	Error_GSL_EBADLEN = 119,  /* matrix, vector lengths are not conformant */
	Error_GSL_ENOTSQR = 120,  /* matrix not square */
	Error_GSL_ESING = 121,  /* apparent singularity detected */
	Error_GSL_EDIVERGE = 122,  /* integral or series is divergent */
	Error_GSL_EUNSUP = 123,  /* requested feature is not supported by the hardware */
	Error_GSL_EUNIMPL = 124,  /* requested feature not (yet) implemented */
	Error_GSL_ECACHE = 125,  /* cache limit exceeded */
	Error_GSL_ETABLE = 126,  /* table limit exceeded */
	Error_GSL_ENOPROG = 127,  /* iteration is not making progress towards solution */
	Error_GSL_ENOPROGJ = 128,  /* jacobian evaluations are not improving the solution */
	Error_GSL_ETOLF = 129,  /* cannot reach the specified tolerance in F */
	Error_GSL_ETOLX = 130,  /* cannot reach the specified tolerance in X */
	Error_GSL_ETOLG = 131,  /* cannot reach the specified tolerance in gradient */
	Error_GSL_EOF = 132,  /* end of file */

	// RFPC
	RFPC_PARAMSISEMPTY = 201,
	// L0 数据
	ECHO_L0DATA_NOTOPEN = 202,
	ECHO_L0DATA_ROW_COL_NOEQUAL = 203, // 行或者列数量错误
	ECHO_L0DATA_PRFIDXOUTRANGE = 204,			// PRF 索引超出范围
	ECHO_L0DATA_GPSFILEFORMATERROR = 205, // GPS文件错误
	ECHO_L0DATA_ECHOFILEFORMATERROR = 206, // 回波文件格式错误
	ECHO_L0DATA_ECHOFILENOTOPEN = 207, // 回波文件打开错误
	ECHO_L0DATA_GPSFILEFNOTOPEN = 208, // GPS文件打开错误
	ECHO_L0DATA_XMLFILENOTOPEN = 209, // xml文件打开错误
	OUTOFRANGE = 210, // 超出范围
	ECHO_L0DATA_XMLNAMEERROR = 211, // 超出范围
	// BP成像
	TBP_L0OPENFAIL = 301, // 0级文件打开错误

	// L1图像
	IMAGE_L1DATA_XMLNAMEERROR = 401,
	IMAGE_L1DATA_XMLNAMEOPENERROR = 402,
	IMAGE_L1DATA_XMLNAMEPARASEERROR = 403,
	
}; 



std::string  BASECONSTVARIABLEAPI	 errorCode2errInfo(ErrorCode code);


ErrorCode  BASECONSTVARIABLEAPI	 GSLState2ErrorCode(int gslState);



