Open
Graph Drawing
Framework

 v. 2022.02 (Dogwood)
 

ogdf::VComparer< E > Class Template Referenceabstract

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...
 

Detailed Description

template<class E>
class ogdf::VComparer< E >

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 232 of file comparer.h.

Constructor & Destructor Documentation

◆ VComparer()

template<class E >
ogdf::VComparer< E >::VComparer ( )
inline

Initializes a comparer.

Definition at line 235 of file comparer.h.

◆ ~VComparer()

template<class E >
virtual ogdf::VComparer< E >::~VComparer ( )
inlinevirtual

Definition at line 237 of file comparer.h.

Member Function Documentation

◆ compare()

template<class E >
virtual int ogdf::VComparer< E >::compare ( const E &  x,
const E &  y 
) const
pure virtual

Compares x and y and returns the result as an integer.

The returns value is

  • < 0 iff x < y,
  • = 0 iff x = y,
  • > 0 iff x > y

Implemented in ogdf::EdgeComparer, and ogdf::EdgeComparerSimple.

◆ equal()

template<class E >
virtual bool ogdf::VComparer< E >::equal ( const E &  x,
const E &  y 
) const
inlinevirtual

Returns true iff x = y.

Definition at line 268 of file comparer.h.

◆ geq()

template<class E >
virtual bool ogdf::VComparer< E >::geq ( const E &  x,
const E &  y 
) const
inlinevirtual

Returns true iff x >= y.

Definition at line 263 of file comparer.h.

◆ greater()

template<class E >
virtual bool ogdf::VComparer< E >::greater ( const E &  x,
const E &  y 
) const
inlinevirtual

Returns true iff x > y.

Definition at line 258 of file comparer.h.

◆ leq()

template<class E >
virtual bool ogdf::VComparer< E >::leq ( const E &  x,
const E &  y 
) const
inlinevirtual

Returns true iff x <= y.

Definition at line 253 of file comparer.h.

◆ less()

template<class E >
virtual bool ogdf::VComparer< E >::less ( const E &  x,
const E &  y 
) const
inlinevirtual

Returns true iff x < y.

Definition at line 248 of file comparer.h.


The documentation for this class was generated from the following file: