Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ogdf::GenericComparer< ELEM, NUM, ascending > Struct Template Reference

Compare elements based on a single comparable attribute. More...

#include <ogdf/basic/comparer.h>

Public Types

using OrderFunction = std::function< NUM(const ELEM &)>
 

Public Member Functions

 GenericComparer (const OrderFunction &mapToValue)
 Construct a comparer with mapping mapToValue. More...
 
int compare (const ELEM &x, const ELEM &y) const
 See OGDF_AUGMENT_COMPARER. More...
 

Private Attributes

const OrderFunction m_mapToValue
 

Detailed Description

template<typename ELEM, typename NUM, bool ascending>
struct ogdf::GenericComparer< ELEM, NUM, ascending >

Compare elements based on a single comparable attribute.

Defines a non-static OGDF comparer (see macro OGDF_AUGMENT_COMPARER) that compares values of type NUM to compare elements of type ELEM.

One must provide a function that maps each element to its value.

Definition at line 42 of file comparer.h.

Member Typedef Documentation

◆ OrderFunction

template<typename ELEM , typename NUM , bool ascending>
using ogdf::GenericComparer< ELEM, NUM, ascending >::OrderFunction = std::function<NUM(const ELEM&)>

Definition at line 403 of file comparer.h.

Constructor & Destructor Documentation

◆ GenericComparer()

template<typename ELEM , typename NUM , bool ascending>
ogdf::GenericComparer< ELEM, NUM, ascending >::GenericComparer ( const OrderFunction mapToValue)
inline

Construct a comparer with mapping mapToValue.

Definition at line 406 of file comparer.h.

Member Function Documentation

◆ compare()

template<typename ELEM , typename NUM , bool ascending>
int ogdf::GenericComparer< ELEM, NUM, ascending >::compare ( const ELEM &  x,
const ELEM &  y 
) const
inline

See OGDF_AUGMENT_COMPARER.

Definition at line 409 of file comparer.h.

Member Data Documentation

◆ m_mapToValue

template<typename ELEM , typename NUM , bool ascending>
const OrderFunction ogdf::GenericComparer< ELEM, NUM, ascending >::m_mapToValue
private

Definition at line 419 of file comparer.h.


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