Kea 2.7.5
|
This is a supplemental class used only as a return value of Name::compare() and LabelSequence::compare(). More...
#include <name.h>
Public Types | |
enum | NameRelation { SUPERDOMAIN = 0 , SUBDOMAIN = 1 , EQUAL = 2 , COMMONANCESTOR = 3 , NONE = 4 } |
The relation of two names under comparison. More... | |
Public Member Functions | |
Constructors and Destructor | |
NameComparisonResult (int order, unsigned int nlabels, NameRelation relation) | |
Constructor from a comparison tuple. | |
Getter Methods | |
int | getOrder () const |
Returns the ordering of the comparison result. | |
unsigned int | getCommonLabels () const |
Returns the number of common labels of the comparison result. | |
NameRelation | getRelation () const |
Returns the NameRelation of the comparison result. | |
This is a supplemental class used only as a return value of Name::compare() and LabelSequence::compare().
It encapsulate a tuple of the comparison: ordering, number of common labels, and relationship as follows:
Note that the ordering is defined for two label sequences that have no hierarchical relationship (in which case the relationship will be NONE). For example, two non absolute (or "relative") sequences "example.com" and "example.org" have no hierarchical relationship, and the former should be sorted before (i.e. "smaller") than the latter.
The relation of two names under comparison.
Its semantics for the case of name1->compare(name2)
(where name1 and name2 are instances of the Name
or LabelSequence
class) is as follows:
Note that there's always a hierarchical relationship between any two names since all names (not generic label sequences) are absolute and they at least share the trailing empty label. So, for example, the relationship between "com." and "net." is "commonancestor". The relationship of "NONE" can only happen for comparison between two label sequences (LabelSequence
objects); usually only SUPERDOMAIN, SUBDOMAIN or EQUAL are important relationship between two names.
When two LabelSequence
objects are compared, it's generally expected they are either both absolute or both non absolute; if one is absolute and the other is not, the resulting relationship will be NONE.
Enumerator | |
---|---|
SUPERDOMAIN | |
SUBDOMAIN | |
EQUAL | |
COMMONANCESTOR | |
NONE |
|
inline |
|
inline |
|
inline |
|
inline |