Open
Graph Drawing
Framework

 v. 2022.02 (Dogwood)
 

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 = true>
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 377 of file comparer.h.

Member Typedef Documentation

◆ OrderFunction

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

Definition at line 378 of file comparer.h.

Constructor & Destructor Documentation

◆ GenericComparer()

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

Construct a comparer with mapping mapToValue.

Definition at line 381 of file comparer.h.

Member Function Documentation

◆ compare()

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

See OGDF_AUGMENT_COMPARER.

Definition at line 384 of file comparer.h.

Member Data Documentation

◆ m_mapToValue

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

Definition at line 394 of file comparer.h.


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