Abstract base class for comparer classes. More...
#include <ogdf/basic/comparer.h>
Public Member Functions | |
VComparer () | |
Initializes a comparer. More... | |
virtual | ~VComparer () |
virtual int | compare (const E &x, const E &y) const =0 |
Compares x and y and returns the result as an integer. More... | |
virtual bool | equal (const E &x, const E &y) const |
Returns true iff x = y . More... | |
virtual bool | geq (const E &x, const E &y) const |
Returns true iff x >= y . More... | |
virtual bool | greater (const E &x, const E &y) const |
Returns true iff x > y . More... | |
virtual bool | leq (const E &x, const E &y) const |
Returns true iff x <= y . More... | |
virtual bool | less (const E &x, const E &y) const |
Returns true iff x < y . More... | |
Abstract base class for comparer classes.
The parameterized class VComparer is an abstract base class for encapsulating compare functions for type E. Implementations derive from this class and implement at least the compare() method.
The methods of this class are all virtual, which comes with a certain performance penalty. Its advantage is that if you require multiple Comparers for the same class E, functions using compareres on E are not generated multiple times, which means smaller code.
If size is not an issue, but speed is, use a Comparer with non-virtual functions. You may want to use the convenience classes StdComparer and TargetComparer, or the convenience macros OGDF_AUGMENT_COMPARER, OGDF_AUGMENT_STATICCOMPARER, OGDF_STD_COMPARER to obtain non-virtual classes with few effort.
Definition at line 258 of file comparer.h.
|
inline |
Initializes a comparer.
Definition at line 261 of file comparer.h.
|
inlinevirtual |
Definition at line 263 of file comparer.h.
|
pure virtual |
Compares x
and y
and returns the result as an integer.
The returns value is
Implemented in ogdf::EdgeComparer, and ogdf::EdgeComparerSimple.
|
inlinevirtual |
Returns true iff x
= y
.
Definition at line 286 of file comparer.h.
|
inlinevirtual |
Returns true iff x
>= y
.
Definition at line 283 of file comparer.h.
|
inlinevirtual |
Returns true iff x
> y
.
Definition at line 280 of file comparer.h.
|
inlinevirtual |
Returns true iff x
<= y
.
Definition at line 277 of file comparer.h.
|
inlinevirtual |
Returns true iff x
< y
.
Definition at line 274 of file comparer.h.