A fuzzy logic C++ library
|
private header, symbols here never get exported in user space, only included in .cpp files More...
Defines | |
#define | STR_EXPAND(tok) #tok |
#define | STR(tok) STR_EXPAND(tok) |
#define | BUF_SIZE 512 |
Size of temporary buffer for file/string operations. | |
#define | FLOAT_ARE_EQUAL(a, b) ( fabs( (a)-(b) ) <= SLIFIS_EPSILON_REAL * std::max( fabs(a), fabs(b) ) ) |
A macro for comparing floating point values. | |
#define | SLIFIS_XML_READ_STRING_ATTRIB(a, b) |
#define | SLIFIS_XML_READ_INT_ATTRIB(a, b) |
#define | SLIFIS_XML_READ_INT_ATTRIB_2(a, t, b) |
#define | SLIFIS_XML_READ_DOUBLE_ATTRIB(a, b) |
#define | STREAM_OK_TEST(f) |
Macro for I/O operations. Checks that stream f is still ok, triggers an error if not. | |
#define | STREAMCHECK_INIT(f) |
Macro for I/O operations. Must be placed at the beginning of each function that does some I/O. | |
#define | STREAM_WRITE_STRING(f, s1) |
Macro for writing a string s to a binary stream (ofstream) f . | |
#define | STREAM_READ_STRING(f, s) |
Macro for reading a std::string s from a binary file f . Third argument n (int) is there only for debugging purposes. | |
#define | SWITCH_ERROR |
This macro is used in switch statements on enums to indicate the default case that should never be triggered. | |
#define | VECTOR_ELEM(a, b) a[b] |
private header, symbols here never get exported in user space, only included in .cpp files
#define STR_EXPAND | ( | tok | ) | #tok |
#define STR | ( | tok | ) | STR_EXPAND(tok) |
Referenced by slifis::SLIFIS::GetVersion_String(), and slifis::SLIFIS::P_Write_FCL().
#define BUF_SIZE 512 |
Size of temporary buffer for file/string operations.
#define FLOAT_ARE_EQUAL | ( | a, | |
b | |||
) | ( fabs( (a)-(b) ) <= SLIFIS_EPSILON_REAL * std::max( fabs(a), fabs(b) ) ) |
A macro for comparing floating point values.
For best performance, don't put any function calls as arguments, as they will be called several times...
Referenced by slifis::MEMBFUNC::Fuzzify(), slifis::FPOINT::operator==(), slifis::ROOT_RULE::operator==(), slifis::MEMBFUNC::P_PointIsTooClose(), and slifis::PrintDifferences().
#define SLIFIS_XML_READ_STRING_ATTRIB | ( | a, | |
b | |||
) |
std::string b; \ if( TIXML_SUCCESS != pElem->QueryStringAttribute( (a), &b ) ) \ { \ SLIFIS_ERROR_LOG << "xml error: unable to read 'std::string' attribute \"" << (a) << "\"\n"; \ return false; \ }
Referenced by slifis::FUZZY_ROOT::P_Read_XML(), slifis::RULE_IDX::P_Read_XML(), and slifis::MEMBFUNC::P_Read_XML().
#define SLIFIS_XML_READ_INT_ATTRIB | ( | a, | |
b | |||
) |
int b; \ if( TIXML_SUCCESS != pElem->QueryIntAttribute( (a), &b ) ) \ { \ SLIFIS_ERROR_LOG << "xml error: unable to read 'int' attribute \"" << (a) << "\"\n"; \ return false; \ }
Referenced by slifis::FUZZY_ROOT::P_Read_XML(), slifis::RULE_BASE::P_Read_XML(), slifis::RULE_IDX::P_Read_XML(), slifis::MEMBFUNC::P_Read_XML(), and slifis::SLIFIS::P_Read_XML().
#define SLIFIS_XML_READ_INT_ATTRIB_2 | ( | a, | |
t, | |||
b | |||
) |
{ \ int c; \ if( TIXML_SUCCESS != pElem->QueryIntAttribute( (a), &c ) ) \ { \ SLIFIS_ERROR_LOG << "xml error: unable to read 'int' attribute \"" << (a) << "\"\n"; \ return false; \ } \ b = (t)c; \ }
Referenced by slifis::SLIFIS::P_Read_XML().
#define SLIFIS_XML_READ_DOUBLE_ATTRIB | ( | a, | |
b | |||
) |
double b; \ if( TIXML_SUCCESS != pElem->QueryDoubleAttribute( (a), &b ) ) \ { \ SLIFIS_ERROR_LOG << "xml error: unable to read 'double' attribute \"" << (a) << "\"\n"; \ return false; \ }
Referenced by slifis::FPOINT::P_Read_XML(), and slifis::RULE_IDX::P_Read_XML().
#define STREAM_OK_TEST | ( | f | ) |
stream_test_counter++; \ if( f.good() == false ) \ { \ SLIFIS_ERROR_LOG << "File error at step " << __COUNTER__ << ", counter="<< stream_test_counter <<", in "<< SLIFIS_FUNCTION << endl; \ __OUT__; \ return false; \ } \
Macro for I/O operations. Checks that stream f
is still ok, triggers an error if not.
Referenced by slifis::FPOINT::P_Read_bin(), slifis::ROOT_RULE::P_Read_bin(), slifis::FUZZY_ROOT::P_Read_bin(), slifis::RULE_BASE::P_Read_bin(), slifis::RULE_IDX::P_Read_bin(), slifis::MEMBFUNC::P_Read_bin(), slifis::SLIFIS::P_Read_bin(), slifis::FPOINT::P_Write_bin(), slifis::INF_PARAMS::P_Write_bin(), slifis::ROOT_RULE::P_Write_bin(), slifis::FUZZY_ROOT::P_Write_bin(), slifis::RULE_BASE::P_Write_bin(), slifis::RULE_IDX::P_Write_bin(), slifis::MEMBFUNC::P_Write_bin(), and slifis::SLIFIS::P_Write_bin().
#define STREAMCHECK_INIT | ( | f | ) |
int stream_test_counter=0; \
STREAM_OK_TEST( f )
Macro for I/O operations. Must be placed at the beginning of each function that does some I/O.
Referenced by slifis::FPOINT::P_Read_bin(), slifis::INF_PARAMS::P_Read_bin(), slifis::ROOT_RULE::P_Read_bin(), slifis::FUZZY_ROOT::P_Read_bin(), slifis::RULE_BASE::P_Read_bin(), slifis::RULE_IDX::P_Read_bin(), slifis::MEMBFUNC::P_Read_bin(), slifis::SLIFIS::P_Read_bin(), slifis::FPOINT::P_Write_bin(), slifis::INF_PARAMS::P_Write_bin(), slifis::ROOT_RULE::P_Write_bin(), slifis::FUZZY_ROOT::P_Write_bin(), slifis::RULE_BASE::P_Write_bin(), slifis::RULE_IDX::P_Write_bin(), slifis::MEMBFUNC::P_Write_bin(), and slifis::SLIFIS::P_Write_bin().
#define STREAM_WRITE_STRING | ( | f, | |
s1 | |||
) |
{ \ std::string s(s1); \ size_t size = s.size(); \ f.write( (char*)&size, sizeof( size_t ) ); \ STREAM_OK_TEST( f ); \ const char* p = s.c_str(); \ f.write( (char*)p, size ); \ STREAM_OK_TEST( f ); \ }
Macro for writing a string s
to a binary stream (ofstream) f
.
the s1
argument if first copied into a string, so we can use this macro with a std::string or with a const char*
Referenced by slifis::FUZZY_ROOT::P_Write_bin(), slifis::MEMBFUNC::P_Write_bin(), and slifis::SLIFIS::P_Write_bin().
#define STREAM_READ_STRING | ( | f, | |
s | |||
) |
{ \ size_t size; \ f.read( (char*)&size, sizeof( size_t ) ); \ STREAM_OK_TEST( f ); \ char* p = new char [size+1]; \ f.read( p, size ); \ STREAM_OK_TEST( f ); \ p[size]=0; \ s = p; \ delete[] p; \ }
Macro for reading a std::string s
from a binary file f
. Third argument n
(int) is there only for debugging purposes.
This does the following:
Referenced by slifis::FUZZY_ROOT::P_Read_bin(), slifis::MEMBFUNC::P_Read_bin(), and slifis::SLIFIS::P_Read_bin().
#define SWITCH_ERROR |
{ \ SLIFIS_ERROR_LOG << "SWITCH_ERROR !\n"; \ SLIFIS_ERR_INFO( SLIFIS_LOG ); \ assert(0); \ }
This macro is used in switch statements on enums to indicate the default case that should never be triggered.
Referenced by slifis::RULE_BASE::AddNewRule(), slifis::MEMBFUNC::Defuzzify(), slifis::FuzzyMerge(), slifis::GetChar_FieldType(), slifis::DATAFILE_INFO::GetFileInfo(), slifis::RULE_IDX::GetRuleFiringStrength(), slifis::GetString(), slifis::SLIFIS::P_Evaluate_M(), slifis::P_Process_OneSide(), slifis::RULE_BASE::P_SelectBestRule(), slifis::RULE::Print(), slifis::RULE_BASE::Print(), slifis::DATAFILE_INFO::Print(), slifis::RULE_IDX::Print(), slifis::DATA_POINT::Print(), slifis::RULE_BASE::Print2(), slifis::SLIFIS::Read(), slifis::MEMBFUNC::Set(), slifis::SLIFIS_STREAM_OP(), and slifis::SLIFIS::Write().
#define VECTOR_ELEM | ( | a, | |
b | |||
) | a[b] |
Referenced by slifis::DATA_SET::GetOutValue(), and slifis::RULE_BASE::P_SelectBestRule().