A fuzzy logic C++ library
Classes | Namespaces | Defines | Enumerations | Functions
error_handler.hpp File Reference
#include <sstream>
#include <exception>
#include "debug.h"
+ Include dependency graph for error_handler.hpp:
+ This graph shows which files directly or indirectly include this file:

Classes

class  slifis::ERROR_HANDLER
 This class is used to hold information about an error that occurred. It inherits from std::exception. More...

Namespaces

namespace  slifis
 

This namespace includes all root classes, functions, and datatypes of the library.


Defines

#define SLIFIS_ERROR(a)
 Fatal error macro. The single argument must be of type slifis::EN_ERRMSG.
#define SLIFIS_ERROR_1(a, b)
 Fatal error macro. The first argument must be of type slifis::EN_ERRMSG, while the second can be anything that can be streamed, and will be printed out in the log file.
#define SLIFIS_ERROR_2(a, b, c)
 Fatal error macro. The first argument must be of type slifis::EN_ERRMSG, the two last can be anything that can be streamed, and will be printed out in the log file.
#define SLIFIS_CATCH_RETHROW
 Used inside public API to re-throw a catched exception.

Enumerations

enum  slifis::EN_ERRMSG {
  slifis::ERR_MF_NOREMOVE, slifis::ERR_MF_BAD_TYPE, slifis::ERR_MF_BAD_INDEX, slifis::ERR_MF_NO_POINT,
  slifis::ERR_MF_NOT_VALID, slifis::ERR_MF_NAME_NOT_FOUND, slifis::ERR_MF_CANT_ADD_POINT, slifis::ERR_MF_INVALID_VALUE,
  slifis::ERR_RULE_BAD_INDEX, slifis::ERR_RULE_NO_TERMS, slifis::ERR_RULE_NO_OUTPUT_VAL, slifis::ERR_RULE_BAD_TYPE,
  slifis::ERR_RULE_INVALID_OP, slifis::ERR_RULE_TS_COEFFS, slifis::ERR_RULE_NAME_NOT_FOUND, slifis::ERR_MFSET_NOT_VALID,
  slifis::ERR_MFSET_BAD_INDEX, slifis::ERR_MFSET_NONAME, slifis::ERR_MFSET_INVALID_NB, slifis::ERR_MFSET_NOT_ENOUGH_POINTS,
  slifis::ERR_MFSET_EMPTY, slifis::ERR_FIS_NOTVALID, slifis::ERR_FIS_BAD_TYPE, slifis::ERR_FIS_EVAL_UNABLE,
  slifis::ERR_FIS_DEFUZZ_UNABLE, slifis::ERR_DATA_BAD_INDEX, slifis::ERR_DATA_NO_DESCRIPTION, slifis::ERR_DATA_BAD_TYPE,
  slifis::ERR_DATA_NO_NUMERIC, slifis::ERR_DATA_NO_POINTS, slifis::ERR_DATA_INFO_INVALID, slifis::ERR_DATA_DESCR_INVALID,
  slifis::ERR_RULEBASE_NO_POINTERS, slifis::ERR_INPUTS_BAD_INDEX, slifis::ERR_BAD_INPUT_SIZE, slifis::ERR_NO_INPUTS,
  slifis::ERR_IO_ERROR, slifis::ERR_BAD_VALUES, slifis::ERR_PLOT_NOSCALE, slifis::ERR_PLOT_DRAW,
  slifis::ERR_GAPI, slifis::ERR_GAPI_NO_SCALE, slifis::ERR_UNKNOWN, slifis::ERR_DUMMY
}
 Error codes used internally, a clean message will be written for the user in log file by SLIFIS::P_UserError() More...

Functions

const char * slifis::GetString (EN_ERRMSG err)
 Returns as plain text the message error corresponding to err.

Detailed Description


Define Documentation

#define SLIFIS_ERROR (   a)
Value:
{ \
                SLIFIS_PRINT_RUNTIME << "error handler triggered:\n"; \
                SLIFIS_ERR_INFO( SLIFIS_LOG ); \
                SLIFIS_LOG << " - type : " << GetString( a ) << ENDL; \
                __OUT__; \
                slifis::ERROR_HANDLER e( a, SLIFIS_FUNCTION, __FILE__, __LINE__, clock()/1000 ); \
                throw e; \
        }

Fatal error macro. The single argument must be of type slifis::EN_ERRMSG.

Referenced by slifis::FUZZY_ROOT::AddMf(), slifis::RULE_BASE::AddNewRule(), slifis::SLIFIS::AddRule(), slifis::SLIFIS::AddRuleFromValues(), slifis::DATA_POINT::AddValue(), slifis::DATAFILE_INFO::AssignDataDescription(), slifis::SLIFIS::BuildRuleBaseFromData(), slifis::DATA_DESCR::ComputeIndexesAfterLoading(), slifis::INPUT_SETS::DeleteMf(), slifis::MEMBFUNC::DeletePoint(), slifis::DATA_POINT::FillWithInputValues(), slifis::DATAFILE_INFO::GetDelimChar(), slifis::DATAFILE_INFO::GetDescription(), slifis::DATA_SET::GetFieldType(), slifis::DATAFILE_INFO::GetFileType(), slifis::DATAFILE_INFO::GetFirstNumeric(), slifis::MEMBFUNC::GetFirstPoint(), slifis::DATA_DESCR::GetInputIndex(), slifis::RULE_BASE::GetInputSet(), slifis::DATA_POINT::GetInputValue(), slifis::MEMBFUNC::GetLastPoint(), slifis::FUZZY_ROOT::GetMf(), slifis::INPUT_SETS::GetMfSet(), slifis::INPUT_SETS::GetNbCombinations(), slifis::DATAFILE_INFO::GetNbDataPts(), slifis::RULE_BASE::GetNbInputs(), slifis::DATAFILE_INFO::GetNbNumericFields(), slifis::DATAFILE_INFO::GetNbStringFields(), slifis::DATA_DESCR::GetOutputIndex(), slifis::SLIFIS::GetOutputMf(), slifis::RULE_BASE::GetOutputSet(), slifis::RULE::GetOutputValue(), slifis::SLIFIS::GetOutputValue(), slifis::DATAFILE_INFO::GetPostReadingDescr(), slifis_plot::PLOT_FUZZY::GetScale(), slifis::DATAFILE_INFO::GetTotNbFields(), slifis::ROOT_RULE::GetTSOutputValue(), slifis::GNUPLOT_FILE::GNUPLOT_FILE(), slifis::DATAFILE_INFO::HasAttribNames(), slifis::SLIFIS::P_Evaluate_M(), slifis::DATA_SET::ReadData(), slifis::MEMBFUNC::Scale(), slifis::MEMBFUNC::Set(), slifis::RULE_IDX::SetOutMfIndex(), slifis::SLIFIS::SetOutput(), slifis::FUZZY_ROOT::SetTriangularSet(), slifis::ROOT_RULE::SetTSCoeff(), slifis::DATA_POINT::SetValue(), slifis::RULE_BASE::Sort(), slifis::MEMBFUNC::Truncate(), and slifis::SLIFIS::Write().

#define SLIFIS_ERROR_1 (   a,
 
)
Value:
{ \
                SLIFIS_PRINT_RUNTIME << "error handler triggered:\n"; \
                SLIFIS_ERR_INFO( SLIFIS_LOG ); \
                SLIFIS_LOG << " - type : " << GetString( a ) << ENDL; \
                SLIFIS_LOG << " - value:    " << (b) << ENDL; \
                __OUT__; \
                slifis::ERROR_HANDLER e( a, SLIFIS_FUNCTION, __FILE__, __LINE__, clock()/1000 ); \
                throw e; \
        }

Fatal error macro. The first argument must be of type slifis::EN_ERRMSG, while the second can be anything that can be streamed, and will be printed out in the log file.

Referenced by slifis::MEMBFUNC::AddPoint(), slifis::DATA_SET::AssignDescription(), slifis::SLIFIS::BuildRuleBaseFromData(), slifis::DATAFILE_INFO::CloseFile(), slifis::INPUT_SETS::DeleteSet(), slifis::MEMBFUNC::Fuzzify(), slifis::SLIFIS::GenerateHistogramFile(), slifis::INPUT_SETS::GetInputTriggerValues(), slifis::ROOT_RULE::GetTSCoeff(), slifis::DATAFILE_INFO::OpenFile(), slifis::DATA_SET::Print(), slifis::SLIFIS::Read(), slifis::DATA_SET::ReadData(), slifis::DATA_POINT::ReadDataFields(), slifis::DATA_DESCR::Set(), slifis::MEMBFUNC::Set(), slifis::SLIFIS::SetInputValue(), slifis_plot::PLOT_FUZZY::TransformCoordS2R(), and slifis::SLIFIS::Write().

#define SLIFIS_ERROR_2 (   a,
  b,
 
)
Value:
{ \
                SLIFIS_PRINT_RUNTIME << "error handler triggered:\n"; \
                SLIFIS_ERR_INFO( SLIFIS_LOG ); \
                SLIFIS_LOG << " - type : " << GetString( a ) << ENDL; \
                SLIFIS_LOG << " - value 1:   " << (b) << ENDL; \
                SLIFIS_LOG << " - value 2:   " << (c) << ENDL; \
                __OUT__; \
                slifis::ERROR_HANDLER e( a, SLIFIS_FUNCTION, __FILE__, __LINE__, clock()/1000 ); \
                throw e; \
        }

Fatal error macro. The first argument must be of type slifis::EN_ERRMSG, the two last can be anything that can be streamed, and will be printed out in the log file.

Referenced by slifis::DATA_DESCR::AddInputColumn(), slifis::RULE_BASE::AddNewRule(), slifis::SLIFIS::AddRule(), slifis::DATA_SET::AddStringItem(), slifis::DATA_SET::AssignDescription(), slifis::INPUT_SETS::DeleteMf(), slifis::FUZZY_ROOT::DeleteMf(), slifis::MEMBFUNC::DeletePoint(), slifis::RULE_BASE::DeleteRule(), slifis::INPUT_SETS::DeleteSet(), slifis::DATA_SET::DivideSet(), slifis::RULE_BASE::ExportCSV(), slifis::DATA_POINT::FillWithInputValues(), slifis_plot::GAPI_FillImage(), slifis_plot::GAPI_ReleaseImage(), slifis::FUZZY_ROOT::GenerateHistogramDataFile(), slifis::DATAFILE_INFO::GetAttribName(), slifis::INPUT_RANGE::GetCurrentValue(), slifis::DATA_SET::GetDataPoint(), slifis::DATA_POINT::GetDataType(), slifis::DATAFILE_INFO::GetFieldType(), slifis::DATAFILE_INFO::GetFileInfo(), slifis::FUZZY_IN::GetFuzzyValue(), slifis::SLIFIS::GetFuzzyValue(), slifis::INPUT_SETS::GetIndexCombination(), slifis::DATA_SET::GetInMMValue(), slifis::DATA_DESCR::GetInputIndex(), slifis::RULE_BASE::GetInputSet(), slifis::INPUT_SETS::GetInputTriggerValues(), slifis::DATA_POINT::GetInputValue(), slifis::DATA_SET::GetInputValues(), slifis::DATASET_PROPERTIES::GetMaxValue(), slifis::FUZZY_ROOT::GetMf(), slifis::FUZZY_ROOT::GetMfName(), slifis::DATASET_PROPERTIES::GetMinValue(), slifis::INPUT_SETS::GetName(), slifis::DATA_SET::GetOutValue(), slifis::MEMBFUNC::GetPoint(), slifis::RULE_BASE::GetRule(), slifis::RULE_IDX::GetRuleFiringStrength(), slifis::DATA_SET::GetStringCount(), slifis::ROOT_RULE::GetTSCoeff(), slifis::ROOT_RULE::GetTSOutputValue(), slifis::DATA_POINT::GetValue(), slifis::DATA_POINT::GetValue_f(), slifis::DATA_POINT::GetValue_s(), slifis::RULE::GetVarName(), slifis::RULE::GetVarValue(), slifis::INPUT_RANGE::INPUT_RANGE(), slifis::MEMBFUNC::ModifyPoint(), slifis::ROOT_RULE::operator=(), slifis::DATAFILE_INFO::P_FetchArffCommands(), slifis::DATAFILE_INFO::P_GetFileInfo_csv(), slifis::RULE_IDX::P_IsEqualUpToInput(), slifis::SLIFIS::P_Read_XML(), slifis_plot::Paint(), slifis::RULE_BASE::Print(), slifis::DATA_SET::ReadData(), slifis::RULE_IDX::RemoveTermForInput(), slifis_plot::PLOT_FS::SelectMf(), slifis::MEMBFUNC::Set(), slifis::ROOT_RULE::SetFisType(), slifis::DATA_DESCR::SetInputColumns(), slifis::SLIFIS::SetInputValue(), slifis::SLIFIS::SetInputValues(), slifis::FUZZY_ROOT::SetMfName(), slifis::FUZZY_ROOT::SetNormalisedSet(), slifis::ROOT_RULE::SetOpType(), slifis::DATA_DESCR::SetOutputColumn(), slifis::FUZZY_ROOT::SetTriangularSet(), and slifis::FUZZY_ROOT::Trigger().

Value:
catch( const ERROR_HANDLER& e ) \
        { \
                SLIFIS_LOG << " - catched exception in " << __FUNCTION__ << "(), file " << __FILE__ << "(" << __LINE__ << "), re-throw..." << FLUSH; \
                throw e; \
        }

Used inside public API to re-throw a catched exception.

Referenced by slifis::SLIFIS::DeleteInput(), slifis::FUZZY_OUT::FUZZY_OUT(), slifis::SLIFIS::GetInputTriggerValues(), and slifis::FUZZY_ROOT::SetTriangularSet().