Open
Graph Drawing
Framework

 v.2012.07
 

ogdf::VComparer< E > Class Template Reference

Abstract base class for comparer classes. More...

#include <ogdf/basic/comparer.h>

List of all members.

Public Member Functions

 VComparer ()
 Initializes a comparer.
virtual ~VComparer ()
virtual int compare (const E &x, const E &y) const =0
 Compares x and y and returns the result as an integer.
virtual bool equal (const E &x, const E &y) const
 Returns true iff x = y.
virtual bool geq (const E &x, const E &y) const
 Returns true iff x >= y.
virtual bool greater (const E &x, const E &y) const
 Returns true iff x > y.
virtual bool leq (const E &x, const E &y) const
 Returns true iff x <= y.
virtual bool less (const E &x, const E &y) const
 Returns true iff x < y.

Detailed Description

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

Abstract base class for comparer classes.

The parameterized class VComparer<E> 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 242 of file comparer.h.


Constructor & Destructor Documentation

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

Initializes a comparer.

Definition at line 245 of file comparer.h.

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

Definition at line 247 of file comparer.h.


Member Function Documentation

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.

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

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

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

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

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


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