⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ltkerrors.cpp

📁 An open source handwriting recongnition package!!!
💻 CPP
字号:
/*****************************************************************************************
* Copyright (c) 2007 Hewlett-Packard Development Company, L.P.
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*****************************************************************************************/

/************************************************************************
 * SVN MACROS
 *
 * $LastChangedDate: 2008-08-07 17:21:00 +0530 (Thu, 07 Aug 2008) $
 * $Revision: 597 $
 * $Author: mnab $
 *
 ************************************************************************/

/************************************************************************
 * FILE DESCR: Definition of getError function.
 *
 * CONTENTS:
 *	getError
 *
 * AUTHOR:  VijayaKumara M.
 *
 * DATE:
 * CHANGE HISTORY:
 * Author		Date			Description of change
 ************************************************************************/
#include "LTKErrors.h"
#include "LTKMacros.h"

#include "stdio.h"

int errorCode;

// Error list ( In the same oreder as in LTKErrorList.h file in "include" dir.
string errors[]={

	"Unable to open ink file, Look at the Log file for more info",				/* 100 - EINK_FILE_OPEN_ERR */
	"Unable to open configuration file, Look at the Log file for more info",	/* 101 - ECONFIG_FILE_OPEN_ERR */
	"Unable to open model header information file",								/* 102 - EHEADER_INFO_FILE_OPEN_ERR */
	"Unable to open model data file, Look at the Log file for more info",		/* 103 - EMODEL_DATA_FILE_OPEN_ERR */
	"Unable to open train list file, Look at the Log file for more info",		/* 104 - ETRAINLIST_FILE_OPEN_ERR	*/
	"Incompatible model data file. The header is not in the desired format. Look at the Log file for more info",						/* 105 - EFILE_FORMAT_ERR	*/
	"Model data file is corrupted, Look at the Log file for more info",			/* 106 - EFILE_CORRUPT_ERR */

	"Error while loading shape recognition module",		/* 107 - ELOAD_SHAPEREC_DLL_ERR */
	"Error while loading word recognition module",		/* 108 - ELOAD_WORDREC_DLL_ERR */
	"Error while loading preprocessing module",			/* 109 - ELOAD_PREPROC_DLL_ERR */
	"Exported function not found in module, Look at the Log file for more info",			/* 110 - EDLL_FUNC_ADDRESS_ERR */
	"Error while creating shape recognizer instance",		/* 111 - ECREATE_SHAPEREC_ERR	*/
	"Error while creating word recognizer instance",		/* 112 - ECREATE_WORDREC_ERR */
	"Error while creating preprocessor instance",			/* 113 - ECREATE_PREPROC_ERR */

	"Environment variable LIPI_ROOT is not set",			/* 114 - ELIPI_ROOT_PATH_NOT_SET */
	"Invalid or no entry for project name",					/* 115 - EINVALID_PROJECT_NAME */
	"Invalid configuration entry in project.cfg file",		/* 116 - EINVALID_CONFIG_ENTRY */
	"No shape recognizer specified in profile.cfg file",	/* 117 - ENO_SHAPE_RECOGNIZER */
	"No word recognizer specified in profile.cfg file",		/* 118 - ENO_WORD_RECOGNIZER */

	"Invalid number of traces processed, Look at the Log file for more info",				/* 119 - EINVALID_NUMBER_OF_TRACES */
	"Invalid value for number of shapes, Look at the Log file for more info",				/* 120 - EINVALID_VALUE_NUMOFSHAPES */
	"Invalid value for trace dimension, Look at the Log file for more info",				/* 121 - EINVALID_VALUE_TRACEDIMENSTION */
	"Invalid value for eigen vector, Look at the Log file for more info",					/* 122 - EINVALID_VALUE_NUMEIGENVECTOR */
	"Invalid float size entry in model data File, Look at the Log file for more info",		/* 123 - EINVALID_FLOAT_SIZE */
	"Incompatible algorithm version, Look at the Log file for more info",					/* 124 - EINCOMPATIBLE_VERSION_ERR */
	"Wrong preprocessor sequence entry in cfg file, Look at the Log file for more info",	/* 125 - EPREPROC_SEQUENCE_ERR */

	"Invalid or no value specified for project name for recognizer",	/* 126 - ENO_TOKEN_FOUND */
	"Invalid or no value specified for logical name for recognizer",	/* 127 - EINVALID_LOGICAL_NAME */

	"Invalid segment, boxfield recognizer requires character level segment info",				/* 128 - EINVALID_SEGMENT */
	"Unsupported recognizer mode",						/* 129 - EINVALID_REC_MODE */

	"Unsupported or invalid statistics to be computed",		/* 130 - EUNSUPPORTED_STATISTICS */


	"No function implemented to convert to a unicode string",	/* 131 - EMAP_NOT_FOUND 	*/
	"Invalid value for shape id",								/* 132 - EINVALID_VALUE_SHAPEID */

	"Cannot map the logical name, no entries in lipiengine.cfg",/* 133 - ENOMAPFOUND_LIPIENGINECFG */
	"Number of points in the tracegroup is not normalized",		/* 134 - EINVALID_NO_OF_POINTS */
	"Empty trace",												/* 135 - EEMPTY_TRACE*/
	"Empty Trace Group"	,										/* 136 -EEMPTY_TRACE_GROUP*/
	"The config file variable is not within the correct range", /* 137 - CONFIG_FILE_RANGE_ERR */


	"Recognizer requires the Intial shape id to be zero",		/* 138	- EINITSHAPE_NONZERO_ERR */
	"Invalid line in the listfile (train or test )",					/* 139	- EINVALID_LINE_LISTFILE_ERR  */
	"Invalid order of shape-ids in the list file ( train )",			/* 140	- EINVALID_ORDER_LISTFILE_ERR */
	"Invalid number of nearest neighbours specified",			/*141 - ENUM_NNS/*/
	"Ink file name is empty",									/* 142 - EINKFILE_EMPTY */
	"Incorrect or corrupted unipen ink file.",					/* 143 - EINKFILE_CORRUPTED */
	"Could not map the createPreprocessor function from DLL. ", /*144 EDLL_FUNC_ADDRESS_CREATE */
	"Could not map the deletePreprocessor function from DLL. ", /*145 EDLL_FUNC_ADDRESS_DELETE */
	"No resampleTraceGroup in preProcSequence entry of cfg file. ",   /*146 ENO_RESAMPLETRACEGROUP */

	"Sampling rate cannot be negative. ",						/*147 EINVALID_SAMPLING_RATE */
	"m_xDpi values cannot be negative. ",						/*148 EINVALID_X_RESOLUTION */
	"m_yDpi values cannot be negative. ",						/*149 EINVALID_Y_RESOLUTION */
	"m_latency cannot be negative. ",							/*150 EINVALID_LATENCY */

	"Point index greater than number of points available. ",	/*151 EPOINT_INDEX_OUT_OF_BOUND */
	"Invalid Channel. ",										/*152 ECHANNEL_INDEX_OUT_OF_BOUND */
	"New channel data not as long as the old one. ",			/*153 ECHANNEL_SIZE_MISMATCH */
	"Point to be added does not have the same number of channels as the trace. ", /*154 ENUM_CHANNELS_MISMATCH */
	"Channel with the new channel name already present. ",		/*155 EDUPLICATE_CHANNEL */
	"Channel not found. ",										/*156 ECHANNEL_NOT_FOUND */
	"Number of channels cannot be zero. ",						/*157 EZERO_CHANNELS */
	"Input stream does not match with number of channels in the trace. ", /*158 EINVALID_INPUT_STREAM */
	"Error: Cannot find distance for test sample with more than 1 stroke. ", /*159 ECOMPUTE_DISTANCE_ERROR */
	"Error: Cannot compare with train sample having more than 1 stroke. ", /*160 ECOMPARISON_ERROR */
	"Incompatible: train vector and test vector sizes do not match. ", /*161 ETRAIN_TEST_VECTOR_SIZE_MISMATCH */
	"Grammar file does not exists. ",							/*162 EGRAMMER_FILE_NOT_EXIST */
	"Values for the terminal is not Provided. ",				/*163 EVALUES_NOT_PROVIDED */
	"No productions or terminals identified in the CFG. Please check the CFG format. ", /*164 ECONFIG_FILE_FORMAT */
	"Cyclic dependency exists! Unable to find paths. ",			/*165 ECYCLIC_DEPENDENCY */
	"Could Not open file : ",                                   /*166 EFILE_OPEN_ERROR*/
	"Error while loading feature extractor module ",			/*167 ELOAD_FEATEXT_DLL*/
	"Could not map the createShapeFeatureExtractor function from DLL ",	/*168 EDLL_FUNC_ADDRESS_CREATE_FEATEXT */
	"Could not map the deleteShapeFeatureExtractor function from DLL ",	/*169 EDLL_FUNC_ADDRESS_DELETE_FEATEXT */
	"Feature extractor does not exist ",									/*170 EFTR_EXTR_NOT_EXIST */
	"No Feature Extractor in Config file ",						/*171 ENO_FTR_EXTR_IN_CFG*/
	"No implementation provided ",								/*172 EFTR_RPRCLASS_NOIMPLEMENTATION */
	"Invalid order of shape-ids in the feature file ",			/* 173	- EINVALID_ORDER_FEATUREFILE */
	"NumShapes config variable is  not set in the project.cfg file ",/* 174	- ENUMSHAPES_NOT_SET */
	"Vectors are of different lengths ", /* 175 - EUNEQUAL_LENGTH_VECTORS */
	"Invalid log level ", /* 176 - EINVALID_LOG_LEVEL */
	"Not allowed to ADD/Delete class for a project with fixed number of shapes",  /*177 EPROJ_NOT_DYNAMIC*/
	"Error: Cannot perform MORPH on features vectors of different sizes",       /*178 EMORPH_FVEC_SIZE_MISMATCH*/
	"No implementation provided",										/*179 ESHAPE_RECOCLASS_NOIMPLEMENTATION*/
	"Null Pointer Error",				/*180 ENULL_POINTER*/
	"Invalid X scale factor. Scale factor must be greater than zero", /*181 EINVALID_X_SCALE_FACTOR*/
	"Invalid Y scale factor. Scale factor must be greater than zero",  /*182 EINVALID_Y_SCALE_FACTOR*/
	"Parameter values in config file and MDT file do not match, check log file for more details",  /*183 ECONFIG_MDT_MISMATCH*/
	"Neighbor Info Vector is empty", /*184 ENEIGHBOR_INFO_VECTOR_EMPTY*/
	"Recognize result is empty", /*185 ERECO_RESULT_EMPTY*/
	"Features of input TraceGroup is empty", /* 186 ESHAPE_SAMPLE_FEATURES_EMPTY*/
	"Toolkit version missing in the control information", /* 187 ENO_TOOLKIT_VERSION */
	"Trace index greater than number of traces available. ",	/*188 ETRACE_INDEX_OUT_OF_BOUND */
	"Invalid key=value pair in the config file",	/**189 EINVALID_CFG_FILE_ENTRY*/
	"Key could not be found in the config file", 	/** 190 EKEY_NOT_FOUND */
	"feature index out of bounds",  /**191 EFEATURE_INDEX_OUT_OF_BOUND*/
	"Invalid file handle", /**192 EINVALID_FILE_HANDLE*/
	"Feature file open error", /**193 EFEATURE_FILE_OPEN*/
	"Distance between the features not defined",	/**194 EFTR_DISTANCE_NOT_DEFINED*/
	"Invalid Cluster ID",	/**195 EINVALID_CLUSTER_ID */
	"Prototype set is empty",	/**196 EPROTOTYPE_SET_EMPTY */
	"Log file does not exist", /**197 ELOG_FILE_NOT_EXIST */
	"Size of the data objects vector and their corresponding hyperlinks vector do not match", /**198 EDATA_HYPERLINK_VEC_SIZE_MISMATCH*/
	"File creation failed. Invalid path or no permission.", /**199 EFILE_CREATION_FAILED*/
	"Invalid number of clusters specified. The number must be greater than or equal to 1 and less than number of data objects.", /**200 EINVALID_NUM_CLUSTERS*/
	"No elements in the input data vector for clustering.", /**201 ENO_DATA_TO_CLUSTER*/
	"Minimum 6 data objects are required to employ LMethod.", /**202 EINSUFFICIENT_DATA_FOR_LMETHOD*/
	"Module index not found in module vector", /**203 EINVALID_MODULE_HANDLE */
	"Specified Log filename is empty", /**204 EINVALID_LOG_FILENAME	*/
	"Error creating logger", /**205 ECREATE_LOGGER */
	"Project type in CFG is missing or an invalid value", /**206 EINVALID_PROJECT_TYPE*/
	"Empty string", /**207 EEMPTY_STRING*/
	"Empty vector", /**208 EEMPTY_VECTOR*/
	"Negative or zero value", /**209 ENON_POSITIVE_NUM*/
	"The word recogniton result vector is empty", /**210 EEMPTY_WORDREC_RESULTS*/
	"Negative value",/**211 ENEGATIVE_NUM*/
    "Invalid Class ID", /**212 EINVALID_CLASS_ID*/
    "Invalid Confidence Value",  /** 213 EINVALID_CONFIDENCE_VALUE*/
	"Shape Recognizer Project name missing in the word recognizer config file.", /**214 ENO_SHAPE_RECO_PROJECT*/
	"Unsupported recognition mode.", /**215 EINVALID_RECOGNITION_MODE*/
	"Shared library for Logger not loaded",
    "Single point trace", /**217 ESINGLE_POINT_TRACE*/
};

/**********************************************************************************
* AUTHOR		: Vijayakumara M
* DATE			: 01-Sept-2005
* NAME			: getError
* DESCRIPTION	: returns the error descriptions from the errors Table.
* ARGUMENTS		: error code.
* RETURNS		: returns pointer to an error description
* NOTES			:
* CHANGE HISTORY
* Author			Date				Description of change
*************************************************************************************/
string getErrorMessage(int errorCode)
{
	if((errorCode != 0) && (errorCode >= ERROR_START_NO) && (errorCode <= MAX_ERROR_NO))
	{
		return errors[errorCode-ERROR_START_NO];
	}
	else
	{
		return "Error code is not set, Look at the log file for more information";
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -