Provides support for comparer classes. More...
Classes | |
class | ogdf::EdgeComparer |
Compares adjacency entries based on the position of the nodes given by GraphAttribute layout information. More... | |
struct | ogdf::GenericComparer< ELEM, NUM, ascending > |
Compare elements based on a single comparable attribute. More... | |
class | ogdf::StdComparer< E > |
Standard comparer (valid as a static comparer). More... | |
class | ogdf::StlGreater< TYPE, COMPARER > |
Template for converting any StdComparer into a STL compatible compare functor. More... | |
class | ogdf::StlLess< TYPE, COMPARER > |
Template for converting any StdComparer into a STL compatible compare functor. More... | |
class | ogdf::TargetComparer< CONTENTTYPE, STATICCONTENTCOMPARER > |
A static comparer which compares the target of pointers ("content"), instead of the pointer's adresses. More... | |
class | ogdf::VComparer< E > |
Abstract base class for comparer classes. More... | |
Macros | |
#define | OGDF_AUGMENT_COMPARER(type) |
Add this macro to your class to turn it into a full comparer. | |
#define | OGDF_AUGMENT_STATICCOMPARER(type) |
Add this macro to your class to turn it into a full static comparer. | |
#define | OGDF_DECLARE_COMPARER(NAME, TYPE, NUMBER, GET_X_ATTR) |
Declares a class NAME that extends from ogdf::GenericComparer. | |
#define | OGDF_STD_COMPARER(type) |
Generates a specialization of the standard static comparer for type based on compare operators. | |
Provides support for comparer classes.
#define OGDF_AUGMENT_COMPARER | ( | type | ) |
Add this macro to your class to turn it into a full comparer.
It is assumed that your class has a method "compare(const type &x, const type &y)", which returns 0 if the two elements are equal, a negative value if x is smaller, and a positive value if x is greater.
Note: If the compare function of your class requires no additional data other than the two elements to compare, your should usually use the more general OGDF_AUGMENT_STATICCOMPARER: A static comparer is also always valid as a normal comparer.
Usage in Definition:
Use the Comparer:
Definition at line 179 of file comparer.h.
#define OGDF_AUGMENT_STATICCOMPARER | ( | type | ) |
Add this macro to your class to turn it into a full static comparer.
It is assumed that your class has a static method "compare(const type &x, const type &y)", which returns 0 if the two elements are equal, a negative value if x is smaller, and a positive value if x is greater.
Note: You should use this macro instead of OGDF_AUGMENT_COMPARER whenever your compare function requires no additional data stored in the object, other than the two elements to compare. A static comparer is also always valid as a normal comparer.
Usage in Definition:
Use the Comparer:
Definition at line 225 of file comparer.h.
#define OGDF_DECLARE_COMPARER | ( | NAME, | |
TYPE, | |||
NUMBER, | |||
GET_X_ATTR | |||
) |
Declares a class NAME
that extends from ogdf::GenericComparer.
The type of compared elements is TYPE
, the returned scalar is of type NUMBER
. GET_X_ATTR
contains the actual element to scalar conversion for any element (denoted by x).
Example use to sort edges by index:
Definition at line 434 of file comparer.h.
#define OGDF_STD_COMPARER | ( | type | ) |
Generates a specialization of the standard static comparer for type
based on compare operators.
Definition at line 76 of file comparer.h.