A fuzzy logic C++ library
Public Member Functions | Private Member Functions | Private Attributes | Friends
slifis::FPOINT Class Reference

A point of a membership function = a pair (REALVAL,FUZZYVAL) More...

#include <fpoint.hpp>

+ Collaboration diagram for slifis::FPOINT:

List of all members.

Public Member Functions

 FPOINT ()
 FPOINT (REALVAL x, FUZZYVAL y)
 ~FPOINT ()
void Set (REALVAL x, FUZZYVAL y)
void Set (const FPOINT &p)
REALVAL GetX () const
FUZZYVAL GetY () const
void SetX (REALVAL x)
void AddX (REALVAL val)
void SetY (FUZZYVAL y)
I/O functions
void Print (FILE *f=stderr, const char *name=NULL) const
operators
bool operator< (const FPOINT &fpt) const
 Operator needed for sorting, sorts point according to Ox axis ('real' axis)
bool operator== (const FPOINT &fpt) const
 Returns true if point fpt and current point are identical, up to a certain value (see "more")
bool operator!= (const FPOINT &m) const

Private Member Functions

bool P_Write_bin (std::ofstream &f) const
 Writes fuzzy point in stream f, returns true on success.
bool P_Read_bin (std::ifstream &f)
 Read the fuzzy point from stream f, returns true on success.
bool P_Read_XML (TiXmlElement *pElem)

Private Attributes

FUZZYVAL _y
 y-axis value of the point. Value is restricted to [0-1]
REALVAL _x
 x-axis value of the point. Value is not restricted

Friends

class MEMBFUNC
std::ostream & operator<< (std::ostream &Stream, const FPOINT &obj)

Detailed Description

A point of a membership function = a pair (REALVAL,FUZZYVAL)

All the functions that assign a value to the Fuzzy value (constructor and Set(REALVAL x, FUZZYVAL y) ) truncate the value so it always lies in the range [0:1]


Constructor & Destructor Documentation

Referenced by Set().

slifis::FPOINT::FPOINT ( REALVAL  x,
FUZZYVAL  y 
) [inline]

References _x, and _y.


Member Function Documentation

void slifis::FPOINT::Set ( REALVAL  x,
FUZZYVAL  y 
) [inline]

References FPOINT(), and Set().

Referenced by slifis::MEMBFUNC::P_RemoveUselessPoints(), and Set().

void slifis::FPOINT::Set ( const FPOINT p) [inline]

References _x, and _y.

REALVAL slifis::FPOINT::GetX ( ) const [inline]
FUZZYVAL slifis::FPOINT::GetY ( ) const [inline]
void slifis::FPOINT::SetX ( REALVAL  x) [inline]

References _x.

void slifis::FPOINT::AddX ( REALVAL  val) [inline]

References _x.

Referenced by slifis::MEMBFUNC::Shift().

void slifis::FPOINT::SetY ( FUZZYVAL  y) [inline]
void slifis::FPOINT::Print ( FILE *  f = stderr,
const char *  name = NULL 
) const
bool slifis::FPOINT::operator< ( const FPOINT fpt) const

Operator needed for sorting, sorts point according to Ox axis ('real' axis)

References _x.

bool slifis::FPOINT::operator== ( const FPOINT fpt) const

Returns true if point fpt and current point are identical, up to a certain value (see "more")

This involves doing floating-point comparison.

  • For the "real" axis, this is done with the macro FLOAT_ARE_EQUAL
  • For fuzzy axis, as these values are guarenteed to lie in the range [0:1], absolute comparison is done using constant SLIFIS_EPSILON_FUZZY.

Was inlined up to release 0.5.1, but moved over here to keep macro FLOAT_ARE_EQUAL private (symbol not exported)

References _x, _y, FLOAT_ARE_EQUAL, and SLIFIS_EPSILON_FUZZY.

bool slifis::FPOINT::operator!= ( const FPOINT m) const [inline]
bool slifis::FPOINT::P_Write_bin ( std::ofstream &  f) const [private]

Writes fuzzy point in stream f, returns true on success.

References __IN__, __OUT__, STREAM_OK_TEST, and STREAMCHECK_INIT.

bool slifis::FPOINT::P_Read_bin ( std::ifstream &  f) [private]

Read the fuzzy point from stream f, returns true on success.

References __IN__, __OUT__, STREAM_OK_TEST, and STREAMCHECK_INIT.

Referenced by slifis::MEMBFUNC::P_Read_bin().

bool slifis::FPOINT::P_Read_XML ( TiXmlElement *  pElem) [private]

Friends And Related Function Documentation

friend class MEMBFUNC [friend]
std::ostream& operator<< ( std::ostream &  Stream,
const FPOINT obj 
) [friend]

Member Data Documentation

y-axis value of the point. Value is restricted to [0-1]

Referenced by FPOINT(), GetY(), operator==(), Set(), and SetY().

x-axis value of the point. Value is not restricted

Referenced by AddX(), FPOINT(), GetX(), operator<(), operator==(), Set(), and SetX().