Loading...
Searching...
No Matches
comparator.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_CONCEPT_COMPARATOR_H
#define BALL_CONCEPT_COMPARATOR_H
#ifndef BALL_COMMON_H
# include <BALL/common.h>
#endif
namespace BALL
{
template <typename T>
class Comparator
{
public:
Comparator()
;
virtual ~Comparator()
;
virtual bool isEqual(const T& a, const T& b) const
;
bool isNotEqual(const T& a, const T& b) const
;
virtual bool isLess(const T& a, const T& b) const
;
bool isLessOrEqual(const T& a, const T& b) const
;
bool isGreaterOrEqual(const T& a, const T& b) const
;
bool isGreater(const T& a, const T& b) const
;
int operator () (const T& a, const T& b) const
;
};
template <typename T>
inline Comparator<T>::Comparator()
{
}
template <typename T>
inline Comparator<T>::~Comparator()
{
}
template <class T>
inline bool Comparator<T>::isEqual(const T& a, const T& b) const
{
return (a == b);
}
template <class T>
inline bool Comparator<T>::isNotEqual(const T& a, const T& b) const
{
return !isEqual(a, b);
}
template <class T>
inline bool Comparator<T>::isLess(const T& a, const T& b) const
{
return (a < b);
}
template <class T>
inline bool Comparator<T>::isLessOrEqual(const T& a, const T& b) const
{
return !isLess(b, a);
}
template <class T>
inline bool Comparator<T>::isGreaterOrEqual(const T& a, const T& b) const
{
return !isLess(a, b);
}
template <class T>
inline bool Comparator<T>::isGreater(const T& a, const T& b) const
{
return isLess(b, a);
}
template <class T>
inline int Comparator<T>::operator () (const T& a,const T& b) const
{
if (isEqual(a, b) == true)
{
return 0;
}
if (isLess(a, b) == true)
{
return -1;
}
else
{
return 1;
}
}
} // namespace BALL
#endif // BALL_CONCEPT_COMPARATOR_H
BALL::Comparator::isGreater
bool isGreater(const T &a, const T &b) const
Definition comparator.h:133
BALL::Comparator::Comparator
Comparator()
Definition comparator.h:86
BALL::Comparator::isNotEqual
bool isNotEqual(const T &a, const T &b) const
Definition comparator.h:105
BALL::Comparator::isLessOrEqual
bool isLessOrEqual(const T &a, const T &b) const
Definition comparator.h:119
BALL::Comparator::operator()
int operator()(const T &a, const T &b) const
Definition comparator.h:140
BALL::Comparator::isGreaterOrEqual
bool isGreaterOrEqual(const T &a, const T &b) const
Definition comparator.h:126
BALL::Comparator::isEqual
virtual bool isEqual(const T &a, const T &b) const
Definition comparator.h:98
BALL::Comparator::isLess
virtual bool isLess(const T &a, const T &b) const
Definition comparator.h:112
BALL::Comparator::~Comparator
virtual ~Comparator()
Definition comparator.h:92
common.h
BALL
Definition constants.h:13